Date/time conversion: Using the fuzzy date/time parser

Non-conformant Lab Result Message

I can’t say where this comes from. Save to say that it’s from a big laboratory vendor.

This is nothing unusual in healthcare. The least conformant interfaces are the ones from the biggest most dominant vendors in the industry. Often they are stuck on ancient systems that were written long before even HL7 existed.

Notice the mix of date time formats. The date formats are somewhat ambiguous. See the DD-MMM-YY date format? Not terribly good for the turn of century. Ah well this is the reality of the systems we have to interface with in healthcare. I’ve attached a vmd and some Lua code that works with this.

I used the fuzzy date/time parser.

A^70^20090402^06:51^00012^00280^00150^
B^PD81020^70CM210317^20090121^RACHELLE^SMITH^F^^19830106^F^1322740^DR. M. F. WEATHERHEAD,^2494 DANFORTH AVE^TORONTO,ONT, ONTARIO^M4C 1K9^^1475^^^416-726-4505^416-698-3898^21-JAN-09^
C^CYTOLOGY^^^CLINICAL DATA^A^^^^^70^Y^
D^CYTOLOGY^^                                      ^  ^ ^
C^CYTOLOGY^^^DATE OF L.M.P.^A^^^^NONE GIVEN^70^N^
C^CYTOLOGY^^^^^^^^^^Y^
D^CYTOLOGY^^                           NO OTHER DATA GIVEN^70^ ^
D^CYTOLOGY^^                                                                  ^  ^ ^
D^CYTOLOGY^^                           ****************************************^  ^ ^
D^CYTOLOGY^^                                                                  ^  ^ ^
C^CYTOLOGY^^^PAP SMEAR^N^^^^^70^Y^
D^CYTOLOGY^^                           SATISFACTORY FOR EVALUATION.^  ^ ^
D^CYTOLOGY^^                           TRANSFORMATION ZONE COMPONENT: ABSENT^  ^ ^
D^CYTOLOGY^^                           NEGATIVE FOR INTRAEPITHELIAL LESION OR ^  ^ ^
D^CYTOLOGY^^                           MALIGNANCY.^  ^ ^
D^CYTOLOGY^^                           SHIFT IN FLORA CONSISTENT WITH BACTERIAL^  ^ ^
D^CYTOLOGY^^                           VAGINOSIS.^  ^ ^
D^CYTOLOGY^^                             ^  ^ ^
C^CYTOLOGY^^^^^^^^^^Y^
D^CYTOLOGY^^                                                                  ^70^ ^
D^CYTOLOGY^^                           ****************************************^  ^ ^
D^CYTOLOGY^^                                                                  ^  ^ ^
C^CYTOLOGY^^^CYTOTECHNOLOGIST^N^^^^FH^70^Y^
D^CYTOLOGY^^                             ^  ^ ^
B^PD84151^^20090401^DAVID^CHUA^M^6586893619LL^19331001^P^1322740^DR. M. F. WEATHERHEAD,^2494 DANFORTH AVE^TORONTO,ONT, ONTARIO^M4C 1K9^^1475^^^416-449-1916^416-698-3898^01-APR-09^
C^HEMATOLOGY^^^HEMOGLOBIN^A^135^180^G/L^82^70^N^
C^HEMATOLOGY^^^HEMATOCRIT^A^0.37^0.54^L/L^0.279^70^N^
C^HEMATOLOGY^^^WBC COUNT^A^4.0^11.0^X10 9/L^12.3^70^N^
C^HEMATOLOGY^^^RBC COUNT^A^4.50^6.50^X10 12/L^4.33^70^N^
C^HEMATOLOGY^^^MCV^A^80^97^FL^64.5^70^N^
C^HEMATOLOGY^^^MCH^A^27.0^32.0^PG^18.9^70^N^
C^HEMATOLOGY^^^MCHC^A^320^360^G/L^293^70^N^
C^HEMATOLOGY^^^RDW^A^11.0^14.5^%^20.9^70^N^
C^HEMATOLOGY^^^PLATELET COUNT^N^150^400^X10 9/L^311^70^N^
C^HEMATOLOGY^^^ABSOLUTE:  NEUTROS^A^2.0^7.5^X10 9/L^8.1^70^N^
C^HEMATOLOGY^^^(A)   LYMPH^N^1.1^3.3^X10 9/L^2.7^70^N^
C^HEMATOLOGY^^^(A)   MONO^A^0.0^0.8^X10 9/L^1.2^70^N^
C^HEMATOLOGY^^^(A)   EOS^N^0.0^0.5^X10 9/L^0.2^70^N^
C^HEMATOLOGY^^^(A)   BASO^N^0.0^0.2^X10 9/L^0.1^70^N^
C^HEMATOLOGY^^^HYPOCHROMIA^A^^^^1+^70^N^
C^HEMATOLOGY^^^MICROCYTOSIS^A^^^^3+^70^N^
C^HEMATOLOGY^^^OVALOCYTES^A^^^^1+^70^N^
C^HEMATOLOGY^^^POLYCHROMASIA^A^^^^SL INCREASED^70^N^
C^HEMATOLOGY^^^TARGET CELLS^N^^^^FEW^70^N^
C^HEMATOLOGY^^^PLATELETS^N^^^^NORMAL^70^N^
C^CHEMISTRY^^^GLUCOSE FASTING-SER^A^3.3^6.0^MMOL/L^6.6^70^N^
C^CHEMISTRY^^^CREATININE^N^60^127^UMOL/L^82^70^N^
C^CHEMISTRY^^^eGFR^N^^^^79^70^Y^
D^CHEMISTRY^^                                ****          ****          ****^  ^ ^
D^CHEMISTRY^^                           For patients of African descent, the reported^  ^ ^
D^CHEMISTRY^^                           eGFR must be multiplied by a correction^  ^ ^
D^CHEMISTRY^^                           factor of 1.21.^  ^ ^
D^CHEMISTRY^^                                ****          ****          ****^  ^ ^
C^CHEMISTRY^^^SODIUM^N^135^146^MMOL/L^141^70^N^
C^CHEMISTRY^^^POTASSIUM^N^3.5^5.2^MMOL/L^4.1^70^N^
C^CHEMISTRY^^^CHLORIDE^N^95^108^MMOL/L^105^70^N^
C^CHEMISTRY^^^CHOLESTEROL^N^TARGET <5.20^TARGET <5.20^MMOL/L^3.40^70^N^
C^CHEMISTRY^^^TRIGLYCERIDES^N^TARGET <1.71^TARGET <1.71^MMOL/L^0.87^70^N^
C^CHEMISTRY^^^HDL CHOLESTEROL^A^TARGET >1.29^TARGET >1.29^MMOL/L^0.85^70^N^
C^CHEMISTRY^^^LDL CHOLESTEROL^N^See Targets^See Targets^MMOL/L^2.15^70^N^
C^CHEMISTRY^^^CHOL/HDL RATIO^A^See Targets^See Targets^^4.00^70^Y^
D^CHEMISTRY^^                           *----------*----------*----------*----------*^  ^ ^
D^CHEMISTRY^^                           Clinical Risk Status:  Target Lipid Levels^  ^ ^
D^CHEMISTRY^^                           *----------*----------*----------*----------*^  ^ ^
D^CHEMISTRY^^                            If Risk  : LDL-C --Targets-- CHOL/HDL Ratio^  ^ ^
D^CHEMISTRY^^                            Low      :  <5.1     and       <6.0^  ^ ^
D^CHEMISTRY^^                            Moderate :  <3.5     and       <5.0^  ^ ^
D^CHEMISTRY^^                            High     :  <2.0     and       <4.0^  ^ ^
D^CHEMISTRY^^                           ...as per 2006 Canadian Guidelines^  ^ ^
C^URINALYSIS^ROUTINE:^^APPEARANCE^N^^^^CLOUDY^70^N^
C^URINALYSIS^ROUTINE:^^COLOUR^N^^^^YELLOW^70^N^
C^URINALYSIS^ROUTINE:^^PH^N^5.0^9.0^^6.0^70^N^
C^URINALYSIS^ROUTINE:^^PROTEIN^N^NEGATIVE^NEGATIVE^G/L^NEGATIVE^70^N^
C^URINALYSIS^ROUTINE:^^GLUCOSE^N^NEGATIVE^NEGATIVE^MMOL/L^NEGATIVE^70^N^
C^URINALYSIS^ROUTINE:^^KETONE^A^NEGATIVE^NEGATIVE^MMOL/L^1.5^70^N^
C^URINALYSIS^ROUTINE:^^BLOOD^N^NEGATIVE^NEGATIVE^^NEGATIVE^70^N^
C^URINALYSIS^ROUTINE:^^NITRITE^N^NEGATIVE^NEGATIVE^^NEGATIVE^70^N^
C^URINALYSIS^ROUTINE:^^LEUKOCYTE ESTERASE^N^NEGATIVE^NEGATIVE^^NEGATIVE^70^N^
C^URINALYSIS^ROUTINE:^^SPECIFIC GRAVITY^N^^^^1.024^70^N^
B^PD84155^^20090401^SANDRA^BLOG^F^2331943635NB^19770119^F^1322740^DR. M. F. WEATHERHEAD,^2494 DANFORTH AVE^TORONTO,ONT, ONTARIO^M4C 1K9^^1475^^^416-694-9364^416-698-3898^01-APR-09^
C^HEMATOLOGY^^^HEMOGLOBIN^N^115^165^G/L^143^70^N^
C^HEMATOLOGY^^^HEMATOCRIT^N^0.37^0.47^L/L^0.422^70^N^
C^HEMATOLOGY^^^WBC COUNT^N^4.0^11.0^X10 9/L^8.5^70^N^
C^HEMATOLOGY^^^RBC COUNT^N^3.80^5.80^X10 12/L^4.52^70^N^
C^HEMATOLOGY^^^MCV^N^80^97^FL^93.3^70^N^
C^HEMATOLOGY^^^MCH^N^27.0^32.0^PG^31.7^70^N^
C^HEMATOLOGY^^^MCHC^N^320^360^G/L^340^70^N^
C^HEMATOLOGY^^^RDW^N^11.0^14.5^%^14.0^70^N^
C^HEMATOLOGY^^^PLATELET COUNT^N^150^400^X10 9/L^347^70^N^
C^HEMATOLOGY^^^ABSOLUTE:  NEUTROS^N^2.0^7.5^X10 9/L^6.2^70^N^
C^HEMATOLOGY^^^(A)   LYMPH^N^1.1^3.3^X10 9/L^1.9^70^N^
C^HEMATOLOGY^^^(A)   MONO^N^0.0^0.8^X10 9/L^0.3^70^N^
C^HEMATOLOGY^^^(A)   EOS^N^0.0^0.5^X10 9/L^0.1^70^N^
C^HEMATOLOGY^^^(A)   BASO^N^0.0^0.2^X10 9/L^0.0^70^N^
C^CHEMISTRY^^^GLUCOSE RANDOM^N^3.3^7.8^MMOL/L^4.9^70^N^
C^RIA^^^TSH^N^0.30^4.70^MU/L^0.77^70^N^
B^ST34976^^20090401^PAUL^TOSH^M^1940403759VX^19530319^F^1322740^DR. M. F. WEATHERHEAD,^2494 DANFORTH AVE^TORONTO,ONT, ONTARIO^M4C 1K9^^1475^^^416-925-7686^416-698-3898^01-APR-09^
C^HEMATOLOGY^COAGULATION^^I.N.R.^A^0.8^1.2^^2.8^70^Y^
D^HEMATOLOGY^COAGULATION^                                                     ^  ^ ^
D^HEMATOLOGY^COAGULATION^                                 RECOMMENDED I.N.R. RANGE^  ^ ^
D^HEMATOLOGY^COAGULATION^                           ------------------------------------^  ^ ^
D^HEMATOLOGY^COAGULATION^                           THROMBOEMBOLISM RISK       2.0 - 3.0^  ^ ^
D^HEMATOLOGY^COAGULATION^                           PROSTHETIC HEART VALVE     2.5 - 3.5^  ^ ^
D^HEMATOLOGY^COAGULATION^                                                  ^  ^ ^
B^AT03584^^20090401^JENNIE^MUIRWOOD^F^1976006344RC^19300724^P^2719080^DR. DANIEL H. ARNAUDON^322 SILVERTHORN AVE^TORONTO, ONTARIO^M6N 3K6^^1475^2719080^^416-622-5183^416-656-8777^01-APR-09^
C^HEMATOLOGY^^^HEMOGLOBIN^N^115^165^G/L^128^70^N^
C^HEMATOLOGY^^^HEMATOCRIT^N^0.37^0.47^L/L^0.383^70^N^
C^HEMATOLOGY^^^WBC COUNT^N^4.0^11.0^X10 9/L^9.4^70^N^
C^HEMATOLOGY^^^RBC COUNT^N^3.80^5.80^X10 12/L^4.16^70^N^
C^HEMATOLOGY^^^MCV^N^80^97^FL^92.2^70^N^
C^HEMATOLOGY^^^MCH^N^27.0^32.0^PG^30.7^70^N^
C^HEMATOLOGY^^^MCHC^N^320^360^G/L^333^70^N^
C^HEMATOLOGY^^^RDW^N^11.0^14.5^%^14.1^70^N^
C^HEMATOLOGY^^^PLATELET COUNT^N^150^400^X10 9/L^359^70^N^
C^HEMATOLOGY^^^ABSOLUTE:  NEUTROS^N^2.0^7.5^X10 9/L^4.9^70^N^
C^HEMATOLOGY^^^(A)   LYMPH^N^1.1^3.3^X10 9/L^3.3^70^N^
C^HEMATOLOGY^^^(A)   MONO^A^0.0^0.8^X10 9/L^0.9^70^N^
C^HEMATOLOGY^^^(A)   EOS^N^0.0^0.5^X10 9/L^0.3^70^N^
C^HEMATOLOGY^^^(A)   BASO^N^0.0^0.2^X10 9/L^0.0^70^N^
C^CHEMISTRY^^^MAGNESIUM-SERUM^N^0.65^1.05^MMOL/L^0.97^70^N^
C^CHEMISTRY^^^CREATININE^A^60^115^UMOL/L^153^70^N^
C^CHEMISTRY^^^eGFR^A^^^^28^70^Y^
D^CHEMISTRY^^                                ****          ****          ****^  ^ ^
D^CHEMISTRY^^                           For patients of African descent, the reported^  ^ ^
D^CHEMISTRY^^                           eGFR must be multiplied by a correction^  ^ ^
D^CHEMISTRY^^                           factor of 1.21.^  ^ ^
D^CHEMISTRY^^                                ****          ****          ****^  ^ ^
D^CHEMISTRY^^                           eGFR = 15-29 mL/min/1.73 sq.m^  ^ ^
D^CHEMISTRY^^                           Consistent with severe chronic kidney disease^  ^ ^
D^CHEMISTRY^^                                ****          ****          ****^  ^ ^
C^CHEMISTRY^^^URATE^A^120^400^UMOL/L^516^70^N^
C^CHEMISTRY^^^SODIUM^N^135^146^MMOL/L^136^70^N^
C^CHEMISTRY^^^POTASSIUM^N^3.5^5.2^MMOL/L^4.0^70^N^
C^CHEMISTRY^^^CHLORIDE^N^95^108^MMOL/L^100^70^N^
C^CHEMISTRY^^^BICARBONATE(CO2)^N^21.0^28.0^MMOL/L^23.0^70^N^
C^CHEMISTRY^^^ALBUMIN^N^33.0^46.0^G/L^39.6^70^N^
C^CHEMISTRY^^^CALCIUM^N^2.15^2.60^MMOL/L^2.33^70^N^
C^CHEMISTRY^^^PHOSPHATE^A^0.90^1.52^MMOL/L^1.57^70^N^
C^RIA^^^TSH^N^0.30^4.70^MU/L^1.11^70^N^
C^RIA^^^FERRITIN^N^13^145^UG/L^25^70^N^
C^^^^^^^^^^^Y^
D^^^Original to DR. A. BERBECE^^ ^
B^AT03599^^20090401^MARY ANNE^KARMA^F^1561061951JF^19530120^P^2719080^DR. DANIEL H. ARNAUDON^322 SILVERTHORN AVE^TORONTO, ONTARIO^M6N 3K6^^1475^^^416-241-0315^416-656-8777^01-APR-09^
C^HEMATOLOGY^^^HEMOGLOBIN^N^115^165^G/L^127^70^N^
C^HEMATOLOGY^^^HEMATOCRIT^N^0.37^0.47^L/L^0.380^70^N^
C^HEMATOLOGY^^^WBC COUNT^N^4.0^11.0^X10 9/L^5.7^70^N^
C^HEMATOLOGY^^^RBC COUNT^N^3.80^5.80^X10 12/L^3.83^70^N^
C^HEMATOLOGY^^^MCV^A^80^97^FL^99.3^70^N^
C^HEMATOLOGY^^^MCH^A^27.0^32.0^PG^33.2^70^N^
C^HEMATOLOGY^^^MCHC^N^320^360^G/L^335^70^N^
C^HEMATOLOGY^^^RDW^N^11.0^14.5^%^13.6^70^N^
C^HEMATOLOGY^^^PLATELET COUNT^N^150^400^X10 9/L^223^70^N^
C^HEMATOLOGY^^^ABSOLUTE:  NEUTROS^N^2.0^7.5^X10 9/L^2.7^70^N^
C^HEMATOLOGY^^^(A)   LYMPH^N^1.1^3.3^X10 9/L^2.3^70^N^
C^HEMATOLOGY^^^(A)   MONO^N^0.0^0.8^X10 9/L^0.5^70^N^
C^HEMATOLOGY^^^(A)   EOS^N^0.0^0.5^X10 9/L^0.1^70^N^
C^HEMATOLOGY^^^(A)   BASO^N^0.0^0.2^X10 9/L^0.0^70^N^
C^CHEMISTRY^^^CREATININE^N^60^115^UMOL/L^68^70^N^
C^CHEMISTRY^^^eGFR^N^^^^77^70^Y^
D^CHEMISTRY^^                                ****          ****          ****^  ^ ^
D^CHEMISTRY^^                           For patients of African descent, the reported^  ^ ^
D^CHEMISTRY^^                           eGFR must be multiplied by a correction^  ^ ^
D^CHEMISTRY^^                           factor of 1.21.^  ^ ^
D^CHEMISTRY^^                                ****          ****          ****^  ^ ^
C^CHEMISTRY^^^URATE^N^120^400^UMOL/L^378^70^N^
C^CHEMISTRY^^^SODIUM^N^135^146^MMOL/L^139^70^N^
C^CHEMISTRY^^^POTASSIUM^N^3.5^5.2^MMOL/L^3.8^70^N^
C^CHEMISTRY^^^CHLORIDE^N^95^108^MMOL/L^101^70^N^
C^URINALYSIS^ROUTINE:^^APPEARANCE^N^^^^CLEAR^70^N^
C^URINALYSIS^ROUTINE:^^COLOUR^N^^^^YELLOW^70^N^
C^URINALYSIS^ROUTINE:^^PH^N^5.0^9.0^^6.0^70^N^
C^URINALYSIS^ROUTINE:^^PROTEIN^N^NEGATIVE^NEGATIVE^G/L^NEGATIVE^70^N^
C^URINALYSIS^ROUTINE:^^GLUCOSE^N^NEGATIVE^NEGATIVE^MMOL/L^NEGATIVE^70^N^
C^URINALYSIS^ROUTINE:^^KETONE^N^NEGATIVE^NEGATIVE^MMOL/L^NEGATIVE^70^N^
C^URINALYSIS^ROUTINE:^^BLOOD^N^NEGATIVE^NEGATIVE^^NEGATIVE^70^N^
C^URINALYSIS^ROUTINE:^^NITRITE^N^NEGATIVE^NEGATIVE^^NEGATIVE^70^N^
C^URINALYSIS^ROUTINE:^^LEUKOCYTE ESTERASE^N^NEGATIVE^NEGATIVE^^NEGATIVE^70^N^
C^URINALYSIS^ROUTINE:^^SPECIFIC GRAVITY^N^^^^1.005^70^N^
B^SX69857^^20090401^JOY^COW^F^4442522555BP^19590805^F^0696170^DR. JEFFREY M. BROWN^SUITE 214^7330 YONGE STREET^THORNHILL, ONTARIO           L4J 1V8^^1475^^^416-285-0903^905-771-7771^01-APR-09^
C^HEMATOLOGY^^^HEMOGLOBIN^N^115^165^G/L^122^70^N^
C^HEMATOLOGY^^^HEMATOCRIT^A^0.37^0.47^L/L^0.369^70^N^
C^HEMATOLOGY^^^WBC COUNT^N^4.0^11.0^X10 9/L^5.4^70^N^
C^HEMATOLOGY^^^RBC COUNT^N^3.80^5.80^X10 12/L^4.06^70^N^
C^HEMATOLOGY^^^MCV^N^80^97^FL^90.9^70^N^
C^HEMATOLOGY^^^MCH^N^27.0^32.0^PG^30.0^70^N^
C^HEMATOLOGY^^^MCHC^N^320^360^G/L^331^70^N^
C^HEMATOLOGY^^^RDW^N^11.0^14.5^%^14.3^70^N^
C^HEMATOLOGY^^^PLATELET COUNT^N^150^400^X10 9/L^266^70^N^
C^HEMATOLOGY^^^ABSOLUTE:  NEUTROS^N^2.0^7.5^X10 9/L^2.0^70^N^
C^HEMATOLOGY^^^(A)   LYMPH^N^1.1^3.3^X10 9/L^2.8^70^N^
C^HEMATOLOGY^^^(A)   MONO^N^0.0^0.8^X10 9/L^0.4^70^N^
C^HEMATOLOGY^^^(A)   EOS^N^0.0^0.5^X10 9/L^0.1^70^N^
C^HEMATOLOGY^^^(A)   BASO^N^0.0^0.2^X10 9/L^0.0^70^N^
C^CHEMISTRY^^^GLUCOSE FASTING-SER^N^3.3^6.0^MMOL/L^5.3^70^N^
C^CHEMISTRY^^^POTASSIUM^N^3.5^5.2^MMOL/L^4.1^70^N^
B^XK64610^^20090328^GEORGIA^MULRANEY^F^9770677731^19800710^F^0696170^DR. JEFFREY M. BROWN^SUITE 214^7330 YONGE STREET^THORNHILL, ONTARIO           L4J 1V8^^1475^^^416-859-8978^905-771-7771^28-MAR-09^
C^RIA^^^TSH^N^0.30^4.70^MU/L^2.42^70^N^
C^RIA^^^T4 FREE^N^9.1^23.8^PMOL/L^15.3^70^N^
C^RIA^^^FREE T3^N^2.5^5.7^PMOL/L^3.7^70^N^
C^RIA^^^CORTISOL AM-SERUM^N^101^536^NMOL/L^349^70^N^
C^RIA^^^FREE TESTOSTERONE^N^< 9.0^< 9.0^PMOL/L^4.3^70^N^
C^RIA^^^ESTRADIOL^N^^^PMOL/L^210^70^Y^
D^RIA^^                                                ESTRADIOL (REFERENCE RANGE) PMOL/L^  ^ ^
D^RIA^^                                                ----------------------------------------^  ^ ^
D^RIA^^                                                FOLLICULAR :                  0 -  921^  ^ ^
D^RIA^^                                                MID-CYCLE  :                139 - 2382^  ^ ^
D^RIA^^                                                LUTEAL     :                  0 - 1145^  ^ ^
D^RIA^^                                                POSTMENOPAUSAL(NOT ON HRT) :  0 -  103^  ^ ^
D^RIA^^                                                POSTMENOPAUSAL( ON HRT )   :  0 -  528^  ^ ^
D^RIA^^                                                ----------------------------------------^  ^ ^
C^RIA^^^PROGESTERONE^N^^^NMOL/L^12^70^Y^
D^RIA^^                                                PROGESTERONE REF.RANGE NMOL/L^  ^ ^
D^RIA^^                                                -----------------------------^  ^ ^
D^RIA^^                                                FEMALE:                      ^  ^ ^
D^RIA^^                                                  FOLLICULAR:          0 - 4^  ^ ^
D^RIA^^                                                  LUTEAL:              4 - 51  ^  ^ ^
D^RIA^^                                                NOTE: VALUES GREATER THAN 16^  ^ ^
D^RIA^^                                                      ARE STRONGLY SUGGESTIVE^  ^ ^
D^RIA^^                                                      OF AN OVULATORY CYCLE.^  ^ ^
C^RIA^^^DHEA SULPHATE^A^^^UMOL/L^*    4.4 *^70^Y^
D^RIA^^                                    * REVIEW *^  ^ ^
D^RIA^^                                    * RESULT *^  ^ ^
D^RIA^^                                DHEA-S REFERENCE RANGE   (UMOL/L)  ^  ^ ^
D^RIA^^                                =================================^  ^ ^
D^RIA^^                                AGE (YEARS)    FEMALE      MALE^  ^ ^
D^RIA^^                                ---------------------------------^  ^ ^
D^RIA^^                                NEWBORN      4.5-10.0    4.5-10.0^  ^ ^
D^RIA^^                                  1-12         < 5.0      < 5.0^  ^ ^
D^RIA^^                                 13-29         <11.0      <11.0^  ^ ^
D^RIA^^                                 30-39         < 7.3      <14.0^  ^ ^
D^RIA^^                                 40-49         < 6.5      <14.1^  ^ ^
D^RIA^^                                 50-59         < 5.4      < 8.4^  ^ ^
D^RIA^^                                 60-69         < 3.5      < 7.9^  ^ ^
D^RIA^^                                 70-79         < 2.4      < 4.7^  ^ ^
D^RIA^^                                  ^  ^ ^
D^RIA^^                                  ^  ^ ^
D^RIA^^                                  ^  ^ ^
D^RIA^^                                  ^  ^ ^
B^XM60723^^20090401^LOULA^BIGGS^F^2525710386JV^19540824^F^0696170^DR. JEFFREY M. BROWN^SUITE 214^7330 YONGE STREET^THORNHILL, ONTARIO           L4J 1V8^^1475^^^416-528-2259^905-771-7771^01-APR-09^
C^HEMATOLOGY^^^HEMOGLOBIN^N^115^165^G/L^127^70^N^
C^HEMATOLOGY^^^HEMATOCRIT^N^0.37^0.47^L/L^0.378^70^N^
C^HEMATOLOGY^^^WBC COUNT^N^4.0^11.0^X10 9/L^6.2^70^N^
C^HEMATOLOGY^^^RBC COUNT^N^3.80^5.80^X10 12/L^4.38^70^N^
C^HEMATOLOGY^^^MCV^N^80^97^FL^86.2^70^N^
C^HEMATOLOGY^^^MCH^N^27.0^32.0^PG^29.1^70^N^
C^HEMATOLOGY^^^MCHC^N^320^360^G/L^337^70^N^
C^HEMATOLOGY^^^RDW^N^11.0^14.5^%^13.6^70^N^
C^HEMATOLOGY^^^PLATELET COUNT^N^150^400^X10 9/L^214^70^N^
C^HEMATOLOGY^^^ABSOLUTE:  NEUTROS^N^2.0^7.5^X10 9/L^3.8^70^N^
C^HEMATOLOGY^^^(A)   LYMPH^N^1.1^3.3^X10 9/L^1.7^70^N^
C^HEMATOLOGY^^^(A)   MONO^N^0.0^0.8^X10 9/L^0.4^70^N^
C^HEMATOLOGY^^^(A)   EOS^N^0.0^0.5^X10 9/L^0.3^70^N^
C^HEMATOLOGY^^^(A)   BASO^N^0.0^0.2^X10 9/L^0.0^70^N^
C^HEMATOLOGY^^^hs-CRP^A^^^MG/L^17.6^70^Y^
D^HEMATOLOGY^^                           CUT POINTS FOR CARDIAC RISK ASSESSMENT ARE:^  ^ ^
D^HEMATOLOGY^^                           LOW RISK LEVEL      <1.0 MG/L^  ^ ^
D^HEMATOLOGY^^                           AVERAGE RISK LEVEL  1.0 - 3.0 MG/L^  ^ ^
D^HEMATOLOGY^^                           HIGH RISK LEVEL     >3.0 MG/L^  ^ ^
D^HEMATOLOGY^^                           VALUES >8.0 MG/L INDICATE INFLAMMATORY^  ^ ^
D^HEMATOLOGY^^                           CONDITIONS AND MAY NOT PREDICT CARDIAC RISK^  ^ ^
D^HEMATOLOGY^^                           .^  ^ ^
C^CHEMISTRY^^^GLUCOSE FASTING-SER^N^3.3^6.0^MMOL/L^5.6^70^N^
C^CHEMISTRY^^^CREATININE^N^60^115^UMOL/L^60^70^N^
C^CHEMISTRY^^^eGFR^N^^^^90^70^Y^
D^CHEMISTRY^^                                ****          ****          ****^  ^ ^
D^CHEMISTRY^^                           For patients of African descent, the reported^  ^ ^
D^CHEMISTRY^^                           eGFR must be multiplied by a correction^  ^ ^
D^CHEMISTRY^^                           factor of 1.21.^  ^ ^
D^CHEMISTRY^^                                ****          ****          ****^  ^ ^
C^CHEMISTRY^^^URATE^N^120^400^UMOL/L^301^70^N^
C^CHEMISTRY^^^SODIUM^N^135^146^MMOL/L^145^70^N^
C^CHEMISTRY^^^POTASSIUM^N^3.5^5.2^MMOL/L^3.9^70^N^
C^CHEMISTRY^^^CHLORIDE^N^95^108^MMOL/L^108^70^N^
C^CHEMISTRY^^^TOTAL BILIRUBIN^N^0.0^23.0^UMOL/L^10.0^70^N^
C^CHEMISTRY^^^ALK PHOS^N^30^110^U/L^92^70^N^
C^CHEMISTRY^^^AST^N^6^42^U/L^16^70^N^
C^CHEMISTRY^^^CHOLESTEROL^N^TARGET <5.20^TARGET <5.20^MMOL/L^3.81^70^N^
C^CHEMISTRY^^^TRIGLYCERIDES^N^TARGET <1.71^TARGET <1.71^MMOL/L^1.57^70^N^
C^CHEMISTRY^^^HDL CHOLESTEROL^A^TARGET >1.29^TARGET >1.29^MMOL/L^1.00^70^N^
C^CHEMISTRY^^^LDL CHOLESTEROL^N^See Targets^See Targets^MMOL/L^2.10^70^N^
C^CHEMISTRY^^^CHOL/HDL RATIO^N^See Targets^See Targets^^3.81^70^Y^
D^CHEMISTRY^^                           *----------*----------*----------*----------*^  ^ ^
D^CHEMISTRY^^                           Clinical Risk Status:  Target Lipid Levels^  ^ ^
D^CHEMISTRY^^                           *----------*----------*----------*----------*^  ^ ^
D^CHEMISTRY^^                            If Risk  : LDL-C --Targets-- CHOL/HDL Ratio^  ^ ^
D^CHEMISTRY^^                            Low      :  <5.1     and       <6.0^  ^ ^
D^CHEMISTRY^^                            Moderate :  <3.5     and       <5.0^  ^ ^
D^CHEMISTRY^^                            High     :  <2.0     and       <4.0^  ^ ^
D^CHEMISTRY^^                           ...as per 2006 Canadian Guidelines^  ^ ^
C^RIA^^^TSH^N^0.30^4.70^MU/L^0.88^70^N^
C^RIA^^^T4 FREE^N^9.1^23.8^PMOL/L^15.7^70^N^
C^RIA^^^FREE T3^N^2.5^5.7^PMOL/L^4.5^70^N^
B^XS97153^^20090401^LINDA^HOW^F^7552086352RP^19680423^P^0696170^DR. JEFFREY M. BROWN^SUITE 214^7330 YONGE STREET^THORNHILL, ONTARIO           L4J 1V8^^1475^^^416-269-5484^905-771-7771^01-APR-09^
C^HEMATOLOGY^^^HEMOGLOBIN^N^115^165^G/L^136^70^N^
C^HEMATOLOGY^^^HEMATOCRIT^N^0.37^0.47^L/L^0.408^70^N^
C^HEMATOLOGY^^^WBC COUNT^N^4.0^11.0^X10 9/L^10.4^70^N^
C^HEMATOLOGY^^^RBC COUNT^N^3.80^5.80^X10 12/L^4.13^70^N^
C^HEMATOLOGY^^^MCV^A^80^97^FL^98.6^70^N^
C^HEMATOLOGY^^^MCH^A^27.0^32.0^PG^32.9^70^N^
C^HEMATOLOGY^^^MCHC^N^320^360^G/L^334^70^N^
C^HEMATOLOGY^^^RDW^N^11.0^14.5^%^13.3^70^N^
C^HEMATOLOGY^^^PLATELET COUNT^N^150^400^X10 9/L^235^70^N^
C^HEMATOLOGY^^^ABSOLUTE:  NEUTROS^N^2.0^7.5^X10 9/L^6.8^70^N^
C^HEMATOLOGY^^^(A)   LYMPH^N^1.1^3.3^X10 9/L^2.5^70^N^
C^HEMATOLOGY^^^(A)   MONO^N^0.0^0.8^X10 9/L^0.8^70^N^
C^HEMATOLOGY^^^(A)   EOS^N^0.0^0.5^X10 9/L^0.2^70^N^
C^HEMATOLOGY^^^(A)   BASO^N^0.0^0.2^X10 9/L^0.1^70^N^
C^CHEMISTRY^^^GLUCOSE FASTING-SER^A^3.3^6.0^MMOL/L^6.9^70^N^
C^CHEMISTRY^^^CREATININE^A^60^115^UMOL/L^56^70^N^
C^CHEMISTRY^^^eGFR^N^^^^103^70^Y^
D^CHEMISTRY^^                                ****          ****          ****^  ^ ^
D^CHEMISTRY^^                           For patients of African descent, the reported^  ^ ^
D^CHEMISTRY^^                           eGFR must be multiplied by a correction^  ^ ^
D^CHEMISTRY^^                           factor of 1.21.^  ^ ^
D^CHEMISTRY^^                                ****          ****          ****^  ^ ^
C^CHEMISTRY^^^URATE^A^120^400^UMOL/L^440^70^N^
C^CHEMISTRY^^^SODIUM^N^135^146^MMOL/L^140^70^N^
C^CHEMISTRY^^^POTASSIUM^N^3.5^5.2^MMOL/L^3.5^70^N^
C^CHEMISTRY^^^CHLORIDE^N^95^108^MMOL/L^98^70^N^
C^CHEMISTRY^^^TOTAL BILIRUBIN^N^0.0^23.0^UMOL/L^14.0^70^N^
C^CHEMISTRY^^^ALK PHOS^N^30^110^U/L^77^70^N^
C^CHEMISTRY^^^AST^A^6^42^U/L^67^70^N^
C^CHEMISTRY^^^CHOLESTEROL^N^TARGET <5.20^TARGET <5.20^MMOL/L^4.24^70^N^
C^CHEMISTRY^^^TRIGLYCERIDES^A^TARGET <1.71^TARGET <1.71^MMOL/L^2.08^70^N^
C^CHEMISTRY^^^HDL CHOLESTEROL^A^TARGET >1.29^TARGET >1.29^MMOL/L^1.01^70^N^
C^CHEMISTRY^^^LDL CHOLESTEROL^N^See Targets^See Targets^MMOL/L^2.28^70^N^
C^CHEMISTRY^^^CHOL/HDL RATIO^A^See Targets^See Targets^^4.20^70^Y^
D^CHEMISTRY^^                           *----------*----------*----------*----------*^  ^ ^
D^CHEMISTRY^^                           Clinical Risk Status:  Target Lipid Levels^  ^ ^
D^CHEMISTRY^^                           *----------*----------*----------*----------*^  ^ ^
D^CHEMISTRY^^                            If Risk  : LDL-C --Targets-- CHOL/HDL Ratio^  ^ ^
D^CHEMISTRY^^                            Low      :  <5.1     and       <6.0^  ^ ^
D^CHEMISTRY^^                            Moderate :  <3.5     and       <5.0^  ^ ^
D^CHEMISTRY^^                            High     :  <2.0     and       <4.0^  ^ ^
D^CHEMISTRY^^                           ...as per 2006 Canadian Guidelines^  ^ ^
B^YH03548^^20090331^JOYCE^PONY^F^7332205413LE^19550326^F^0696170^DR. JEFFREY M. BROWN^SUITE 214^7330 YONGE STREET^THORNHILL, ONTARIO           L4J 1V8^^1475^^^905-502-9611^905-771-7771^31-MAR-09^
C^HEMATOLOGY^^^HEMOGLOBIN^N^115^165^G/L^121^70^N^
C^HEMATOLOGY^^^HEMATOCRIT^A^0.37^0.47^L/L^0.360^70^N^
C^HEMATOLOGY^^^WBC COUNT^N^4.0^11.0^X10 9/L^6.0^70^N^
C^HEMATOLOGY^^^RBC COUNT^N^3.80^5.80^X10 12/L^4.00^70^N^
C^HEMATOLOGY^^^MCV^N^80^97^FL^89.9^70^N^
C^HEMATOLOGY^^^MCH^N^27.0^32.0^PG^30.2^70^N^
C^HEMATOLOGY^^^MCHC^N^320^360^G/L^336^70^N^
C^HEMATOLOGY^^^RDW^A^11.0^14.5^%^15.6^70^N^
C^HEMATOLOGY^^^PLATELET COUNT^N^150^400^X10 9/L^268^70^N^
C^HEMATOLOGY^^^ABSOLUTE:  NEUTROS^N^2.0^7.5^X10 9/L^3.6^70^N^
C^HEMATOLOGY^^^(A)   LYMPH^N^1.1^3.3^X10 9/L^2.0^70^N^
C^HEMATOLOGY^^^(A)   MONO^N^0.0^0.8^X10 9/L^0.4^70^N^
C^HEMATOLOGY^^^(A)   EOS^N^0.0^0.5^X10 9/L^0.0^70^N^
C^HEMATOLOGY^^^(A)   BASO^N^0.0^0.2^X10 9/L^0.0^70^N^
C^HEMATOLOGY^^^RHEUMATOID FACTOR^A^BELOW 20^BELOW 20^KU/L^257^70^N^
C^HEMATOLOGY^^^hs-CRP^A^^^MG/L^1.9^70^Y^
D^HEMATOLOGY^^                           CUT POINTS FOR CARDIAC RISK ASSESSMENT ARE:^  ^ ^
D^HEMATOLOGY^^                           LOW RISK LEVEL      <1.0 MG/L^  ^ ^
D^HEMATOLOGY^^                           AVERAGE RISK LEVEL  1.0 - 3.0 MG/L^  ^ ^
D^HEMATOLOGY^^                           HIGH RISK LEVEL     >3.0 MG/L^  ^ ^
D^HEMATOLOGY^^                           VALUES >8.0 MG/L INDICATE INFLAMMATORY^  ^ ^
D^HEMATOLOGY^^                           CONDITIONS AND MAY NOT PREDICT CARDIAC RISK^  ^ ^
D^HEMATOLOGY^^                           .^  ^ ^
C^HEMATOLOGY^^^ANA^N^NEGATIVE^NEGATIVE^^NEGATIVE^70^N^
C^HEMATOLOGY^^^READING DOCTOR^N^^^^^70^Y^
D^HEMATOLOGY^^                           A. SEIDENFELD, M.D.,F.R.C.P.(C)^  ^ ^
C^CHEMISTRY^^^GLUCOSE FASTING-SER^N^3.3^6.0^MMOL/L^5.5^70^N^
C^CHEMISTRY^^^CREATININE^N^60^115^UMOL/L^68^70^N^
C^CHEMISTRY^^^eGFR^N^^^^78^70^Y^
D^CHEMISTRY^^                                ****          ****          ****^  ^ ^
D^CHEMISTRY^^                           For patients of African descent, the reported^  ^ ^
D^CHEMISTRY^^                           eGFR must be multiplied by a correction^  ^ ^
D^CHEMISTRY^^                           factor of 1.21.^  ^ ^
D^CHEMISTRY^^                                ****          ****          ****^  ^ ^
C^CHEMISTRY^^^URATE^N^120^400^UMOL/L^363^70^N^
C^CHEMISTRY^^^SODIUM^N^135^146^MMOL/L^142^70^N^
C^CHEMISTRY^^^POTASSIUM^N^3.5^5.2^MMOL/L^4.5^70^N^
C^CHEMISTRY^^^CHLORIDE^N^95^108^MMOL/L^104^70^N^
C^CHEMISTRY^^^TOTAL BILIRUBIN^N^0.0^23.0^UMOL/L^12.0^70^N^
C^CHEMISTRY^^^ALK PHOS^N^30^110^U/L^101^70^N^
C^CHEMISTRY^^^AST^N^6^42^U/L^31^70^N^
C^CHEMISTRY^^^C3^A^0.70^1.76^G/L^1.82^70^N^
C^CHEMISTRY^^^C4^N^0.16^0.45^G/L^0.42^70^N^
C^CHEMISTRY^^^CHOLESTEROL^A^TARGET <5.20^TARGET <5.20^MMOL/L^5.57^70^N^
C^CHEMISTRY^^^TRIGLYCERIDES^A^TARGET <1.71^TARGET <1.71^MMOL/L^3.81^70^N^
C^CHEMISTRY^^^HDL CHOLESTEROL^A^TARGET >1.29^TARGET >1.29^MMOL/L^1.19^70^N^
C^CHEMISTRY^^^LDL CHOLESTEROL^A^See Targets^See Targets^MMOL/L^2.65^70^N^
C^CHEMISTRY^^^CHOL/HDL RATIO^A^See Targets^See Targets^^4.68^70^Y^
D^CHEMISTRY^^                           *----------*----------*----------*----------*^  ^ ^
D^CHEMISTRY^^                           Clinical Risk Status:  Target Lipid Levels^  ^ ^
D^CHEMISTRY^^                           *----------*----------*----------*----------*^  ^ ^
D^CHEMISTRY^^                            If Risk  : LDL-C --Targets-- CHOL/HDL Ratio^  ^ ^
D^CHEMISTRY^^                            Low      :  <5.1     and       <6.0^  ^ ^
D^CHEMISTRY^^                            Moderate :  <3.5     and       <5.0^  ^ ^
D^CHEMISTRY^^                            High     :  <2.0     and       <4.0^  ^ ^
D^CHEMISTRY^^                           ...as per 2006 Canadian Guidelines^  ^ ^
C^RIA^^^TSH^N^0.30^4.70^MU/L^0.63^70^N^
C^RIA^^^T4 FREE^N^9.1^23.8^PMOL/L^9.4^70^N^
C^RIA^^^FREE T3^N^2.5^5.7^PMOL/L^4.3^70^N^
B^YX16191^^20090401^MARIA^BIGS^F^3429942141LA^19620304^F^0696170^DR. JEFFREY M. BROWN^SUITE 214^7330 YONGE STREET^THORNHILL, ONTARIO           L4J 1V8^^1475^^^905-790-9822^905-771-7771^01-APR-09^
C^HEMATOLOGY^^^HEMOGLOBIN^N^115^165^G/L^136^70^N^
C^HEMATOLOGY^^^HEMATOCRIT^N^0.37^0.47^L/L^0.407^70^N^
C^HEMATOLOGY^^^WBC COUNT^N^4.0^11.0^X10 9/L^6.1^70^N^
C^HEMATOLOGY^^^RBC COUNT^N^3.80^5.80^X10 12/L^4.54^70^N^
C^HEMATOLOGY^^^MCV^N^80^97^FL^89.5^70^N^
C^HEMATOLOGY^^^MCH^N^27.0^32.0^PG^29.9^70^N^
C^HEMATOLOGY^^^MCHC^N^320^360^G/L^334^70^N^
C^HEMATOLOGY^^^RDW^N^11.0^14.5^%^14.2^70^N^
C^HEMATOLOGY^^^PLATELET COUNT^N^150^400^X10 9/L^239^70^N^
C^HEMATOLOGY^^^ABSOLUTE:  NEUTROS^N^2.0^7.5^X10 9/L^3.5^70^N^
C^HEMATOLOGY^^^(A)   LYMPH^N^1.1^3.3^X10 9/L^2.1^70^N^
C^HEMATOLOGY^^^(A)   MONO^N^0.0^0.8^X10 9/L^0.4^70^N^
C^HEMATOLOGY^^^(A)   EOS^N^0.0^0.5^X10 9/L^0.1^70^N^
C^HEMATOLOGY^^^(A)   BASO^N^0.0^0.2^X10 9/L^0.0^70^N^
C^CHEMISTRY^^^GLUCOSE FASTING-SER^A^3.3^6.0^MMOL/L^8.4^70^N^
C^CHEMISTRY^^^UREA^N^3.0^8.2^MMOL/L^4.4^70^N^
C^CHEMISTRY^^^CREATININE^N^60^115^UMOL/L^66^70^N^
C^CHEMISTRY^^^eGFR^N^^^^83^70^Y^
D^CHEMISTRY^^                                ****          ****          ****^  ^ ^
D^CHEMISTRY^^                           For patients of African descent, the reported^  ^ ^
D^CHEMISTRY^^                           eGFR must be multiplied by a correction^  ^ ^
D^CHEMISTRY^^                           factor of 1.21.^  ^ ^
D^CHEMISTRY^^                                ****          ****          ****^  ^ ^
C^CHEMISTRY^^^URATE^N^120^400^UMOL/L^273^70^N^
C^CHEMISTRY^^^SODIUM^N^135^146^MMOL/L^141^70^N^
C^CHEMISTRY^^^POTASSIUM^N^3.5^5.2^MMOL/L^4.0^70^N^
C^CHEMISTRY^^^CHLORIDE^N^95^108^MMOL/L^106^70^N^
C^CHEMISTRY^^^TOTAL BILIRUBIN^N^0.0^23.0^UMOL/L^11.0^70^N^
C^CHEMISTRY^^^ALK PHOS^N^30^110^U/L^81^70^N^
C^CHEMISTRY^^^AST^A^6^42^U/L^88^70^N^
C^CHEMISTRY^^^HEMOGLOBIN A1C^A^0.040^0.060^^0.075^70^N^
C^CHEMISTRY^^^CHOLESTEROL^N^TARGET <5.20^TARGET <5.20^MMOL/L^4.28^70^N^
C^CHEMISTRY^^^TRIGLYCERIDES^N^TARGET <1.71^TARGET <1.71^MMOL/L^0.80^70^N^
C^CHEMISTRY^^^HDL CHOLESTEROL^A^TARGET >1.29^TARGET >1.29^MMOL/L^0.99^70^N^
C^CHEMISTRY^^^LDL CHOLESTEROL^A^See Targets^See Targets^MMOL/L^2.93^70^N^
C^CHEMISTRY^^^CHOL/HDL RATIO^A^See Targets^See Targets^^4.32^70^Y^
D^CHEMISTRY^^                           *----------*----------*----------*----------*^  ^ ^
D^CHEMISTRY^^                           Clinical Risk Status:  Target Lipid Levels^  ^ ^
D^CHEMISTRY^^                           *----------*----------*----------*----------*^  ^ ^
D^CHEMISTRY^^                            If Risk  : LDL-C --Targets-- CHOL/HDL Ratio^  ^ ^
D^CHEMISTRY^^                            Low      :  <5.1     and       <6.0^  ^ ^
D^CHEMISTRY^^                            Moderate :  <3.5     and       <5.0^  ^ ^
D^CHEMISTRY^^                            High     :  <2.0     and       <4.0^  ^ ^
D^CHEMISTRY^^                           ...as per 2006 Canadian Guidelines^  ^ ^
C^RIA^^^TSH^N^0.30^4.70^MU/L^0.86^70^N^
C^RIA^^^T4 FREE^N^9.1^23.8^PMOL/L^15.4^70^N^
C^RIA^^^FREE T3^N^2.5^5.7^PMOL/L^4.7^70^N^
require('stringutil')
require('node')
require('dateparser')

function main(Data)
   local R = ProcessLab(Data)
end

function node.D(Data)
   local T = dateparse.parse(Data:nodeValue())
   return os.date('%Y-%m-%d %H:%M:%S', T)
end

function ProcessLab(Data) 
   local D = hl7.parse{vmd='lab.vmd', data=Data}
   local Out = db.tables{vmd='lab.vmd', name='Labs'}

   print(#D.Patient..' patients in batch.')
   for i=1, #D.Patient do
      MapPatient(Out.Patient[i], D.Patient[i].B)
   end
   return Out
end

function MapPatient(T, I)  
   T.FirstName = I[4]:nodeValue():capitalize()
   T.LastName = I[5]:nodeValue():capitalize()
   T.Dob = I[3]:D()
end

lab.vmd

Leave A Comment?