HL7 ORU1^R01 messages are not processed from hl7 in_queue due to validation errors ('obs id is null')

Application Name: Reference Application Version Number: 2.7.0

Question: I run the reference application 2.7.0 with the default database (the one to chose on startup). By posting to the endpoint /openmrs-standalone/remotecommunication/postHl7.form, I send an observation (ORU^R01) message:

MSH|^~&|FORMENTRY|AMRS|HL7LISTENER|AMRS|20050217152845||ORU^R01|AMRS20050217152845|P|2.5|1||||||||1^AMRS.ELD.FORMID

PID|1||106||Smith^John^^^|Patient^Momma^Thee^^MS|20040101000000^Y|M||B|555 Johnson Road^Apt.555^Indianapolis^IN^46202^USA|||||||||||Indianapolis, IN|||||||||||||||||TRIBE CODE

PV1|1|O|2^^^^^^^^^1^AMRS|2|||1^Mamlin^Joseph^^^^^^^^8^M10^^AMRS|||||||||||||||||||||||||||||||||||||20050217140000|||||||V

ORC|RE||||||||20050221130000|1^Enterer^Ima^^^^^AMRS

OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^DCT

OBX|1|CE|1082^REVIEW OF SYSTEMS, CENTRAL NERVOUS SYSTEM^DCT||207^DEPRESSION^DCT||||||F|||20050217204000

OBX|3|NM|5089^WEIGHT (KG)^DCT||25|kg|20-300|L|||F|||20050217204000

OBX|4|TS|1191^HISTORICAL DRUG STOP DATE^DCT||20050101||||||F|||20050217204000

This is a modified version of the example observation message: https://wiki.openmrs.org/display/docs/HL7#HL7-ExampleObservation(ORU^R01)Message I modified the following due to several exceptions were thrown:

  • patient id (PID-3) and name (PID-5) to match the actual database content
  • set an id (more or less randomly) for the Point of Care (PV1-3-1)
  • changed the Assigning Authority (MSH-21.2) to the value of org.openmrs.hl7.HL7Constants.HL7_FORM_ID
  • removed the line “OBX|2|SN|5497^CD4 COUNT^DCT||<^10|cells/mm3|10-1500|L|||F|||20050217204000” because an exception said that the value type SN isn’t supported

Now the message finally ends up in the hl7_in_queue table. But during the automatically triggered import process, an exception is thrown:

http://pasted.co/c29b02bb

The apparently generic parts were replaced with “[…]”. Full stacktrace on bottom of this text. The German term ‘Darf nicht leer oder ungültig sein’ term translates to ‘must not be empty or invalid’. To me the ids of the OBX segments seem to be valid. I also looked at the code, but to be honest, I have no clue what happens within the ObsServiceImpl.saveObs(…) method and for the ObsDAO I couldn’t find the implementation code. Beside that I don’t understand the mechanism of injecting and configuring the validation wrapper.

Does someone has an idea about this issue? Many thanks in advance.

Cheers Torsten

— Full stack trace — http://pasted.co/61ecfdc1

Which version of the remotecommunication module are you running?

Hi @dkayiwa, thanks for your reply.

I’ve just downloaded and unpacked the reference application 2.7.0 and left everything untouched. So I can’t tell you a changset or something like that. Can I look for some more information within the files?

Best Torsten

Did you try the hl7 resource? /openmrs-standalone/ws/rest/v1/hl7

https://demo.openmrs.org/openmrs/module/webservices/rest/apiDocs.htm

Meanwhile I did. It leads to the same exception

Logfile excerpt (log level “debug”): http://pasted.co/3ca716ef

Can you edit the post and put the log in a pastebin.com link?

Unfortunately I can’t do this currently, because the access to pastebin.com is blocked in our company network. I’ve contacted our IT department but I’m not very confident that they’d change this. Is this the only way to proceed?

You can use any other paste sites. Just google with “pastebin alternatives”.

The reason am insisting on this is that logs make the thread too long for one to read through and help.

Ok, done. Hope that I’ve done it as expected. Thanks in advance for your help and time!

What is the data type of the obs concept that you are passing in? And what value are you supplying for this concept?

I’m not sure if I get you right. I send a hl7 message (which is included in the original posting above … I added additional linefeeds for clarification now) that includes some observations.

After looking at the sources, I strongly assume that the OBX segments are the “obs” mentioned in the exceptions. So, the “type - (observation)value” tuples are

CE - 207^DEPRESSION^DCT

NM - 25

TS - 20050101

I just realised that TS is not a valid type. So I removed it from the message but the exception is still thrown

Let me simplify it this way, before even thinking of the HL7 message format, you need to decide which concept you are going to send a value for. Can you start from here?