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

No comments:

Post a Comment