Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Thursday, October 6, 2016

V34 32-bit PHP Version: Entry Point Now "mhdrg1_v34"

This applies ONLY to our 32 bit Linux PHP Module

In our 32 bit Linux environment there is apparently only one PHP name space for modules. Our ICD10-based DRG Assignment Engine (DAE) only handles one version while our ICD9-based version handled previous versions.

This means while our ICD9-based PHP module had a single entry point, mhdrg(), our ICD10-based PHP needs a unique entry point for every version. We had hoped to have a single entry point, mhdrg1(), but that won't work. So instead we will have an entry point named for the version starting with v34: mhdrg1_{ver}(). So the entry point for v34 PHP is mhdrg1_v34, like this:

<?php
    # tryit.php (c) 2002 M+H Consulting, LLC MH DRG test script

    printf("tryit.php (c) 2002-2016 M+H Consulting, LLC: MH DRG test script");
    $ver = "v34p";

    if (!extension_loaded('phpdrgv34')) {
    printf("<h1>ERROR</h1><p>phpdrgv34 is not loaded...</p>");
        /* exit; -- comment out because we want to see the error */
    }

    # call grouper, store results in $retval
    $retval = mhdrg1_v34(
        $ver,            # which DRG version you want
    "{wherever-you-keep them}",    # path to masks files
        "1",            # discharge status */
    "55",            # patient age on admission */
    "2",            # patient sex (1=male, 2=female) */
    # ICD DX codes */
    "D352   YE2740  NN390   YE871   NF05    NR630   NR110   YR0602  YD649    ",
    # ICD procedure codes */
    "0GB00ZZ0YUY47Z02HR30Z0L8S3ZZ0P5N0ZZ0RJP0ZZ",
    8,            # length of each ICD DX code */
    7,               # length of each ICD procedure code */
    "Y",            # are there POA indicators?
    "n"            # is this case exempt?
    );

    # if there was an error, alert the user
    if ($retval == '') {
    $error = errdesc();
        print("Error: $error<br>");
        exit;
    }

    # show the raw return value
    printf("Raw return value from mhdrg1_v34:<br>%s<br><br>",$retval);

    # deconstruct return from mhdrg1_v34()
    list($rc,$mdc,$drg,$ovn,$weight,$mean,$porm,$desc) = explode("^",$retval,-1);
    print("Deconstructed return value from mhdrg1_v34:<br>");
    print("rc=$rc, mdc=$mdc, drg=$drg, ovn=$ovn, weight=");
    print("$weight, mean=$mean, porm=$porm<br>desc=$desc<br>");
    print(" EXPECTED: RC: 0 MDC: 10 DRG: 614<br>");
    exit;
   
    ?>


In order to pass validation with the command-line PHP, we had to force the loading of v34 module, like this:

php5 -dextension=phpdrgv34.so -f tryit.php

Friday, October 30, 2015

Support for 32-bit Linux in V33

In the Windows world we ship 32-bit DLLs because we count on "thunking" to allow this code to run in either 64-bit or 32-bit environments. But we do plan on upgrading our Windows development environment to 64-bit in the next four years.

In the Linux world we planned to drop 32-bit support with v33 (Oct-2015) but found that too many people still run 32-bit Linux, so we added 32-bit versions to all of our programmer tools:

  • our PHP module (phpdrgv33_32bit.so)
  • our Perl module (perldrgv33_32bit.so)
  • our C-callable object (libdrgv33_32bit.so)
  • DRGFilt (drgfiltv33_32bit)
We named the 32-bit versions by adding "_32bit" to the end of the file name and therefore before the extension. If you buy any of these modules, you get both the 32-bit and 64-bit versions. If you are in a 32-bit environment, you can either rename the object or call the 32-bit version explicitly.

Tuesday, October 23, 2012

New 32 bit Linux Reference Platform (f30)

