Announcement

Collapse
No announcement yet.

Convert OBX (Physician Notes in plain text) Segments to CSV file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Convert OBX (Physician Notes in plain text) Segments to CSV file

    We are receiving physician dictated transcriptions in multiple obx segments and I need to export them out to a .csv file so it can be imported into another system. I believe everything is within the OBX segment, so we won't need to get data from any of the other segments, but would like to know how to append those if need be just in case. Can someone please help me with the best way for achieving that?

    Here's an example of a real transcription we receive (everything changed obviously so nothing is real about the patient, but the formatting, etc., is the same - you can see there are also issues with where the vendor is putting some information - OBR32 for instance is supposed to be a date/time of procedure but is a physician ID & name - thank goodness for Mirth!!):

    MSH|^~\&|OUT_FEED|Hospital Name|||2011010180259||ORU^MR|2011010108025988|P|2. 3|||
    PID|1||123456|123456|LNAME^FNAME^MI||DOB|F||H|ADDR |COUNTY|PHONENUM^^^^^PHONENUM|0000000000||M|REL|AC CTNUM|SSN|||ETHNIC|BIRTHPLACE|||||NAT||N
    NK1|1|^^||^^^^|^^^^^|||||||||||||||||||||||||^^^
    PV1|1|2^O/P^00|050^083^1|N||0001|000123^LNAME^FNAME^|000555^ LNAME^FNAME^MI|000222^LNAME^FNAME^MI|01||||01||||| |XXX||||||||||||||||H||||||||201101021234|20110102 1234|| 0000.00|||00005555
    PV2|1|19|SOMETHING I SOMEWHERE||||U|20110101000000||||||||||||||||||201 10101000000|X
    AL1|1|DRUG|00000292^DRUG1
    AL1|2|DRUG|00000509^DRUG2
    AL1|3|DRUG|00000521^DRUG3
    AL1|4|DRUG|00001066^DRUG4
    AL1|5||99992001^ALLERGY CODE - OTHER - Other check allergy
    DG1|1||33333|MILD SOMETHING OF SOMETHING||A
    DG1|2||33333|MILD SOMETHING OF SOMETHING||P
    DG1|3||33333|SOMETHING UNSPEC WO SOMETHING OF|S
    DG1|4||444|SOME KIND OF DISORDER NEC||S
    DG1|5||5555|TOBACCO USE DISORDER||S
    DG1|6||6666|ASTHMA, UNSPECIFIED||S
    DG1|7||7777|PRESENCE OF SOMETHING||S
    GT1|1||||^^^^|^^^^^|||||||||||^^^^||||||||||||
    ORC||||||||||||^^^||||
    OBR||ORDERNUM1|ORDERNUM2|^|||||||||~~~||^^^|^^^||0 8||||200000000000||EOP|P||^^^20000000000000^^|0001 23~000456||||000123^LNAME^FNAME^|||OP NAME|||||||||
    OBX|1|TX|08^ESIGN OPERATIVE REPORT||||||||P|||20000000000000||
    OBX|2|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||
    OBX|3|TX|08^ESIGN OPERATIVE REPORT|| __________________________________________________ _______________||||||P|||20000000000000||
    OBX|4|TX|08^ESIGN OPERATIVE REPORT|| _____||||||P|||20000000000000||
    OBX|5|TX|08^ESIGN OPERATIVE REPORT|| General Hospital||||||P|||20000000000000||
    OBX|6|TX|08^ESIGN OPERATIVE REPORT|| Hosp Address||||||P|||20000000000000||
    OBX|7|TX|08^ESIGN OPERATIVE REPORT|| Hosp City, State, Zip||||||P|||20000000000000||
    OBX|8|TX|08^ESIGN OPERATIVE REPORT|| NAME: LANEM, FNAME K||||||P|||20000000000000||
    OBX|9|TX|08^ESIGN OPERATIVE REPORT|| MR #: 123456||||||P|||20000000000000||
    OBX|10|TX|08^ESIGN OPERATIVE REPORT|| ACCT #: 000888888||||||P|||20000000000000||
    OBX|11|TX|08^ESIGN OPERATIVE REPORT|| PHYSICIAN: FNAME LNAME, MD||||||P|||20000000000000||
    OBX|12|TX|08^ESIGN OPERATIVE REPORT|| Page 1 of 2 ROOM:||||||P|||20000000000000||
    OBX|13|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||
    OBX|14|TX|08^ESIGN OPERATIVE REPORT|| PROCEDURE/OPERATIVE REPORT||||||P|||20000000000000||
    OBX|15|TX|08^ESIGN OPERATIVE REPORT|| DATE OF PROCEDURE/OPERATION: 06/19/2009||||||P|||20000000000000||
    OBX|16|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||
    OBX|17|TX|08^ESIGN OPERATIVE REPORT|| PREOPERATIVE DIAGNOSES:||||||P|||20000000000000||
    OBX|18|TX|08^ESIGN OPERATIVE REPORT|| 1. BLAH with positive BLAH.||||||P|||20000000000000||
    OBX|19|TX|08^ESIGN OPERATIVE REPORT|| 2. Blah in place.||||||P|||20000000000000||
    OBX|20|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||
    OBX|21|TX|08^ESIGN OPERATIVE REPORT|| POSTOPERATIVE DIAGNOSES:||||||P|||20000000000000||
    OBX|22|TX|08^ESIGN OPERATIVE REPORT|| 1. BLAH with positive BLAH.||||||P|||20000000000000||
    OBX|23|TX|08^ESIGN OPERATIVE REPORT|| 2. Blah device in place.||||||P|||20000000000000||
    OBX|24|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||
    OBX|25|TX|08^ESIGN OPERATIVE REPORT|| PROCEDURE/OPERATION:||||||P|||20000000000000||
    OBX|26|TX|08^ESIGN OPERATIVE REPORT|| 1. BLAHHH.||||||P|||20000000000000||
    OBX|27|TX|08^ESIGN OPERATIVE REPORT|| 2. Blahhh block.||||||P|||20000000000000||
    OBX|28|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||
    OBX|29|TX|08^ESIGN OPERATIVE REPORT|| SURGEON: FNAME LNAME, MD.||||||P|||20000000000000||
    OBX|30|TX|08^ESIGN OPERATIVE REPORT|| ASSISTANT: NONE.||||||P|||20000000000000||
    OBX|31|TX|08^ESIGN OPERATIVE REPORT|| ANESTHETIST: FNAME LASTNAME, MD.||||||P|||20000000000000||
    OBX|32|TX|08^ESIGN OPERATIVE REPORT|| ANESTHESIA: SEDATION.||||||P|||20000000000000||
    OBX|33|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||
    OBX|34|TX|08^ESIGN OPERATIVE REPORT|| INDICATION FOR PROCEDURE: Patient is a xx-year-old,||||||P|||20000000000000||
    OBX|35|TX|08^ESIGN OPERATIVE REPORT|| para 3 admitted for Blah Blah. Her blah blah blah blah blah blah||||||P|||20000000000000||
    OBX|36|TX|08^ESIGN OPERATIVE REPORT|| 01/01/2011. She had an abnormal blah blah blah blah blah blah-||||||P|||20000000000000||
    OBX|37|TX|08^ESIGN OPERATIVE REPORT|| blah blah blah blah blah blah. She is||||||P|||20000000000000||
    OBX|38|TX|08^ESIGN OPERATIVE REPORT|| admitted for procedure. A full preoperative consultation was||||||P|||20000000000000||
    OBX|39|TX|08^ESIGN OPERATIVE REPORT|| held with the patient regarding risks and alternatives and||||||P|||20000000000000||
    OBX|40|TX|08^ESIGN OPERATIVE REPORT|| consent was obtained. Preoperative labs were noted to be normal.||||||P|||20000000000000||
    OBX|41|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||
    OBX|42|TX|08^ESIGN OPERATIVE REPORT|| DESCRIPTION OF PROCEDURE: Patient was taken to operating room||||||P|||20000000000000||
    OBX|43|TX|08^ESIGN OPERATIVE REPORT|| where she was blah blah blah blah blah blah blah blah blah blah blah blah||||||P|||20000000000000||
    OBX|44|TX|08^ESIGN OPERATIVE REPORT|| blah blah blah blah blah blah. She was under sedation with Dr. Lname.||||||P|||20000000000000||
    OBX|45|TX|08^ESIGN OPERATIVE REPORT|| She was blah blah blah blah blah blah blah blah blah blah blah blah. A blah||||||P|||20000000000000||
    OBX|46|TX|08^ESIGN OPERATIVE REPORT|| blah blah blah blah blah blah blah blah blah blah blah blah; 0.25%||||||P|||20000000000000||
    OBX|47|TX|08^ESIGN OPERATIVE REPORT|| blah blah blah blah blah blah with blah blah blah blah blah blahwas achieved||||||P|||20000000000000||
    OBX|48|TX|08^ESIGN OPERATIVE REPORT|| without difficulty. The blah blah blah blah blah blah string was noted. The blah blah blah blah blah blah||||||P|||20000000000000||
    OBX|49|TX|08^ESIGN OPERATIVE REPORT|| consisted of blah blah blah blah blah blah. Careful||||||P|||20000000000000||
    OBX|50|TX|08^ESIGN OPERATIVE REPORT|| attention was paid to blah blah blah blah blah blah||||||P|||20000000000000||
    OBX|51|TX|08^ESIGN OPERATIVE REPORT|| blah blah blah blah blah blah. Blah blah blah blah blah blah||||||P|||20000000000000||
    OBX|52|TX|08^ESIGN OPERATIVE REPORT|| evaluation. The blah blah blah blah blah blah. A||||||P|||20000000000000||
    OBX|53|TX|08^ESIGN OPERATIVE REPORT|| blah blah blah blah blah blah blah blah blah blah blah blah||||||P|||20000000000000||
    OBX|54|TX|08^ESIGN OPERATIVE REPORT|| blah blah blah blah blah blah blah blah blah blah blah blah.||||||P|||20000000000000||
    OBX|55|TX|08^ESIGN OPERATIVE REPORT|| Blah blah blah blah blah blah blah blah. Patient was||||||P|||20000000000000||
    OBX|56|TX|08^ESIGN OPERATIVE REPORT|| blah blah blah blah blah blah blah blah blah blah blah blah||||||P|||20000000000000||
    OBX|57|TX|08^ESIGN OPERATIVE REPORT|| Care Unit in stable condition.||||||P|||20000000000000||
    OBX|58|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||
    OBX|59|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||
    OBX|60|TX|08^ESIGN OPERATIVE REPORT|| ESTIMATED BLAH BLAH: Less than XX mL.||||||P|||20000000000000||
    OBX|61|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||
    OBX|62|TX|08^ESIGN OPERATIVE REPORT|| DRAINS: IV fluid.||||||P|||20000000000000||
    OBX|63|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||
    OBX|64|TX|08^ESIGN OPERATIVE REPORT|| DISPOSITION: She was blah blah blah blah blah blah blah blah blah blah blah blah in blah||||||P|||20000000000000||
    OBX|65|TX|08^ESIGN OPERATIVE REPORT|| condition.||||||P|||20000000000000||
    OBX|66|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||
    OBX|67|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||
    OBX|68|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||
    OBX|69|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||
    OBX|70|TX|08^ESIGN OPERATIVE REPORT|| Electronically Signed by: DCTNAME||||||P|||20000000000000||
    OBX|71|TX|08^ESIGN OPERATIVE REPORT|| SIGNDATE||||||P|||20000000000000||
    OBX|72|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||
    OBX|73|TX|08^ESIGN OPERATIVE REPORT|| Dictated: 01/01/2011 11:22||||||P|||20000000000000||
    OBX|74|TX|08^ESIGN OPERATIVE REPORT|| 99999999 Transcribed: 01/01/2011 15:01||||||P|||20000000000000||
    OBX|75|TX|08^ESIGN OPERATIVE REPORT|| Job #: 12782||||||P|||20000000000000||
    OBX|76|TX|08^ESIGN OPERATIVE REPORT|| SSI File#: 00012313123132313223||||||P|||20000000000000||
    OBX|77|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||
    OBX|78|TX|08^ESIGN OPERATIVE REPORT|| Copy For:||||||P|||20000000000000||
    OBX|79|TX|08^ESIGN OPERATIVE REPORT|| ||||||P|||20000000000000||

    Although I've done javascript, it was years ago. I am new to Mirth and am brushing up on my javascript, but am running into deadlines that are limiting my time. Any help is greatly appreciated
    Last edited by wahiawa; 06-20-2011, 12:44 PM.

  • #2
    Can u provide an example of the CSV file....and do you want one HL7 record per file or multiple HL7 records per CSV file...

    Comment


    • #3
      I suddenly want to write an HL7 message anonymizer tool that puts "Some kind of...." and "Something" in for all the demographics and "blah" all through the report.

      Comment


      • #4
        Thanks!

        We ended up not having to do that (fortunately), but I could see how it might be requested in the future so would still be good to know how to do it. And using that same example we are going to need to parse out some of those OBX segments such as FAMILY HISTORY, SOCIAL HISTORY, etc., where the hospital does not send that in any fields other than the transcribed progress reports. If anyone knows how to do that already Thanks for the offer of help and yes, "Echinos" write one of those! lol -MMM

        Comment


        • #5
          var csv='';
          foreach(var seg in msg..OBX) {
          csv+=seg['OBX.3']['OBX.3.1'].toString() + ',' + seg['OBX.3']['OBX.3.2'].toString() + ',' + seg['OBX.5']['OBX.5.1'].toString() + "\n";
          }

          FileUtil.write(path,csv);

          Comment

          Working...
          X