DRG Assignment Software & Services
[ Home | Products | Services | Tech Support | Tech Blog ]
[ DRG FAQ | Upload Files to Us | Free Downloads | Contact Us ]

Version 33 with ICD10 support is here! Released Oct 20th, 2015 (see tech blog New site)
Download This File as a PDF
Looking for more information about DRGs, groupers in general, or our grouper product line in particular? Download our complete manual / catalog / reference as a PDF: drgman.pdf. Also available soon as a paperback book from Amazon.
[Top of Page]
Every year the US Federal government releases a new DRG version. The earliest version we sell through our on-line store is Version 10, which we call "f10" for Federal Version 10.
The official release is on October 1st every year and we usually release our implementation of the algorithm by October 15th every year.
Please specify which version you need for any of our products. Our software is backwardly compatible, so if you buy the version 20 grouper, that module can handle versions 10 through 20, assuming that you have purchased the appropriate masks file.
NOTE: We have support for versions 2 through 9, but demand is low enough that we do not clutter up our on-line store with them. You can purchase support for versions 2 through 9, but only by contacting us directly.
VersionReleasedRetired VersionReleasedRetired VersionReleasedRetired
f33 Oct 1, 2015 Sep 30, 2016 f25 Oct 1, 2007 Sep 30, 2008 f17 Oct 1, 1999 Sep 30, 2000
f32 Oct 1, 2014 Sep 30, 2015 f24 Oct 1, 2006 Sep 30, 2007 f16 Oct 1, 1998 Sep 30, 1999
f31 Oct 1, 2013 Sep 30, 2014 f23 Oct 1, 2005 Sep 30, 2006 f15 Oct 1, 1997 Sep 30, 1998
f30 Oct 1, 2012 Sep 30, 2013 f22 Oct 1, 2004 Sep 30, 2005 f14 Oct 1, 1996 Sep 30, 1997
f29 Oct 1, 2011 Sep 30, 2012 f21 Oct 1, 2003 Sep 30, 2004 f13 Oct 1, 1995 Sep 30, 1996
f28 Oct 1, 2010 Sep 30, 2011 f20 Oct 1, 2002 Sep 30, 2003 f12 Oct 1, 1994 Sep 30, 1995
f27 Oct 1, 2009 Sep 30, 2010 f19 Oct 1, 2001 Sep 30, 2002 f11 Oct 1, 1993 Sep 30, 1994
f26 Oct 1, 2008 Sep 30, 2009 f18 Oct 1, 2000 Sep 30, 2001 f10 Oct 1, 1992 Sep 30, 1993
[Top of Page]
CGI-DRG is Common Gateway Interface (CGI) program, which means that it can be called by a web server. CGI-DRG works with Microsoft's Internet Information Service (IIS) under NT or Windows 2000. CGI-DRG also works with just about any web server under UNIX (we test with Apache under Linux).
CGI-DRG needs to know where to find the DRG mask files you have, so you have to give CGI-DRG that information when you call it for the first time in any given session. This is transparent to the user: just put the path to the DRG masks in the URL that the user clicks on.
(The masks files are binary data files whose names are of the form "drgmasks.fNN" where "NN" is the CMS (formerly HCFA) DRG version. So the masks file for version 12 is called "drgmasks.f12".)
  1. Put the CGI-DRG executable into whatever directory your web server expects to find it. C:\Inetpub\WWWRoot\Scripts is common, as is C:\Inetpub\WWWRoot\cgi-bin. If you have installed CGI-DRG correctly, you will be able to run the program and get the appropriate form, but you won't be able to assign a DRG yet because CGI-DRG won't be able to find the masks files.

  2. Create a directory on your web server into which to put the masks files. For example, you might create "D:\MNH\DRG".

  3. Copy your masks files into the masks directory.

  4. Create a URL to call CGI-DRG. For instance, one of our test servers is called "w2k-server" and runs Windows 2000. We put the masks in D:\MNH\DRG and CGI-DRG.EXE in the scripts directory, so the URL on our system is: http://w2k-server/scripts/cgi-drg.exe/d:/mnh/drg

