No announcement yet.

Free Txt in fields mess up CSV to HL7 Conversion

  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Last edited by wahiawa; 08-24-2011, 01:30 PM. Reason: Fixed one error...

  • #2
    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, 01:26 PM.


    • #3
      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, 02:50 PM.