PK.CODESETLABS
@CODESETLABS.SETUP,
@CODESETLABS.NORMALCY,
@CODESETLABS.COMPLETED,
@CODESETLABS.TEARDOWN,
END;

CODESETLABS.SETUP
IF{/CONF[.labs.source]="lab" "regular labs",
  @labdir,
  O(:,@labdict),
  @pkdir,
  :SPARAM|5^LABNORMS.HI,
  :SPARAM|6^LABNORMS.LO,
  :SPARAM|7^LABNORMS.CRIT.HI,
  :SPARAM|8^LABNORMS.CRIT.LO,
  :SPARAM|12^LABNORMS.DELTA,
  :SPARAM|9^LABNORMS.ALPHA.HI,
  :SPARAM|21^LABNORMS.ALPHA.LO;
"if not regular labs, assume mock labs",
  "H"^LABNORMS.HI,
  "L"^LABNORMS.LO,
  "HC"^LABNORMS.CRIT.HI,
  "LC"^LABNORMS.CRIT.LO,
  "#"^LABNORMS.DELTA,
  "*"^LABNORMS.ALPHA.HI,
  "*"^LABNORMS.ALPHA.LO}

CODESETLABS.TEARDOWN
IF{/CONF[.labs.source]="lab" C(:S)}

CODESETLABS.NORMALCY
"<CodeSet>"^!,
"<CodeSetNumber>7</CodeSetNumber>"^!,
"<CodeSetName>NormalcyStatus</CodeSetName>"^!,
"<Codes>"^!,
"High"^disp,
  LABNORMS.HI^mnem,
  @CODESETLABS.NORMALCY.VALUE,
"Low"^disp,
  LABNORMS.LO^mnem,
  @CODESETLABS.NORMALCY.VALUE,
"High Critical"^disp,
  LABNORMS.CRIT.HI^mnem,
  @CODESETLABS.NORMALCY.VALUE,
"Low Critical"^disp,
  LABNORMS.CRIT.LO^mnem,
  @CODESETLABS.NORMALCY.VALUE,
"Delta Check"^disp,
  LABNORMS.DELTA^mnem,
  @CODESETLABS.NORMALCY.VALUE,
"Delta Check High"^disp,
  LABNORMS.DELTA_LABNORMS.HI^mnem,
  @CODESETLABS.NORMALCY.VALUE,
"Delta Check Low"^disp,
  LABNORMS.DELTA_LABNORMS.LO^mnem,
  @CODESETLABS.NORMALCY.VALUE,
"Delta Check High Critical"^disp,
  LABNORMS.DELTA_LABNORMS.CRIT.HI^mnem,
  @CODESETLABS.NORMALCY.VALUE,
"Delta Check Low Critical"^disp,
  LABNORMS.DELTA_LABNORMS.CRIT.LO^mnem,
  @CODESETLABS.NORMALCY.VALUE,
"Alpha Abnormal High"^disp,
  LABNORMS.ALPHA.HI^mnem,
  @CODESETLABS.NORMALCY.VALUE,
"Alpha Abnormal Low"^disp,
  LABNORMS.ALPHA.LO^mnem,
  @CODESETLABS.NORMALCY.VALUE,
"Normal"^disp,
  "NORMAL"^mnem,
  @CODESETLABS.NORMALCY.VALUE,
"</Codes>"^!,
"<Key/>"^!,
"</CodeSet>"^!

CODESETLABS.NORMALCY.VALUE
IF{/NORMALCY.LIST[mnem];
   1^/NORMALCY.LIST[mnem],
   ""^!,
   "<Display><![CDATA["_disp_"]]></Display>"^!,
   "<Mnemonic><![CDATA[NORMALCY."_mnem_"]]></Mnemonic>"^!,
   "<Meaning><![CDATA["_disp_"]]></Meaning>"^!,
   ""^!}

CODESETLABS.COMPLETED
"<CodeSet>"^!,
"<CodeSetNumber>8</CodeSetNumber>"^!,
"<CodeSetName>Completed Status</CodeSetName>"^!,
"<Codes>"^!,
""^!,
"<Display>Cancelled</Display>"^!,
"<Mnemonic>COMPLETED.CAN</Mnemonic>"^!,
"<Meaning>Cancelled</Meaning>"^!,
""^!,
""^!,
"<Display>Ordered</Display>"^!,
"<Mnemonic>COMPLETED.ORD</Mnemonic>"^!,
"<Meaning>Ordered</Meaning>"^!,
""^!,
""^!,
"<Display>Collection Batch</Display>"^!,
"<Mnemonic>COMPLETED.COLB</Mnemonic>"^!,
"<Meaning>Collection Batch</Meaning>"^!,
""^!,
""^!,
"<Display>Received</Display>"^!,
"<Mnemonic>COMPLETED.RECD</Mnemonic>"^!,
"<Meaning>Received</Meaning>"^!,
""^!,
""^!,
"<Display>Worksheet</Display>"^!,
"<Mnemonic>COMPLETED.WKST</Mnemonic>"^!,
"<Meaning>Worksheet</Meaning>"^!,
""^!,
""^!,
"<Display>Unverified</Display>"^!,
"<Mnemonic>COMPLETED.UNV</Mnemonic>"^!,
"<Meaning>Unverified</Meaning>"^!,
""^!,
""^!,
"<Display>Resulted</Display>"^!,
"<Mnemonic>COMPLETED.RES</Mnemonic>"^!,
"<Meaning>Resulted</Meaning>"^!,
""^!,
""^!,
"<Display>Completed</Display>"^!,
"<Mnemonic>COMPLETED.COMP</Mnemonic>"^!,
"<Meaning>Complete</Meaning>"^!,
""^!,
"</Codes>"^!,
"<Key/>"^!,
"</CodeSet>"^!
