LinuxForHealth / hl7v2-fhir-converter

Converts HL7 v2 Messages to FHIR Resources
Apache License 2.0
89 stars 36 forks source link

MSH.24.2 should not be marked as required #518

Open MarceloLaser opened 6 months ago

MarceloLaser commented 6 months ago

Describe the bug Same as described in https://github.com/LinuxForHealth/hl7v2-fhir-converter/issues/76.

To Reproduce Attempt to convert any otherwise valid and supported HL7v2 message which contains an MSH segment but not the MSH.24 field.

Expected behavior FHIR resource is created including a MessageHeader resource.

Desktop (please complete the following information):

Additional context I have run into the same problem described in issue https://github.com/LinuxForHealth/hl7v2-fhir-converter/issues/76, that is, that the MessageHeader resource is not created when MSH.24 is absent. This is due to MSH.24.2 being required in secondary/Source.yml. The specification listed by @pbhallam (https://www.hl7.org/fhir/messageheader.html) marks source as required, but not endpoint. Also, secondary/Destination.yml has a different format for its endpoint, despite being represented the same way in HL7v2: for Destination, it allows the converter to fall back on MSH.6 if MSH.25 is absent.

To clarify, the faulty behavior is not that the conversion fails altogether, but rather that a FHIR bundle is generated without a MessageHeader resource. This may be why you were unable to reproduce the issue previously. I am currently running into the same problem when using either the source code from the current master branch, or the version 1.1.0 dependency from Maven Central (https://mvnrepository.com/artifact/io.github.linuxforhealth/hl7v2-fhir-converter/v1.1.0).

My recommendation would be to unmark endpoint in both Source.yml and Destination.yml as required, and to either modify Source.yml to allow falling back on MSH.4, or modify Destination.yml to disallow falling back on MSH.6 (this option seems more in line with the FHIR specification). I'd be happy to send in a PR making these changes, if there is agreement that it is an appropriate solution.