As part of fixing the v30 bug (see posts with "v30 bug" as a label) we were forced to change our 32 bit Linux reference platform. The previous platform was over a decade old, so we were probably due.

Our 32 bit Linux platform is now:

Linux 2.6.32-42-generic-pae #96-Ubuntu SMP Wed Aug 15 19:12:17 UTC 2012 i686 GNU/Linux

Under 32 bit Linux, our shared Perl object is now built against v5.10.1 and our shared PHP object is now built against 5.3.2-1ubuntu4.18.

Note that this means that we no longer support ancient glibc installations, but we suspect that there are precious few such installations left. However, if you are a customer of ours and you cannot run the new 32 bit Linux executable, we will be able to provide the old 32 bit Linux executables for the remainder of v30's reign--ie until October 1st, 2013.

Thursday, October 4, 2012

V30 Open Issues

10/4/12 11:03 AM Eastern
We have completed our V30 release with two open issues:
  1. Our 64 Bit Linux Perl Shared Object is still built against Perl v5.8.8, which is on the old side of the pre-5.10 divide. We can (and do) build against 5.10, but still in a developmental mode: we have yet to add the 5.10+ product to our catalogue. We haven't figured out what to call it: any suggestions?
  2. We have a similar issue with our 64 Bit Linux PHP Shared Object: we still build against a rather old PHP and need to have our developers create a production environment in which to build a newer object. We also need to update our catalogue to reflect this.
If you are looking to run the newer version of either of this products in the near future, please buy the  older version and send email to techsupport@drggroupers.com so we can send you the newer version by hand.

10/23/12 3:12PM Eastern
As part of our f30 bug fix, we changed our 32 bit Linux platform, which changed the PHP and Perl versions against which our 32 Linux shared objects are created:

32 bit Linux Perl version: v5.10.1
32 bit Linux PHP version: 5.3.2-1ubuntu4.18

So even if you are running 64 bit Linux, you might want our 32 bit Linux shared object, because most 64 Linux systems can run 32 bit versions of software and these versions are across important divides from our 64 bit versions.

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.


Thursday, January 24, 2008

PHP Shared Object

QUESTION

Hello,
We recently purchased the PHP shared object from you guys and are having problems getting it running. We are using PHP 5.2.5 on Red Hat Linux 9, and are getting the following error when we try to dynamically link your mhdrg.so library:

Warning: dl(): unable to load dynamic library './mhdrg.so' - mhdrg.so:
undefined symbol: zend_list_find

Any ideas? Let me know if you need more info or if I need to be addressing this question to RTR. Also, if we can't get this to work fairly easily, would we have the option of "trading" this PHP .so for your C callable object?


ANSWER

As I understand it, things are supposed to work like this:

 - you put mhdrg.so in a place in your file system that is both
   - readable by your web server
   - not accessible by the world or the world can steal it

 - you use the dl() primative in PHP to load the extension, like so:

    if (!extension_loaded('mhdrg')) {
        if (!dl('mhdrg.so')) {  // this should be in a protected directory
            exit;
        }
    }
When I deliberately move mhdrg.so on our test system, I get the following error:

Warning: Unable to load dynamic library './mhdrg.so' - ./mhdrg.so: cannot open shared object file: No such file or directory in /home/mnh/public_html/PHP/tryit.php on line 5

So I am guessing that wherever you have put mhdrg.so is not readable by the user your web server runs as. Have you put mhdrg.so in the same document directory as your document? If not, you could trying putting tryit.php and mhdrg.so in the same document directory and confirming that tryit.php works on your systems.

That said, we would be happy to exchange your PHP shared object for a C-callable object if that works better for you.

Thursday, September 26, 2002

We Love SWIG

As we look to make our DAE more easily integrated with other people's software, we came across SWIG and it is our new best friend: easy to use, effect and Open Source. We use it for all of our Linux-based embeddable products and we love it.

Now we can provide DAE access for Perl scripts, PHP pages and C programs such as SAS.