hapifhir / hapi-hl7v2

282 stars 137 forks source link

`NonGreedyMode` causing issues parsing `ORU^R01` #105

Open milkshakeuk opened 1 year ago

milkshakeuk commented 1 year ago

Hi @jamesagnew @ohr someone has created a discussion on nhapi for this, with nhapi being a port of hapi the exact same thing happens.

given the following er7.

MSH|^~\&|APL|CMFL|APL2|CMFL|20230908152100||ORU^R01|055eec95-3ac9-4d1a-95d8-e09e8e223e8b|P|2.5|||AL
PID||1092902|1092902^^^CB^NS|^^^N_BI|ROSA^ABEL JOÃO^||19411015|M|||AV JOÃO PAULO II LT 544 3 D^^N/A^^1900-000^||^^^^^^|^^^^^^||||||||||||||||N
NTE|1|O|teste|1R
PV1||Consultas|||||||||null||||||||V.OP000002511|||S
ORC|SC|TH70|TCMFL2023000005||CM||1.000
OBR||TH70|TCMFL2023000005|26390-5^Rx Mão - direita, 2incidências|||20230908152100|||||||||||TCMFL2023000005|||CR|||CR|||1^^^|||||228549868|228549868|228549868&&medicoteste||||||||||||TCMFL2023000005^^ACCESSION_NUMBER
OBX|1|ST|^SR Instance UID||2.25.1890683.1.1||||||F||||||

When parsed with NonGreedyMode set to true the following exception occurs in nhapi: image

and the same in hapi.

image

It looks like the NonGreedyMode mode in this instance is removing the outer ORDER_OBSERVATION structure from PATIENT_RESULT which doesn't make any sense to me, if anything the segment which this should have an impact on would be the OBX since there are 2 which appear under ORDER_OBSERVATION?

image

image

Is this a known issue?