nHapiNET / nHapi

nHapi is the .Net port of the original Java project HAPI.
Mozilla Public License 2.0
273 stars 155 forks source link

Include the optional `LongName` attribute in the XML encoded output. #301

Closed laxmi-lal-menaria closed 1 year ago

laxmi-lal-menaria commented 2 years ago

I am new to HL7 parser, I need to parse and save data to Database.

I have tried to use NHAPI and I found that its has all segments with their descriptions while debugging. I need these description with the segments position or any alternative to get them?

i.e. PID.5 -> Patient Name

image

milkshakeuk commented 2 years ago

@lmenaria can you provide more info on what output you're looking for? An example?

laxmi-lal-menaria commented 2 years ago

I would need these actual name with the values.

image

Or is there any mapping file where from I get these actual naming for my database.

Please help me on that part.

milkshakeuk commented 2 years ago

@lmenaria Having had a look at the specification for the xml encoded hl7 v2 there is an optional attribute that can be used called LongName which should contain the information you want; this is currently not included in the xml encoded output likely because its optional and also it would make the output very large.

It would look like this:

...
<OBX>
    <OBX.1 LongName='Set ID - OBX'>1</OBX.1>
    <OBX.2 LongName='Value Type'>ST</OBX.2>
    <OBX.3 LongName='Observation Identifier'>
        <CE.1 LongName='identifier'>9804-6</CE.1>
        <CE.2 LongName='text'>Weight</CE.2>
        <CE.3 LongName='name of coding system'>LN</CE.3>
    </OBX.3>
    <OBX.5 LongName='Observation Value'>74</OBX.5>
    <OBX.6 LongName='Units'>
        <CE.1 LongName='identifier'>kg</CE.1>
    </OBX.6>
    <OBX.11 LongName='Observation Result Status'>F</OBX.11>
</OBX>
...

Technically this could be done as an enhancement to the DefaultXmlParser to optionally include the LongName attribute, assuming the long name is currently available during encoding, feel free to create a pull request for this.

In regards to if there is a mapping file ... you can get all those long names from the xml schemas (xsd files) for each version from hl7 product page.

ghost commented 2 years ago

Thanks, I will review the code base and try to add this optional property.

Meanwhile if anyone who is willing to add the new property quickly, this will let me a lot.

laxmi-lal-menaria commented 2 years ago

Created a pull request: @ https://github.com/nHapiNET/nHapi/pull/308

milkshakeuk commented 2 years ago

@laxmi-lal-menaria any updates on your PR?

milkshakeuk commented 1 year ago

@laxmi-lal-menaria this change is in the latest 3.2.0 version.