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

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
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:
<HL7Message>
<MSH>
<MSH.1>|</MSH.1>
<MSH.2>^~\&amp;</MSH.2>
<MSH.3>
<MSH.3.1>ECW</MSH.3.1>
</MSH.3>
<MSH.4>
<MSH.4.1>CLINICNAME</MSH.4.1>
</MSH.4>
<MSH.5>
<MSH.5.1>HIE</MSH.5.1>
</MSH.5>
<MSH.6>
<MSH.6.1>HIESERVER</MSH.6.1>
</MSH.6>
<MSH.7>
<MSH.7.1>20110824112740</MSH.7.1>
</MSH.7>
<MSH.8/>
<MSH.9>
<MSH.9.1>ORU</MSH.9.1>
<MSH.9.2>R01</MSH.9.2>
</MSH.9>
<MSH.10>
<MSH.10.1>FamHx_20110824112740</MSH.10.1>
</MSH.10>
<MSH.11>
<MSH.11.1>P</MSH.11.1>
</MSH.11>
<MSH.12>
<MSH.12.1>2.4</MSH.12.1>
</MSH.12>
</MSH>
<PID>
<PID.1>
<PID.1.1>1</PID.1.1>
</PID.1>
<PID.2/>
<PID.3>
<PID.3.1>123245</PID.3.1>
</PID.3>
<PID.4/>
<PID.5>
<PID.5.1>ptLastName</PID.5.1>
<PID.5.2>ptFirstName</PID.5.2>
</PID.5>
<PID.6/>
<PID.7>
<PID.7.1>20110101</PID.7.1>
</PID.7>
<PID.8>
<PID.8.1>female</PID.8.1>
</PID.8>
<PID.9/>
<PID.10/>
<PID.11/>
<PID.12/>
<PID.13/>
<PID.14/>
<PID.15/>
<PID.16/>
<PID.17/>
<PID.18/>
<PID.19/>
<PID.20/>
<PID.21/>
<PID.22/>
<PID.23/>
<PID.24/>
<PID.25/>
<PID.26/>
<PID.27/>
<PID.28/>
<PID.29/>
<PID.30/>
<PID.31/>
</PID>
<PV1>
<PV1.1/>
<PV1.2/>
<PV1.3/>
<PV1.4/>
<PV1.5/>
<PV1.6/>
<PV1.7/>
<PV1.8/>
<PV1.9/>
<PV1.10/>
<PV1.11/>
<PV1.12/>
<PV1.13/>
<PV1.14/>
<PV1.15/>
<PV1.16/>
<PV1.17/>
<PV1.18/>
<PV1.19>
<PV1.19.1>55555</PV1.19.1>
</PV1.19>
<PV1.20/>
<PV1.21/>
<PV1.22/>
<PV1.23/>
<PV1.24/>
<PV1.25/>
<PV1.26/>
<PV1.27/>
<PV1.28/>
<PV1.29/>
<PV1.30/>
<PV1.31/>
<PV1.32/>
<PV1.33/>
<PV1.34/>
<PV1.35/>
<PV1.36/>
<PV1.37/>
<PV1.38/>
<PV1.39/>
<PV1.40/>
<PV1.41/>
<PV1.42/>
<PV1.43/>
<PV1.44/>
<PV1.45/>
</PV1>
<OBR>
<OBR.1/>
<OBR.2/>
<OBR.3/>
<OBR.4/>
<OBR.5/>
<OBR.6/>
<OBR.7/>
<OBR.8/>
<OBR.9/>
<OBR.10/>
<OBR.11/>
<OBR.12/>
<OBR.13/>
<OBR.14/>
<OBR.15/>
<OBR.16/>
<OBR.17/>
<OBR.18/>
<OBR.19/>
<OBR.20/>
<OBR.21/>
<OBR.22/>
<OBR.23/>
<OBR.24>
<OBR.24.1>FamilyHistory</OBR.24.1>
</OBR.24>
<OBR.25/>
<OBR.26/>
</OBR>
<OBX>
<OBX.1>
<OBX.1.1>1</OBX.1.1>
</OBX.1>
<OBX.2/>
<OBX.3>
<OBX.3.1>Grandmother (unspecified)</OBX.3.1>
</OBX.3>
<OBX.4/>
<OBX.5>
<OBX.5.1>" diabetes</OBX.5.1>
</OBX.5>
<OBX.6/>
<OBX.7/>
</OBX>
</HL7Message>

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||||||||||||||||||||||| |||
OBR||||||||||||||||||||||||FamilyHistory||
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
  #2  
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
Default

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
  #3  
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
Default

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
Reply

Tags
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