Account for different parsing technique in EnsLib.HL7.Service.FileService??
I have a system that is sending Line Breaks\Carriage Returns within the text of a field that is breaking the parsing of the message. Does anyone have a way to get around this?
here is what I receive...
ZPR|29|937952|UH|Physician Assistant - Certified|Primary Privileges: Physician Assistant|Care of simple fractures including extremity, rib and clavicle; including skeletal immobilization||
as EnsLib.HL7.Service.FileService parses the message it puts immobilization on a new line because of the hidden line break, and the rest of the message is lost.
I tried using tr, sed, perl from a unix command line to reformat the message before it gets to Ensemble but I can't get the right combination to make sure the Line Feed is not in that field. The users of the system don't understand what I am asking of them and the vendor of the system has been no help either.
Does anyone have a way to create a custom parser that only looks for SEGMENTS to parse the message apart?
Just to understand your requirements correctly.
- a linebreak $c(13,10) would only be acceptable if it follows a segment terminator "|"
- IF YES Is this just a pipe | or a double pipe || as in your example?
This could be a processing rule to check the last chars of the line
and ignoré the linebreak at a mismatch.
this might do it:
Class User.Scott { ClassMethod Clean(infile, outfile) As %Status { set in=##class(%Stream.FileCharacter).%New() do in.LinkToFile(infile) set out=##class(%Stream.FileCharacter).%New() set out.Filename=outfile do in.Rewind() while 'in.AtEnd { set line=in.ReadLine() set last=($e(line,*)="|") if last set sc=out.WriteLine(line) else set sc=out.Write(line) } do in.%Close() set sc=out.%Save() quit sc } }
Hi Scott,
Have created an example state machine to walk three character segment names "AAA" or "AAN".
You can change the hl7 seperator via the parameter as annotated.
Cheers,
Alex
Thanks for the suggestions, so I would need to add this to a copy of EnsLib.HL7.Service.FileService to call as it reads in the message? Or would I call a service then send it another service to parse and remove the misc characters before it starts reading it in as HL7?
Hi Scott,
Minimal sub-classing could be like the following:
Note: If there is no modification, it simply presents the original unmodified filestream.