Showing posts with label CGI-DRG. Show all posts
Showing posts with label CGI-DRG. Show all posts

Wednesday, October 28, 2015

DRGFilt and CGI (Web UI)

With our new DRGFilt control file format it seemed that one could use DRGFilt as a Web page helper app. In other words, we figured it should be easy to call DRGFilt from a CGI script to add DRG assignment to a web page. So we allocated a couple of hours to put that theory to the test and ended up with a fully functional web-based interactive grouper.

We were especially interested in this experiment because we use web-based interactive groupers internally, mostly for debugging specific cases because it is easier for a customer service person to use a web page than to use DRGFilt directly for a single case. We were looking to replace our old CGI-DRG product because we did not want to maintain it in the ICD10 world.

Step 1: we created a simple and lightweight Perl script to provide a basic HTML form and to call DRGFilt which we called "drgui.pl" for "DRG User Interface" and which we eventually made publicly available here.

Step 2: we created a DRGFilt control file group to do CGI, which we cleverly called "cgi":

; this group was added to support drgfilt-as-CGI helper
[cgi]
verbose = 0;
format = csv (^)        ; separator character is in parens
base = 0                ; indices are zero-based
inheaders = 0           ; 1=input column headers, 0=no input column headers
outheaders = 0          ; 1=want column headers, 0=no headers
crlf = 0                ; type of end-of-line: either crlf or lf
blip = 1                ; want something in the log
blipeol = 1             ; 1=newline for progress report, 0=carriage return
batchver = 33
maskdir = /var/www/cgi-bin/drgstuff
log = /tmp/me.out

; input variables: name = index
inid = 0
age =  1
sex = 2
exmp = 3
ds =  4
dx = 5-29
poa = 30-54
surg= 55-79

; these are written out by DRGFilt
rc  = 0
mdc = 1
drg = 2
outver = 3
weight = 4
mean = 5
morp = 6
desc = 7
dflg = 8                ; string of flags for which dx codes were used
sflg = 9                ; string of flags for which pr codes were used
; eof


Step 3: we created some simple plumbing from drgui.pl to DRGFilt (send the input via stdin, read the output via stdout):

my @i = ();
push(@i,0);                     # 0: the record ID
push(@i,$vars{'age'});          # 1: patient age on admission
push(@i,$vars{'sex'});          # 2: patient sex (1=male, 2=female)
push(@i,$vars{'exempt'});       # 3: exempt
push(@i,$vars{'dstat'});        # 4: discharge status (home)
for (my $i = 0; $i < 25; $i++) {# 6-29: ICD DX codes
    my $icd = substr($dx,$i*7,7);
    $icd =~ s/\s+$//;
    push(@i,$icd);
}
for (my $i = 0; $i < 25; $i++) {# 30-54: POA codes
    push(@i,substr($poa,$i,1));
}
for (my $i = 0; $i < 25; $i++) {# 55-79: ICD procedure codes
    my $icd = substr($px,$i*7,7);
    $icd =~ s/\s+$//;
    push(@i,$icd);
}
my $inrec = join('^',@i);

open(PIPE,"/bin/echo \"$inrec\" | $MYDIR/drgfiltv33 -v -l /tmp/me.out $MYDIR/v33.ini cgi|");
my $retval = <PIPE>;
($rc,$mdc,$drg,$ovn,$weight,$mean,$porm,$desc,$dxu,$pru) = split(/\^/,$retval,-1);


Step 4: pick a test case from the CMS data set and try it out:

[       2]-------------------------------------------
   Age: 055   
   Sex: M   
  Disp: 01

  Exem: Z (Exempt-from-HAC indicator)

   DRG: 231    
   MDC: 05    
   GRC: 00

  DX's| Code    |POA indicator
 -----+--------------
  DX01| B5881   |Y
  DX02| I2101   |

Proc's| Code
 -----+---------------------
  SG01| 0210093
  SG02| 02UG3JZ


Step 5: declare success and decide to put this out on the web so that our customers can debug issues with their own installations.

Sunday, October 6, 2013

CGI-DRG Issue

We do not think that this is an F31-specific issue, but in validating F31 we found an undesirable behavior in CGI-DRG:

  1. Enter a valid case and assign a DRG to it.
  2. Toggle the "exempt" flag ON and assign the DRG.
  3. Toggle the "exempt" flag OFF and assign the DRG
    1. the POA flag will be appended to the DX code as data
    2. this will cause an "Invalid Prin DX" error