[Top of Page]
There is now an MS-DOS batch file, "sa-drg.bat," and a Bourne shell script, "sa-drg," which does all the work for you. You just invoke that command at the prompt:
[Top of Page]
DRGFilt is a Unix-style "filter" so it reads its input from STDIN and writes its output to STDOUT and writes its errors to STDERR.
To install DRGFilt, you put the DRGFilt executable in a directory in the users' search path (often /usr/local/bin), and you put the masks file(s) and control file(s) in a directory which is readable by the users (often /usr/local/drggrouper or /usr/share/drggrouper).
WARNING: Tragically, a historical accident means that a leading dot in a masks file or path name will confuse DRGFilt, so please don't use masks file names or path names that start with "."
[Top of Page]
To assign version 15 DRGs to the contents of a file names "input" and to save the results in a file named "output" you would do the following:
 drgfilt f15 drgmasks.f15 cntl.f15 < input > output
[Top of Page]
If you invoke DRGFilt with no arguments, it gives you a simple usage message. For US Federal (CMS--formerly HCFA) version 15, that message looked like this:
 drgfilt (c) 1989-2001 M+H Consulting LLC. (f15)
 Usage: drgfilt [-0|1] version masksfile cntlfile
This tells you that -0 or -1 are optional arguments, but that a version, a masksfile and a control file name are all required. The version is "f" + the CMS (formerly HCFA) version number you want, so version 19 (released in October of 2001) would be "f19". The masks file is our format file of ICD9cm-specific grouping masks; these files are named "drgmasks.VN" where "VN" is replaced by the version number. So the version 19 masksfile would be "drgmasks.f19". The control file is documented in its own section.
[Top of Page]
The control file controls DRGFilt's hunt for input. In order to group, DRGFilt needs the five inputs mentioned earlier: a contiguous string of diagnoses, a contiguous string of procedures, an age, a sex and a discharge status. Since DRGFilt is meant to operate on arbitrary input records, each input record has to be described so DRGFilt can find what it is looking for. The control file is that description.
The control file also tells DRGFilt where you want it to write the results of its grouping.
The control file is a simple ASCII text file with one variable description per line. The fields in the description are fixed-width and always in this order: keyword, offset length. Leading whitespace is not allowed. Th first 4 characters of every line are the keyword. The fifth character is ignored and is usually a blank for readability. The next 3 characters are the offset, which is also followed by a spacer character. Finally, the next 2 characters are the length. Either the '/' character or the '#' character can be used as the comment character.
sex In Where to find Patient gender, coded 1=male, 2=female
age In Where to find Patient age, expected to be 0-124
dx In Where to find the start of the contiguous diagnosis string
dxl In Length of each code in the contiguous diagnosis string (offset ignored)
surg In Where to find the start of the contiguous procedure string
sgl In Length of each code in the contiguous procedure string (offset ignored)
ds In Where to find Discharge Status, coded following UB82
recl In See note 1, below

drg Out Where in the output record to put the DRG
mdc Out Where in the output record to put the MDC
rc Out Where in the output record to put the Grouper return code
ver Out Where in the output record to put the version of DRGs being assigned
dflg Out See note 2, below
sflg Out See note 3, below

  1. recl was introduced with DRGFilt f16. If you don't specify a record length with "recl" then DRGFilt assumes that its input is a text file and that each line of the text file is a record. If you do specify a record length, then DRGFilt reads its input in chunks as big you specified, ignoring end-of-line markers.

  2. dflg is short for "diagnosis flags." It is possible that for any given input record some of the diagnosis codes will be ignored as irrelevant to the group into which the record ultimately falls. In order to report which diagnosis codes were used and which were not, our grouper keeps a list of flags, one per diagnosis, of upto 16 diagnoses. These flags are boolean, which means that they are either zero, meaning "this code was not relevant," or one, meaning "this code was relevant." If you use the dflg keyword, your output will have a string of ones and zeros in it which tell you, in order, which diagnosis codes were used and which were not.

  3. sflg is short for "surgery flags" because, once upon a time, "surgery" and "procedure" were synonymous. See the note on "dflg" for an explanation of the code flag data type. If you use the sflg keyword, your output will have a string of ones and zeros in it which tell you, in order, which procedure codes were used and which were not.

