Closed GilmoreA6 closed 3 weeks ago
After further research, RS does not use the LINUX4HEALTH HL7->FHIR mappings (https://github.com/LinuxForHealth/hl7v2-fhir-converter/tree/master/src/main/java/io/github/linuxforhealth/hl7) unless the message type is not mapped in RS (i.e. ADT-A04 would use the LINX4HEALTH library but ORU_RO1 would not). For the NM data type for OBX.5 RS is simply taking the string value of the inbound OBX.5 and placing it into the valueQuantity.value fhir element.
This limits our potential options to solve the leading zero issue to the following:
1.) Ask RS to change how it is converting the OBX.5 value for the NM data type to a valueString FHIR element in a new custom extension.
Pros:
Cons:
2.) Create sender transform that moves value in valueQuantity,value to valueString element on same observation resource
Pros:
Cons:
Pros:
Cons:
After discussion at engineering sync, option 3 was decided upon for the time being. This does not prevent us from continuing to pursue other options. PR for option 3 opened and approved with RS: https://github.com/CDCgov/prime-reportstream/pull/16296
Transform added to ca-phl.etor-nbs-results sender in RS staging.
Round trip test was conducted with ETOR and RS staging environments which confirmed leading zeroes were truncated appropriately and no other values were affected. Additional test will be performed on 10/23/24 with UCSD and CA at the regular weekly SME call.
Added the transform to ca-phl. etor-nbs-results in our open PR in RS: https://github.com/CDCgov/prime-reportstream/pull/16064/commits/5c388cdc6738b7ce3f80069e9ebf93b660277eac
Added draft PR for RSe2e tests https://github.com/CDCgov/trusted-intermediary/pull/1487/files
PR approved and merged. Example file from CDPH from 10/22/28 had correct truncations
Bug
Describe the Bug
When an OBX segment has a data type of "NM" in OBX-2 and the result value in OBX-5 contains leading zeros, the resulting fhir bundle contains an invalid value for "Bundle.entry.resource.ofType(Observation).valueQuantity.value".
example HL7 segment:
OBX|1|NM|38473-5^17-Hydroxyprogesterone^LN|1|065.88|nmol/L|<85|N|||F|||20241015055726
example converted FHIR Resource:
{ "fullUrl": "Observation/1729104155244834642.39eac40b-c44b-4d07-b4bb-8b96ade62411", "resource": { "resourceType": "Observation", "id": "1729104155244834642.39eac40b-c44b-4d07-b4bb-8b96ade62411", "extension": [ { "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/sub-id", "valueString": "1" }, { "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/obx-observation", "extension": [ { "url": "OBX.2", "valueId": "NM" }, { "url": "OBX.6", "valueCodeableConcept": { "coding": [ { "extension": [ { "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", "valueString": "coding" } ], "code": "nmol/L" } ] } }, { "url": "OBX.11", "valueString": "F" } ] } ], "status": "final", "code": { "coding": [ { "extension": [ { "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", "valueString": "coding" }, { "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding-system", "valueString": "LN" } ], "system": "http://loinc.org", "code": "38473-5", "display": "17-Hydroxyprogesterone" } ] }, "subject": { "reference": "Patient/1729104154973770467.0f02574a-aaca-4e07-9989-d810f3a7d499" }, "effectiveDateTime": "2024-10-15T05:57:26Z", "_effectiveDateTime": { "extension": [ { "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2-date-time", "valueString": "20241015055726" } ] }, "valueQuantity": { "value": 065.88, "unit": "nmol/L" }, "interpretation": [ { "coding": [ { "extension": [ { "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", "valueString": "coding" } ], "code": "N" } ] } ], "referenceRange": [ { "text": "<85" } ] } }
This occurs because leading zeros are not explicitly invalid in HL7 V2 NM data type (https://hl7-definition.caristix.com/v2/HL7v2.7/DataTypes/NM) , however when this is converted to FHIR per the hl7V2 -> FHIR documentation (https://build.fhir.org/ig/HL7/v2-to-fhir/ConceptMap-segment-obx-to-observation.html) this becomes a ValueQuantity.value element (https://hl7.org/fhir/R4/datatypes.html#Quantity) with a primitive type of decimal, which does not allow leading zeros (https://www.w3.org/TR/xmlschema-2/)
Impact
When an HL7 V2 message is sent into ReportStream and converted to FHIR exception "ca.uhn.fhir.parser.DataFormatException: HAPI-1861: Failed to parse JSON encoded FHIR content: Invalid numeric value: Leading zeroes not allowed at [line: 1, column: 137695]" is thrown when attempting to parse the FHIR bundle to apply the jurisdictional filters.
To Reproduce
Expected Behavior
The resulting FHIR resource from a converted HL7 v2 message should not contain invalid values and should not throw an error when reaching the destination-filter step
Acceptance Criteria
Tasks
Engineering