Fix: after toggling the exempt flag, manually remove the POA flag from the end of any DX codes so affected.

We do not have time to address this  issue directly, but we hope to release an upgrade when the dust settles on F31.

Friday, February 8, 2013

CGI-DRG on A PC (VB-DRG Replacement)

We are discontinuing VB-DRG (details here) which means that we do not have a simple desktop DRG assigning solution--or do we?

One of our developers pointed out that he runs CGI-DRG on his Windows 7 PC and that others could as well.

Our customer service head was doubtful that this is a solution for most users, since it requires installing a web server on the PC first. But we let the developer write up his solution so we could post it in case it is more widely interesting than Customer Service thinks. This is the tech blog after all.

To run CGI-DRG on a PC, you need to do three things:
  1. install a web server on the PC (just do this once)
  2. install CGI-DRG (need a new one every year)
  3. install MASKS (need a new one every year)

INSTALL THE WEB SERVER (ONE TIME)

If you have IT support, perhaps they can put a "personal web server" (PWS) on your PC for you; just remember that your PWS has to be able to run CGI scripts.

(A PWS should not be too much of a security issue since it should be configured to only provide service to the PC itself, not over the network.)

If you have to install it yourself, it isn't too big a deal. I choose the Abyss Web Server from Aprelium because it is highly reviewed, it is free and it worked the first time: http://www.aprelium.com/abyssws/

In order to write these instructions, I started with a fresh Windows 7 machine and did the following:
  1. Download the free PWS installation appropriate to your O/S from here: http://www.aprelium.com/abyssws/download.php (I chose the Windows link, the first one.) This downloaded abwsx1.exe, which contained both 32-bit and 64-bit versions. Not sure which one you need? Don't panic, Microsoft tells you how to find out here: http://support.microsoft.com/kb/827218 But it did not matter for me, the installer correctly chose 32-bit automatically.
  2. Run the installer (abwsx1.exe) and take all the defaults. I chose to have the web server start on user login because I don't want to have to start it up myself when I need it, but I am irrationally afraid of making it a windows service. Do whatever makes sense to you.
  3. The Windows 7 firewall complained about something. I agreed to the default and most strict option.
  4. I confirmed that the Abyss Web Server was up and running by entering http://127.0.0.1/ into my local browser; 127.0.0.1 is the IP address of the local machine. I got back the default Abyss Web Server web page, so I knew that all was well.
  5. Now we need to allow this PWS to run CGI scripts; first, we create the directory in which to put the CGI scripts: c:\Abyss Web Server\htdocs\cgi-bin". In other words, you are adding a subdirectory "cgi-bin" to the existing directory "c:\Abyss Web Server\htdocs".
  6. Now the only slightly tricky part: giving this directory permission to run scripts. You go to this URL and follow the prompts: http://127.0.0.1:9999
    1. choose a language (English, French or Arabic)
    2. set up web server credentials
    3. use the web server credentials to log in 
    4. hit the "configure" button in the blue "Hosts" box
    5. choose Aliases, then Add
    6. Virtual path="/cgi-bin", Real path="C:\Abyss Web Server\htdocs\cgi-bin"
    7. hit OK
    8. choose Scripting Parameters add a new script path for "/cgi-bin"
    9. hit Restart and wait until the console returns

INSTALL CGI-DRG (EVERY YEAR)

I am not sure how customers get CGI-DRG: I get it as cgi-drg.exe. I put that file into c:\Abyss Web Server\htdocs\cgi-bin; I like to use the command line like this:

c>\users\dev> copy cgi-drg.exe "c:\Abyss Web Server\htdocs\cgi-bin"

but you can use the Windows Explorer or whatever you want to put cgi-drg.exe into that directory.


INSTALL THE MASKS (EVERY YEAR)

You can use the standard DRGGroupers.com installer to install the masks file, in which case if you take the default, it (they) will go into "c:\program files\mandh\masks" so I will assume that did that or copied the masks file into that directory.


RUN CGI-DRG (WHENEVER YOU WANT)

Once all three installs are done, to run CGI-DRG you enter the following URL into the browser of your choice:

http://127.0.0.1/cgi-bin/cgi-drg.exe/program%20files/mandh/masks

Note that CGI-DRG automatically detects all the versions that you have bought and will give you the ability to choose which one you want for any individual DRG assignment session.