[Top of Page]
Here is the control file we use to run DRGFilt against the standard CMS (formerly HCFA) test data set:
 # DRGFilt control file for federal testdb
 # there are 3 columns: name, offset and length
 # --------------------------- input fields
 age  000 03
 sex  003 01
 ds   004 02
 dxl  000 06
 dx   006 60
 sgl  000 07
 surg 066 70
 # --------------------------- output fields
 drg  195 03
 mdc  198 02
 rc   200 01
 #'dflg' stands for "DX Flags" and 'sflg' stands
 # for "Surgery Flags". (In ancient times, we called
 #"Procedures" "Surgeries").
 # these are bit-strings by which we mean strings
 # of 1's and 0's. Each element of the string
 # corresponds to a code. So the fifth element of
 # dflag corresponds to the fifth Dx code.
 # If an element is 1, then the corresponding code was
 # used in the DRG assignment. If 0, then not.
 # dflg represents all the DX codes.
 dflg 201 10
 # sflg represents all the Procedure codes.
 sflg 211 15
 # M or P attribute of the DRG that was assigned.
 # Actually, either "Medical" or "Procedure" will be
 # spelled out, depending on how long you make the
 # output length.
 morp 226 01
[Top of Page]
DRGFilt is a UNIX-style "filter" which means that it is a program that reads from STDIN and writes to STDOUT. Under UNIX, MS-DOS, OS/2 and NT, the syntax for this is the same: "<" means STDIN and ">" means STDOUT.
[Top of Page]
"-0" means "the control file offsets are zero-based," which is the default. "-1" means "the control file offsets are one-based." Zero-based offsets are offsets which start at zero, so the first position in the record is 0. One-based offsets are offsets which start 1, so the first position in the record is 1.
[Top of Page]
Our grouper traps a number of errors and reports them as a numeric code. Here are the codes and their descriptions:
Code Description Code Description
1Bad principal diagnosis 6Unspecified DRG error
2Bad prin dx for MDC 7Invalid prin diagnosis
3Invalid age 8No DRG file this version
4Invalid sex 9DRG number too high
5Invalid discharge status 10Error in DRG file
[Top of Page]
  • Error 1 means EITHER that there were no diagnosis codes given or that the given principal dx code does not have an MDC (ie is not valid as a principal dx).
  • Error 2 means no DRG could be found to match MDC and principal dx.
  • Error 3 means that the given age was not between 0-124.
  • Error 4 means that the given sex was not 1=male or 2=female
  • Error 5 is no longer used; Discharge Status is defaulted depending on various factors (disposition status coding system, eg)
  • Error 6 depends on various factors; for example, for some DRG versions this means that birthweight was not between 200 and 9000 grammes.
  • Error 7 means that the principal dx code was not a valid choice as a primary diagnosis; the code may be valid, but it is not an allowed starting point for assigning a DRG.
  • Error 8 means that the DRG masks file could not be found or initialized by the run-time environment.
  • Error 9 means that the DRG to be labelled is too high for the specified DRG version
  • Error 10 means that the DRG masks file has internal structural errors.
[Top of Page]
If this paper doesn't answer your Grouper-related technical questions, please feel free to submit your questions to us via email to techsupport@drggroupers.net.
[Top of Page]

[ Home | Feedback | Top of Page | Site Map ]
© 2002-2015, M+H Consulting LLC, all rights reserved    (updated: Sun Nov 16 2014)
Valid HTML 4.01!