Question
Frances Needle · Dec 8, 2020

Convert contents of OBX segments from an HL7 message into an embedded PDF document

Hi

We receive an HL7 order message into our integration engine containing OBX segments. I would like to create a PDF file and take the values from all instances of OBX-5 in the  message and write them to that PDF file, which I would then like to embed into an outgoing message to another system.

Any help appreciated.

Thanks

Frances

Product version:
Ensemble 2017.1
00
1 0 2 178
Log in or sign up to continue

Replies

Hi Frances,

You are saying that you are getting an Order message. Is it an ORM message or an ORU message (the latter typically contains OBX segments and is of type Observation/Result). 

In general, you would probably have to do something of the following:

1) During message processing, concatenate the content of every OBX:5 field into a single variable. In order to avoid a "Long String" problem in Cache, I would open a GlobalCharacterStream or FileCharacterStream and keep writing each new OBX:5 field to Stream as you loop over the segments.

2) In order to convert anything into PDF, you would need an external Rendering Engine. There is one I found on Open Exchange:

https://openexchange.intersystems.com/package/iris-pdf-generator

Also, Cache provides Apache FOP PDF Engine.  Here is some documentation on how to run it:

https://xmlgraphics.apache.org/fop/

https://xmlgraphics.apache.org/fop/2.5/running.html

The issue is, how to invoke the rendering engine from your ObjectScript code. This thread might be helpful:

https://community.intersystems.com/post/how-create-pdf-file-html

You can then write your PDF to a file.

3) If you wrote your PDF to file, you can use the following article on how to embed it into the HL7 Message:

https://community.intersystems.com/post/ensemble-how-embed-pdf-file-hl7-...

This is a complex project; but the tools listed here should help you.

Hi Vitaly

The message we receive is an ORM.

Thank you for detailing how I'd go about this, I'm sure it will be of use in future projects

Unfortunately we are on a tight timescale for this project and therefore it  isn’t feasible for us to call another application and encode the result into an outgoing HL7. 

I am instead working on converting the ORM into an MDM and sending plain text values in OBX segments.

Thank you