What could be simpler?

SCREEN SHOT

Almost forgot, here is what it looks like:





Tuesday, December 4, 2012

"Expired" Bug: CGI-DRG, VB-DRG, Access-DRG

A customer recently reported a bug to us which we have tracked down and are in the process of fixing.

The bug is this: if one used "Expired" as a discharge status in VB-DRG, Access-DRG or CGI-DRG, with the case described below, a bogus error was returned: code 5, "invalid discharge status."

Test case: primary diagnosis of 41071 and a discharge status of Expired.

Obviously, Expired is a valid discharge status: we had a bug in handling it. For some reason our mapping of Expired was explicitly not done for versions higher than 25.

We have fixed the bug and expect a re-release of version 30 by February 4th, 2013.

In order to validate our product, we used a DRG assignment app from another organization:

http://cs1.claimshop.net/grouper_demo/grouper_main.aspx

Wednesday, October 12, 2011

F29 Release: Windows Validation

Win32 DRGFilt...Passed
Win32 C-callable DLL...Passed
Win32 VB-callable DLL...Passed
Win32 VB-DRG / VB-callable DLL compatibility...Passed
Win32 CGI-DRG...Passed
Win32 F29 ICD9 table...Passed
Win32 ICD labeling DLL...Passed

Win32 F29 masks installer...Passed
Win32 C-callable DLL installer...Passed
Win32 VB-callable DLL installer...Passed

Our windows product line is validated and ready for shipping.

Tuesday, October 11, 2011

F29 Release: Linux Validation

F29 Linux Product Validation Log

Masks for F29...Passed
DAE Regression Test...Passed
Linux DRGFilt for F29...Passed
Demo Linux version of DRGFilt...Passed
Linux C Shared Object for F29...Passed
Linux Perl Shared Object for F29...Passed
Linux PHP Shared Object for F29...Passed
Linux CGI-DRG for F29...Passed

Details

Masks for F29...Passed
Validated the masks file against official list, which we found here. Not that some MS-DRGs are not defined, such as 9, 18, 19, etc.

DAE Regression Test...Passed
Ran the latest DAE through our regression testing suite.

[Tue Oct 11 16:33:41 2011]     | --------SUMMARY-----------
[Tue Oct 11 16:33:41 2011]     |   v29: Ok
[Tue Oct 11 16:33:41 2011]     |   v28: Ok
[Tue Oct 11 16:33:41 2011]     |   v27(poa): Ok
[Tue Oct 11 16:33:41 2011]     |   v27: Ok
[Tue Oct 11 16:33:41 2011]     |   v26(poa): Ok
[Tue Oct 11 16:33:41 2011]     |   v26: Ok
[Tue Oct 11 16:33:41 2011]     |   v25: Ok
[Tue Oct 11 16:33:41 2011]     |   v24: Ok
[Tue Oct 11 16:33:41 2011]     |   v23: Ok
[Tue Oct 11 16:33:41 2011]     |   v22: Ok
[Tue Oct 11 16:33:41 2011]     |   v21: Ok
[Tue Oct 11 16:33:41 2011]     |   v20: Ok
[Tue Oct 11 16:33:41 2011]     |   v19: Ok
[Tue Oct 11 16:33:41 2011]     |   v18: Ok
[Tue Oct 11 16:33:41 2011]     |   v17: Ok
[Tue Oct 11 16:33:41 2011]     |   v16: Ok
[Tue Oct 11 16:33:41 2011]     |   v15: Ok
[Tue Oct 11 16:33:41 2011]     |   v14: Ok
[Tue Oct 11 16:33:41 2011]     |   v13: Ok
[Tue Oct 11 16:33:41 2011]     |   v12: Ok




Linux DRGFilt for F29...Passed
Validated the DAE with DRGFilt against the test data set with this control file:

age  000 03
sex  003 01
ds   004 02
dxl  000 08
poa  000 07
dx   023 96
sgl  000 07
surg 223 98
exmp 006 01
# these are written out by us
drg  607 03
mdc  610 02
rc   612 02
dflg 614 15
sflg 629 15

Using our validation script, we compare the incoming DRG at offset 603 to our DRG at offset 607, the incoming MDC at 600 with ours at 610, the incoming RC at offset 598 with ours at 612.

Demo Linux version of DRGFilt...Passed
This free version only does F10. Validated it against our internal F10 dataset of 35,451 records.

