web stats
Free Txt in fields mess up CSV to HL7 Conversion - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 08-24-2011, 02:07 PM
wahiawa wahiawa is offline
What's HL7?
Join Date: May 2011
Posts: 4
wahiawa is on a distinguished road
Red face Free Txt in fields mess up CSV to HL7 Conversion

Free Txt in fields mess up CSV to HL7 Conversion
I am converting .csv files to HL7 and have had great success until the vendor exports out their .csv's with fields that contain both quotes and comma's in free text inside of the fields. The field separators are comma's and they are enclosed with quotes, so I can't remove either of them and still have the conversion work properly.

Also, there is a leading whitespace in the last column, so I'm not sure if maybe even that is just the problem. I've tried everything I've read to remove that whitespace, but nothing seems to work. I was going to add screen shots but thought maybe sending the actual channel might be better? Would really appreciate help, I have scoured the forums I hope I didn't miss anything. This is a GoLive BLOCKER

This is the .csv (batched, with one column header being ignored in each file and always has 8 rows) coming across, for quick reference:
accountNumber,visitID,lastName,firstName,gender,bi rthdate,familyName,notes
"12345","55555","ptLastName","ptFirstName","fe male ","20110101","Grandmother (unspecified)", " diabetes, hypertension"

XML Transformation:
<OBX.3.1>Grandmother (unspecified)</OBX.3.1>
<OBX.5.1>" diabetes</OBX.5.1>

Encoded Message:
MSH|^~\&|ECW|CLINICNAME|HIE|HIESERVER|201108241127 40||ORU^R01|FamHx_20110824112740|P|2.4
PID|1||123245||ptLastName^ptFirstName||20110101|fe male|||||||||||||||||||||||
PV1|||||||||||||||||||55555||||||||||||||||||||||| |||
OBX|1||Grandmother (unspecified)||" diabetes||

Thank you much in advance! -MMM
Attached Files
File Type: xml eCW FamilyHistory.xml (26.0 KB, 36 views)

Last edited by wahiawa; 08-24-2011 at 02:30 PM. Reason: Fixed one error...
Reply With Quote
Old 08-24-2011, 02:19 PM
upstart33 upstart33 is offline
Mirth Guru
Join Date: Dec 2010
Location: Chicago, IL.
Posts: 461
upstart33 is on a distinguished road

You can try to do something like this as the last step of your Transformer. Or you can put something in your Pre-processing script section:

// if you don't have on outbound template
msg = msg.toString().replace(/,/,"");
// if you do have an outbound template
tmp = tmp.toString().replace(/,/,"");

Last edited by upstart33; 08-24-2011 at 02:26 PM.
Reply With Quote
Old 08-24-2011, 02:53 PM
wahiawa wahiawa is offline
What's HL7?
Join Date: May 2011
Posts: 4
wahiawa is on a distinguished road

Thanks for the quick response! I did try those options, I didn't know there was a difference between if you have an outbound template, so that is good to know. I do have one, so I did try tmp = tmp.toString().replace(/,/,""); but it gave me the same exact results, like the pre-processor didn't take:

So I still have the space, but it turns out the space issue is not the one between " diabetes, hypertension, it's the space before the two columns)", " diabetes... that is causing the issue

"Grandmother (unspecified)", " diabetes, hypertension"

Even the comma doesn't have issues once that is fixed. SO the bigger question is how to remove a space from in between the columns and I'd be all set!

Last edited by wahiawa; 08-24-2011 at 03:50 PM.
Reply With Quote

csv, mapping, quotes, transformer, whitespace

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 10:55 AM.

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