MatthewVita / node-hl7-complete

Node module that is bridged with the Java Hapi HL7 library.
54 stars 13 forks source link

UNKNOWN in the hl7 to json output #24

Closed privateOmega closed 2 years ago

privateOmega commented 3 years ago

I won't have time to look into this immediately, but I wanted to point out that there may be a bug somewhere. See the "UNKNOWN"s. Just posting this more as a reminder for myself. Feel free to ignore.

issue

Originally posted by @MatthewVita in https://github.com/MatthewVita/node-hl7-complete/issues/23#issuecomment-917365268

privateOmega commented 3 years ago

@MatthewVita Yes that was something that I noticed earlier, but didnt pay much attention and thought that was due to the hl7 message that you used, but any chance its because of the HAPI upgrade and they are marking custom fields by the name UNKNOWN in the latest version?

MatthewVita commented 2 years ago

@privateOmega

/**
 * Looking for UNKNOWNs... did the HAPI upgrade mess with stuff or are the examples incorrect/very specific?
 * It's fair to say that HL7 (not FHIR) is a pretty loose standard and these are just specific messages that
 * only internal systems know how to map (i.e.: Health Sentry HL7 interfaces). I found all of these messages
 * years ago and now I'm realizing that I should have considered their context instead of "oh wow, the messages
 * are showing... it must be working and contextually valid!"
 * 
 * This code was written in less than 30 minutes. _Please_ ignore how bad it is to follow.
 * 
 * Start testing this code by checking out 771202d71fd618f013c9dcafe2c361126d4370f1 which is v2.2... then on master. 
 * There are txt files that are spat out to see what's going on. Make sure to rename the first files so you don't override them when running the script on master. 
 * 
 * My diff tool (meld) sees NO difference between the old 2.2 and 2.3 systems integration.
 */

const NodeHL7Complete = require('./index.js')
const nodeHL7Instance = new NodeHL7Complete()

// THIS IS THE EXAMPLE ON THE README - THIS WORKS
let data1 = ''
data1 += 'MSH|^~\\&|||||||VXU^V04|19970522MA53|P|2.3.1|||AL\r'
data1 += 'PID|||221345671^^^^SS||KENNEDY^JOHN^FITZGERALD^JR|BOUVIER^^^^^^M|19900607|M|||^^^^MA^^^BLD\r'
data1 += 'NK1|1|KENNEDY^JACQUELINE^LEE|32^MOTHER^HL70063\r'
data1 += 'RXA|0|1|19900607|19900607|08^HEPB-PEDIATRIC/ADOLESCENT^CVX|.5|ML^^ISO+||||||||MRK12345||MSD^MERCK^MVX\r'

// PICKED RANDOMLY - LOTS OF UNKNOWNS
let data2 = ''
data2 += 'MSH|^~\\&|HealthSentry^HealthSentry^L|Baseline West MC^33D1234567^L|VISN_OUT^VISN_OUT^L|VISN_OUT^VISN_OUT^L|201011041640||ORU^R01^ORU_R01|201010010913000771|P|2.5.1|||||||||PHLabReport-NoAck^^2.16.840.1.114222.4.10.3^ISO'
data2 += 'SFT|Cerner Corporation|20101001|HealthSentry|HealthSentry|HealthSentry|20101001'
data2 += 'PID|1||9339683996^^^Baseline West MC&33D1234567&L^MR^Baseline West MC&33D1234567&L|7903^^^Cerner Corp|Miller^Paul^One^^^^L||20050715050000|M||White^Caucasian^HL70005|555 Flower Street^^Aurora^CO^80011^USA^C||^PRN^PH^^^303^5549936||en^English^ISO6391||||765894312|||N^Non Hispanic^HL70189'
data2 += 'ORC|RE|||||||||||Harrison , Kyle^Harrison^Kyle^^^^^^Baseline West MC&33D1234567&L|||||||||Baseline West MC^L^^^^Baseline West MC&33D1234567&L^XX^Baseline West MC&33D1234567&L^^123|2800 Rockcreek Parkway^^Kansas City^MO^64117^^B|^^PH^^^816^2211024|2800 Rockcreek Parkway^^Kansas City^MO^64117^^B'
data2 += 'OBR|1||2010273000016^EHR^33D1234567^L|548-8^Culture Sputum^LN^114^Culture Sputum^99zzz or L|||201011041640||||||None|201011041640||Harrison , Kyle^Harrison^Kyle^^^^^^Baseline West MC&33D1234567&L|^^PH^^^816^2211024|||||20101001132800||MB|F||||||786.2^COUGH^I9~786.03^APNEA^I9~786.0^DYSPNEA AND RESPIRATORY ABNORMALITIES^I9'
data2 += 'SPM|1|||119334006^Sputum^SCT^SPT^Sputum^HL70070^20080131^2.5.1'
data2 += 'OBX|1|CE|548-8^Culture Sputum^LN^114^Culture Sputum^99zzz or L|1|^Bordetella pertussis^SNM|||A|||F|||201011041640|||||20101105132800||||Baseline West MC^L^^^^Baseline West MC&33D1234567&L^XX^Baseline West MC&33D1234567&L^^123|2800 Rockcreek Parkway^^Kansas City^MO^64117^^B'

const _ = [data1, data2]
_.forEach((input, idx) => {
    nodeHL7Instance.hl7ToJs(input, function(err, output) {
        idx++; require('fs').writeFileSync(`result_${idx}.txt`, JSON.stringify(output))
    });
});
privateOmega commented 2 years ago

@MatthewVita Yup, I tried it out as well and seems like we haven't broken anything, kudos.

Also thanks for the script and I am closing this issue since its irrelevant.