Interactive Test Cases
We don't run the entire test dataset through our interactive UIs because it would be too much work for too little gain. Once we validate the core DAE, we validate the UIs with a sample of the official test dataset. This year that sample looks like this:

-------------------------------------------
   Age: 049
   Sex: F
  Disp: 01
   MDC: 21
   DRG: 908
  DX's:  Code :E:P where E=exempt flag P=present on admission flag
  DX01: 99679 : :
  DX02: 25041 : :
  DX03: 5859  : :
  DX04: 2767  : :
  DX05: 25051 : :
  DX06: 36904 : :
  DX07: 25061 : :
  DX08: 3371  : :
  DX09: 40290 : :
  DX10: 2859::

Proc's:  Code
  SG01: 3942  
  SG02: 3993  
  SG03: 3995
-------------------------------------------
   Age: 059
   Sex: M
  Disp: 01
   MDC: 01
   DRG: 074
  DX's:  Code :E:P where E=exempt flag P=present on admission flag
  DX01: 3564  : :
  DX02: 2639  : :
  DX03: 311   : :
  DX04: 2761  : :
  DX05: 5601  : :
  DX06: 5180::

Proc's:  Code
  SG01: 9383  
  SG02: 9339

-------------------------------------------
   Age: 050
   Sex: M
  Disp: 01
   MDC: 04
   DRG: 182
  DX's:  Code :E:P where E=exempt flag P=present on admission flag
  DX01: 1628::

Proc's:  Code
  SG01: 324   
  SG02: 3409  
  SG03: 8965  
  SG04: 9396

-------------------------------------------
   Age: 077
   Sex: F
  Disp: 03
   MDC: 08
   DRG: 563
  DX's:  Code :E:P where E=exempt flag P=present on admission flag
  DX01: 81611 : :
  DX02: 25081 : :
  DX03: 2512  : :
  DX04: E8849 : :
  DX05: 3319  : :
  DX06: 04110 : :
  DX07: 8831::

Proc's:  Code
  SG01: 7904  
  SG02: 9659  
  SG03: 8659

-------------------------------------------
   Age: 081
   Sex: F
  Disp: 01
   MDC: 02
   DRG: 117
  DX's:  Code :E:P where E=exempt flag P=present on admission flag
  DX01: 3659::

Proc's:  Code
  SG01: 1279




Linux C Shared Object for F29...Passed
Validated the Linux C shared object with this test case, to also confirm that the used codes bit flag handling is now correct:

-------------------------------------------
   Age: 055
   Sex: F
  Disp: 01
   MDC: 08
   DRG: 455
  DX's:  Code :E:P where E=exempt flag P=present on admission flag
  DX01: 71500 : :Y

Proc's:  Code
  SG01: 8134  
  SG02: 8135



Raw return value from mhdrg:
0^8^455^29^5.6449^0.00^ ^COMBINED ANTERIOR/POSTERIOR SPINAL FUSION W/O CC/MCC                  ^1^11

Deconstructed return value from mhdrg:
rc=0, mdc=8, drg=455, ovn=29, weight=5.6449, mean=0.00, porm=
desc=COMBINED ANTERIOR/POSTERIOR SPINAL FUSION W/O CC/MCC                 
dx flags:1, px flags: 11

Expected result: RC: 0 MDC: 08 DRG: 455

Significant ICD codes:
 * DX code  1 was used
 * Proc code  1 was used
 * Proc code  2 was used


Linux Perl Shared Object for F29...Passed

Validated the Perl shared object against the same test case as C shared object.

THIS YEAR, WE WILL HAVE TO CHANGE OUR PROCESS TO HANDLE THE 5.8 VS POST-5.8 DIVIDE, AS WELL AS MULT-THREADED VS NOT-MULTI-THREADED.


Linux PHP Shared Object for F29...Passed
Validated the Perl shared object against the same test case as C shared object.

Linux CGI-DRG for F29...Passed
Validated the Linux CGI-DRG against same test case as C shared object.


Wednesday, November 3, 2010

CGI Demo Version

QUESTION

I am interested in your product CGI-DRG (f24) for Windows, but your demo does not work. Can I get a trial version before buying?
Thanks.

ANSWER

We find that keeping a CGI script working on an ISP's host is a constant struggle. We should probably give up. We are happy to send you an F10 CGI-DRG for you to try; just remember to tell us whether you are running under Windows or Unix.