Sam S · Feb 27, 2018

Saving HL7 messages to a csv file

Is it possible to save HL7 messages to a csv file?  Record Mapper appears to allow a service to import a csv and convert to HL7, but can you reverse that and save to a csv?

0 1,669
Discussion (7)3
Log in or sign up to continue

The record mapper creates a record definition that can be used as either a source or a target; create the record layout you require in the mapper, then use the DTL editor to define how the HL7 fields are mapped from the HL7 document type to the record map document.

Hi Jeffrey,

Could you please tell me how can I configure a field in the record map to create a line for each OBX segment, each line is going to repeat the OrderNumber (ORC field) and PatientID (PID field). Do I need to create a complex record map? or use BPL that will iterate on each OBX segment?



If the layout of each record is identical, a simple record map populated through a BPL/DTL combo would be the preferred solution.

Thank you for replying,
The layout is identical, the CSV file will have a record with more or less lines referring to one patient/order depending of how many OBX segments we have in the message (report). OK.. I will try the BPL/DTL to split each line OBX and send it to the CSV file.
Output .csv file:
Order 123|Patient 1| line 1 report OBX...
Order 123|Patient 1| line 2 report OBX
Order 123|Patient 1| line n report OBX
Order 235|Patient 1| line 1 report OBX
Order 235|Patient 1| line n report OBX
Order 199|Patient 2| line 1 report OBX
Order 199|Patient 2| line n report OBX


You haven't specified an iteration for ORCgrp(). If there's only one ORC group in your messages, you should use ORCgrp(1).


How do I get the count of OBX segments in BPL, so I can split the message and send one line (OBX.5 value - mapping) at the time to the CSV file?
I used a Integer var context.OBXNumber with request.GetValueAt("ORCgrp().OBXgrp(*)")
While context.OBXCounter<context.OBXNumber, but it is not getting me the count.