web stats
Remove LF in middle of segment - Page 3 - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #21  
Old 09-12-2013, 06:25 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,242
cory_cole is on a distinguished road
Default

Can you post a sample message with PHI removed?
Reply With Quote
  #22  
Old 09-12-2013, 06:31 AM
rutledj rutledj is offline
Mirth Guru
 
Join Date: Nov 2010
Location: North Carolina
Posts: 387
rutledj is on a distinguished road
Default

MSH|^~\&|AcumenPM|12^UNKTN|HITSG|AcumenEHR|2013091 01517||SIU^S13|1-M12837.0|T|2.3.1EVN|S13|201309101517
SCH||3235||||Office Visit-Est|Office Visit-Est|"7/30 called na
"|15|minutes|^^^20130911150000|||||PABE
PID||1-MX3232.0|1-MX3232.0||DOE^JOHN^B||19920924|M||2106-3^WHITE|530 SUNSET STREET^^NOWHERE^WY^99863||(999)999-9999||ENG^ENGLISH||||40479999|||2186-5^NOT HISPANIC OR LATINO
PV1|||1^NEPHROLOGY UT OFFICE||||4^DOE^JANE|^
Reply With Quote
  #23  
Old 09-12-2013, 06:48 AM
panickc panickc is offline
OBX.3 Kenobi
 
Join Date: Dec 2007
Posts: 127
panickc is an unknown quantity at this point
Default

Are the extraneous CR's always within quotes? If so, it should be easy to come up with a REGEX replace for that. (But I'm no REGEX expert!)

If not, what I have done with INVALID HL7 messages in the past that contain extraneous delimiters is read through each line verifying segment names, ie MSH, PID, PV1, etc. at the beginning of each line and if a line begins with something other than a segment name, remove extraneous delimiters and append it to the previous segment.

It's ugly, but some vendors just don't get it.

-Craig
Reply With Quote
  #24  
Old 09-12-2013, 06:58 AM
rutledj rutledj is offline
Mirth Guru
 
Join Date: Nov 2010
Location: North Carolina
Posts: 387
rutledj is on a distinguished road
Default

Ok. I may have to do that if I can't get the PMS to correct it. Thanks for your help.
Reply With Quote
  #25  
Old 09-12-2013, 06:58 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,242
cory_cole is on a distinguished road
Default

This code works for me in the preprocessor.

var segments = message.toString().split('\r');
var newMessage = '';
for(i = 0; i < segments.length; i++)
{
var newSegment;
if( segments[i].substring(0,3) == 'SCH')
{
newSegment = segments[i] + segments[++i];
}
else
{
newSegment = segments[i];
}
newMessage += newSegment + '\r';
}

return newMessage;
Reply With Quote
  #26  
Old 09-12-2013, 07:08 AM
rutledj rutledj is offline
Mirth Guru
 
Join Date: Nov 2010
Location: North Carolina
Posts: 387
rutledj is on a distinguished road
Default

Running your code I get this:

MSH|^~\&|AcumenPM|12^UNKTN|HITSG|AcumenEHR|2013091 01517||SIU^S13|1-M12837.0|T|2.3.1EVN|S13|201309101517
SCH||3235||||Office Visit-Est|Office Visit-Est|"7/30 called na"|15|minutes|^^^20130911150000|||||PABEPID||1-MX3232.0|1-MX3232.0||DOE^JOHN^B||19920924|M||2106-3^WHITE|530 SUNSET STREET^^NOWHERE^WY^99863||(999)999-9999||ENG^ENGLISH||||40479999|||2186-5^NOT HISPANIC OR LATINO
PV1|||1^NEPHROLOGY UT OFFICE||||4^DOE^JANE|^


The EVN is in the MSH the SCH message looks scrabbled.

Also, just testing this in a test channel, the original channel is a dbreader so it is expecting xml. Is there a way for this to still work in the preprocessor and then get converted to xml?

Thanks
Reply With Quote
  #27  
Old 09-12-2013, 07:16 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,242
cory_cole is on a distinguished road
Default

The EVN is in the MSH - It is that way in the sample message. So, it will be change that.
the SCH message looks scrabbled - the SCH is coming out exactly the sample message with the '\r' removed.

Also, just testing this in a test channel, the original channel is a dbreader so it is expecting xml. Is there a way for this to still work in the preprocessor and then get converted to xml?

I don't know about the DB Reader but with a LLP or a channel reader, the message is a string in the preprocessor and is converted to XML after that. You may have to convert to a string run the script then convert it back to XML. But yes, it can be done.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 11:27 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation