Skip to content

Releases: WorldVistA/VistA-DataLoader

[#1] Support Lab Panels (new version 3.1)

20 Feb 16:56
Compare
Choose a tag to compare

This PR adds support for lab panels.

Panels can be added via RPC like this:

parms['1']="PAT_SSN^" + ssn
parms['2']="LAB_PANEL^CHEM 7"
parms['3']="LAB_TEST^GLUCOSE^189"
parms['4']="LAB_TEST^CO2^34"
parms['5']="LAB_TEST^BUN^10"
parms['6']="LAB_TEST^CHLORIDE^100"
parms['7']="LAB_TEST^CREATININE^1.1"
parms['8']="LAB_TEST^POTASSIUM^4.7"
parms['9']="LAB_TEST^SODIUM^143"
parms['10']="RESULT_DT^NOW"
parms['11']="LOCATION^3E NORTH"
reply = connection.invokeRPC("ISI IMPORT LAB PANEL", [parms])

or via the M API like this:

 S INPUT("COLLECTION_SAMPLE")="SERUM" ; Optional
 S INPUT("LAB_PANEL")="BASIC METABOLIC PANEL"
 S INPUT("LAB_TEST","CALCIUM")=8.82
 S INPUT("LAB_TEST","CHLORIDE")=110.65
 S INPUT("LAB_TEST","CO2")=28.58
 S INPUT("LAB_TEST","CREATININE")=2.0732
 S INPUT("LAB_TEST","GLUCOSE")=100.35
 S INPUT("LAB_TEST","POTASSIUM")=4.61
 S INPUT("LAB_TEST","SODIUM")=140.69
 S INPUT("LAB_TEST","UREA NITROGEN")=9.16
 S INPUT("LOCATION")="GENERAL MEDICINE"
 S INPUT("PAT_SSN")=PATSSN
 S INPUT("RESULT_DT")=DATE
 N % S %=$$LAB^ISIIMP12(.RC,.INPUT)

A new test suite in ISIIMPLT has been created to function as a
regression suite for lab changes (not included in the KIDS build). As
with all VistA test suites, it needs some TLC in VistA config to get
everything working well.

ISIIMPLT results:

 ---------------------------------- ISIIMPLT ----------------------------------
FLAB - Full Lab RPC regression--------------------------------  [OK]   57.724ms
FLABNOSECE - Full Lab RPC regression (no seconds external)----  [OK]  889.070ms
LSSNE - SSN Error---------------------------------------------  [OK]    0.320ms
LTESTE - Lab Test various errors------------------------------  [OK]    0.564ms
RVE - Result Value errors-------------------------------------  [OK]    0.246ms
RDE - Result Date error---------------------------------------  [OK]    0.561ms
EEE - Entered by errors---------------------------------------  [OK]    0.234ms
LE - Location errors------------------------------------------  [OK]    0.240ms
PANELRPC1 - Load Partial Panel--------------------------------  [OK]   44.519ms
PANELRPC2 - Load Full Panel-----------------------------------  [OK]  973.253ms
LABDUP - Test lab duplicate-----------------------------------  [OK]  980.385ms
PANELDUP - Load panel duplicate-------------------------------  [OK] 1020.485ms
INVPANEL - Test that a non-existent panel throws an error-----  [OK]    0.366ms
PANELNOLAB - Test for valid labs but don't belong to a panel--  [OK]    0.393ms
PANELINVLAB - Test for invalid labs in a valid panel----------  [OK]    0.257ms
LABSYN - Test lab entered using its synonym files properly----  [OK]  978.512ms
LABNOCOLL - Test lab w/o config'd coll sample files properly--  [OK] 1007.019ms
CBCNOCOLL - CBC Panel (one item is missing a collection sample) [OK] 1009.415ms
CBCCOLL - CBC Panel with an explicit Collection Sample--------  [OK] 1007.193ms
MODALLAB - Test a Modal Lab-----------------------------------  [OK]  978.146ms
DECIMAL1 - Numeric lab with various proactive rounding--------  [OK] 1999.970ms
DECMIAL2 - Rounding SPECIFIC GRAVITY causes a crash-----------  [OK]  996.328ms
UA - Urine Analysis-------------------------------------------  [OK] 1037.583ms
UAP - Partial Urine Analysis----------------------------------  [OK] 2000.238ms
INVLVAL - Test Invalid atomic values--------------------------  [OK]    0.322ms
INVPVAL - Test Invalid panel values---------------------------  [OK]    0.492ms
INVMLAB - Test Invalid modal lab------------------------------  [OK]    0.614ms
INVTLAB - Invalid lab text value------------------------------  [OK]    0.612ms
LOINC - Lookup lab by LOINC-----------------------------------  [OK] 1961.789ms
PLASMA - Test Blood/Serum/Plasma Collection Sample------------  [OK] 2997.727ms
GLUURINE - Urine Glucose (to test a non-blood collection sample)[OK] 1001.888ms
SPUTUM - Sputum Sample----------------------------------------  [OK] 1002.110ms
CSF - Test CSF Sample-----------------------------------------  [OK]  999.400ms
TDAPIE1 - Test direct API individual lab no errors------------  [OK]  998.608ms
TDAPIE2 - Test direct API no errors---------------------------  [OK] 1021.338ms
TDAPIE3 - Test direct API Missing Panel Name------------------  [OK]    0.146ms
TDAPIE4 - Test direct API Missing SSN-------------------------  [OK]    0.128ms
TDAPISYN1 - Synthea BMP---------------------------------------  [OK] 1044.290ms
TDAPISYN2 - Synthea UA----------------------------------------  [OK]  971.547ms
TDAPISYN3 - Synthea Lipid Panel-------------------------------  [OK] 1977.068ms
TDAPISYN4 - Synthea CBC Panel---------------------------------  [OK] 1016.242ms
TLABSEQ - Two labs in order; lab package does timeshift-------  [OK] 1005.212ms
TBLOODGAS - Blood Gases---------------------------------------  [OK] 2012.049ms
TCARENZ - Cardiac Enzymes-------------------------------------  [OK]  959.654ms
TCRCL - Creatine Clearance------------------------------------  [OK]  993.931ms

Documentation has been updated.

Misc changes:

  • Various changes to suppress writing to the screen from lab code. Set
    DIQUIET before calling Fileman; or set DIC(0) to prevent echo when
    selecting a patient in ISIIMPL2. The clunky code to suppress writes
    by redirection to the NULL device has now been removed; it never
    really worked well due to the lab code switching devices when printing
    labels.
  • Lab results are now filed in time by seconds, not minutes. The
    original code seems to have previously done tha to match the behavior
    of the Vitals package; it's unnecessary, and restricts us from filing
    data when we have seconds in the same minute.
  • You can now specify the collection sample (optionally) for the lab.
    Previously, the code relied on the first collection sample defined in
    the lab file entry (#60); if it wasn't defined, we errored out; and in
    some cases, the first collection sample was something like "CSF",
    resulting in WBCs being filed with a CSF collection sample by default,
    which is incorrect. This gives us the ability to record collection
    samples granularly for tests that can be taken in multiple different
    samples (e.g. LDL can be in PLASMA or SERUM). Collection samples are
    not standaridized in VistA: We map SERUM to "GOLD TOP", PLASMA to
    "GREEN TOP" and BLOOD to "RED TOP". Others are looked up directly in
    File 62. You may need to ensure that you have the correct entries in
    File 62.
  • Synthea Data Importer (https://github.com/WorldVistA/VistA-FHIR-Data-Loader)
    would cause the code to go into an infinite loop when a lab was supplied with
    a number of decimal places that VistA isn't expecting. To fix that,
    all results are now validated in advance; and if anything needs to be
    rounded down, it is done. Also, the code that went into a loop was
    refactored to just crash instead (returning an error is not possible
    at that point due to how the Lab calls work).
  • The original code Error Trap was not coded well to unwind the error
    in the error trap. That's now done.
  • Fix the logic for the LOINC code lookup; but our lab advisor
    recommends against looking up VistA labs with LOINC codes as they
    have different models for labs.
  • If panel gets exploded into multiple tests at the accession stage,
    don't prompt for tests to edit.
  • Don't run delta checks that print to the screen
  • An old bug in the code: Check for absence of security keys LRLAB or
    LRVERIFY with an OR not an AND!
  • Add a new API $$PMEM^ISSIIMPU7 to check of lab is member of a panel
  • Suppress asking for required comments from the API