Text File Fixed Format

Primary tabs

I have a standard text file that is coming out of a system new line delimited. Each document will have the same field structure each time.

ID: xxxxxxxxx
Name: xxxx,xxxx   Age: xx   Sex: x

OSU Wexner Medical Center Harding Hospital
Treatment at  7/14/2016   10:39:34 AM

% Energy Set                                    50 %
Charge Delivered                             255.4 mC
Current                                       0.91 A
Stimulus Duration                              7.0 Sec
Frequency                                       40 Hz
Pulse Width                                   0.50 mSec
Static Impedance                              1170 Ohm
Dynamic Impedance                              200 Ohm
EEG Endpoint is not detected
EMG Endpoint                                    15 Sec
Base Heart Rate                                 78 b/m
Peak Heart Rate                                 91 b/m
Average Seizure Energy Index                7471.4 ?V?
Postictal Suppression Index                    N/A
Maximum Sustained Power                    15787.0 ?V?
Time to Peak Power                              12 Sec
Maximum Sustained Coherence                   99.3 %
Time to Peak Coherence                          17 Sec
Early Ictal Amplitude                        113.1 ?V
Midictal Amplitude                           177.7 ?V
Post-Ictal Amplitude                           N/A
Program Selected:   LOW 0.5 CHARGE RATE

Is there a way we could read this into Ensemble to parse it out into an HL7 flow sheet message?

 

  • 0
  • 0
  • 665
  • 4
  • 3

Answers

As I see you have multiple tasks. At first, you should parse this file. But I don't see any code from you, how you tried to do this task. So, I'm not going to do it instead of you. Just give you some advices. Looks like format for this file is fixed, you can use %Stream.FileCharacter class to read file line by line, with method ReadLine. Then for each read line of text you can use regular expression to extract needed data. 

But I don't know what to say about second part of your question because I have not worked yet with HL7.

I think Scott's file format is variable, with records delimited by newline. In this case, Scott, you can use %Stream.FileCharacter to read it if you set property LineTerminator = $C(10).

I have no experience with HL7 either.

 

I was just seeing if it was possible at this point, I had not tried to code it. Would I create a custom Service to read in the file or use the EnsLib function and pass it to a BPL to read in the line by line format?

Business Service it is just retrieving data, in some different ways with adapters. It means, that you should create Business Process. With a custom Business Process, where you should do all transformation, you can get data from different sources, in the same format, transform it somehow, and send to next Process, or Business Operation.

I think the way I would code this is create a new message object which contains properties for all the fields that might appear in the file.  Then create a new custom file service using the adapter EnsLib.File.InboundAdapter.  In the OnProcessInput for that new file service, use Dmitry and Carlos's suggestion to read the file with pRequest.ReadLine() and parse each line to extract the property name and value and store the value in the appropriate property of the new message object.

Then, have the service send that message object to a router with a DTL transform which will convert from your new message object class into an HL7 message and send that message to the target.

You can use the Ensemble Record Mapper to define a format for fixed format text files. Ensemble can then use the record map you created to ingest the file as a message object which can be transformed to HL7 using standard DTLs.

 

I'm not sure that the Ensemble Record Mapper makes this much easier than just reading the stream. Unless you don't treat the end of line as terminator, each line will be a separate record. It is possible that you could use the Complex Record Mapper to create one record from the file using the first column as the leading text, but that requires defining one record map for each line in the file. I'm not sure how to handle the Hospital name and blank lines. I don't think that batch record map would help because there's different kinds of information on each line.

But I think most of the work is not going to be parsing the input file but in making sure that the HL7 message has all the right segments and fields.