web stats
Combining OBX lines into one AND inserting 80 character limit ~ tilde - Page 2 - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #11  
Old 10-09-2013, 12:29 PM
Jaypell22 Jaypell22 is offline
OBX.1 Kenobi
 
Join Date: Jul 2011
Location: Upstate NY
Posts: 33
Jaypell22 is on a distinguished road
Default

Yes Sry, should have thrown that out to you guys.

Code:
MSH|^~\&|HOSP||HOSP||201310091515||ORU^R01|201310091515341948794|P|2.3
PID|1|1234401834|1234401834||NAME^NAME^W||19600123|M||||||||||||
PV1|1||HOSPTAL|||||Blank|||||||||||||||||||||||||||||||||||||||||||||
ORC|RE
OBR|1||123456|VENOUS DOPPLER RIGHT LEG^VENOUS DOPPLER RIGHT LEG||201310091117|201310091117|||||||||Blank||||123456789456123456||201310091515||US|P|||||||123456^FIRST^LAST|||||
OBX|1|ST|||Referring Physician: DOC, MD||||||P||||||
OBX|2|ST|||||||||P||||||
OBX|3|ST|||Patient Name: PATIENT NAME||||||P||||||
OBX|4|ST|||||||||P||||||
OBX|5|ST|||History: LEG pain.||||||P||||||
OBX|6|ST|||||||||P||||||
OBX|7|ST|||Exam: Right lower extremity duplex venous doppler.||||||P||||||
OBX|8|ST|||||||||P||||||
OBX|9|ST|||Date of Service: 2013-10-09 14:21:26.0||||||P||||||
OBX|10|ST|||||||||P||||||
OBX|11|ST|||Technique: Gray scale and color Doppler sonographic images were obtained of the right lower extremity.||||||P||||||
OBX|12|ST|||||||||P||||||
OBX|13|ST|||Findings: FINDINGS HERE||||||P||||||
OBX|14|ST|||||||||P||||||
OBX|15|ST|||The contralateral left external iliac vein demonstrates normal color doppler flow.||||||P||||||
OBX|16|ST|||||||||P||||||
OBX|17|ST|||Impression: No evidence of DVT of the right lower extremity.||||||P||||||
OBX|18|ST|||||||||P||||||
OBX|19|ST|||||||||P||||||
OBX|20|ST|||||||||P||||||
OBX|21|ST|||THIS DOCUMENT HAS BEEN ELECTRONICALLY SIGNED||||||P||||||
OBX|22|ST|||||||||P||||||
OBX|23|ST|||DOC M.D.||||||P||||||
OBX|24|ST|||||||||P||||||
OBX|25|ST|||10/09/2013 15:14||||||P||||||
OBX|26|ST|||||||||P||||||
Reply With Quote
  #12  
Old 10-09-2013, 12:35 PM
sandersmr sandersmr is offline
OBX.2 Kenobi
 
Join Date: Feb 2013
Posts: 71
sandersmr is on a distinguished road
Default

Would there ever be a case of more than just OBX.5.1 being used?
Reply With Quote
  #13  
Old 10-09-2013, 12:45 PM
Jaypell22 Jaypell22 is offline
OBX.1 Kenobi
 
Join Date: Jul 2011
Location: Upstate NY
Posts: 33
Jaypell22 is on a distinguished road
Default

Never in the Raw message however I do insert various data in other fields per my code.
Reply With Quote
  #14  
Old 10-09-2013, 01:15 PM
sandersmr sandersmr is offline
OBX.2 Kenobi
 
Join Date: Feb 2013
Posts: 71
sandersmr is on a distinguished road
Default

If just working with OBX.5.1, this seems to work out. Fyi, "for each" also has no order guarantee.

Code:
var newOBX = <OBX/>;
newOBX['OBX.1']['OBX.1.1'] = '1';
newOBX['OBX.2']['OBX.2.1'] = 'FT';
newOBX['OBX.5'] = '';
var obxArray = new Array();
for each (obx in msg.OBX)
{
	for each (obx5 in obx['OBX.5']['OBX.5.1']) 
	{
		while(obx5.toString().length > 80)
		{
			var tmpOBX = obx5.toString().substring(0,80);
			var obxIndex = tmpOBX.lastIndexOf(' ');
			obxArray.push(tmpOBX.substring(0,obxIndex));
			obx5 = obx5.toString().substring(obxIndex,obx5.toString().length);
		}
		obxArray.push(obx5);
	}
}
var obx5Def = newOBX['OBX.5']; //get a default OBX.5 to get repeating segments working
for(i = 0; i < obxArray.length; i++)
{
	newOBX['OBX.5'][i] += obx5Def;
	newOBX['OBX.5'][i]['OBX.5.1'] = obxArray[i];
}

newOBX['OBX.14']['OBX.14.1'] = msg['OBR']['OBR.8']['OBR.8.1'].toString();
newOBX['OBX.16']['OBX.16.1'] = msg['OBR']['OBR.32']['OBR.32.1'];
newOBX['OBX.16']['OBX.16.2'] = msg['OBR']['OBR.32']['OBR.32.2'];
newOBX['OBX.16']['OBX.16.3'] = msg['OBR']['OBR.32']['OBR.32.3'];
msg.OBX = newOBX;
Reply With Quote
  #15  
Old 10-10-2013, 06:57 AM
Jaypell22 Jaypell22 is offline
OBX.1 Kenobi
 
Join Date: Jul 2011
Location: Upstate NY
Posts: 33
Jaypell22 is on a distinguished road
Default

Implemented new code and everything looks good except for the additional ~'s needed where line breaks are. My original code put in ~ for each line break. The first result below is the latest results with the newest code. It is long but wanted to show all of the ~'s. The second result is what I was getting prior to the changes, you can see the multiple ~~~ however that lacks the 80 character ~'s.

If I could add the ~'s every 80 characters AFTER the old code does its thing that would be perfect!


NEW CODE RESULTS:
OBX|1|FT|||Referring Physician: ME, MD~Patient Name: John Doe~Final report~EXAM: FLUOROSCOPIC GUIDED TUNNELED DIALYSIS CATHETER EXCHANGE AND CENTRAL~ VENOUS ANGIOPLASTY .~IMAGES: 12~EXAM DATE AND TIME: 2013-10-09 10:18:18.0~REASON FOR EXAM: Poorly functioning left subclavian tunneled dialysis catheter.~COMPARISON: None.~OPERATOR: dr. me operator, MD~REFERRING PHYSICIAN: Dr. Me ~PREPROCEDURE DIAGNOSIS: Poorly functioning tunneled hemodialysis catheter.~POST PROCEDURE DIAGNOSIS: Same. Central venous stenosis.~ANESTHESIA: ~Moderate sedation with Anesthesiology.~Local anesthesia with 10 mL of 1% lidocaine.~PROCEDURES:~1. Fluoroscopic-guided exchange of tunneled central venous catheter.~2. Venous angioplasty of central venous stenosis.~PROCEDURE IN DETAIL:~After an explanation of the procedure including risks and benefits, written~ informed consent was obtained.~The patient was premedicated with 25 mg of Benadryl IV because of history of~ hives with IV contrast.~The patient was placed supine on the angiographic table and the indwelling left~ subclavian tunneled dialysis catheter and the area around it were cleaned and~ draped in usual sterile fashion. Propofol anesthesia was given by the Nurse~ Anesthetist via the indwelling catheter because of the lack of peripheral IV~ access. Generous local anesthesia was instilled at the exit site of the~ catheter and around the cuff using 1% lidocaine local anesthesia. The cuff was~ freed using blunt dissection techniques. Contrast injection via both ports of~ the catheter showed no fibrin sheath. A 0.035 inch Bentson guidewire and a~ 0.035 inch angled Glidewire was then advanced via both ports and the tips~ manipulated into the IVC under fluoroscopic guidance. The catheter was then~ pulled back until the tip was in the left subclavian vein. A central venogram~ was then performed which showed high-grade stenosis of the brachiocephalic~ vein and SVC to the size of the catheter. A 12 mm high-pressure Conquest~ balloon was then used to perform angioplasty of the stenosed segment of vein~ with improvement and collateral circulation noted on followup venogram.~A new 23 cm tip to cuff Equistream tunneled dialysis catheter was then advanced~ via the guidewire until the tip was in the right atrium under fluoroscopic~ guidance.~Flow parameters with a 10 cc syringe were excellent. Hemostasis was ensured.~ The catheter was then secured to the skin using 2/0 Prolene sutures and a dry~ dressing was then placed over the catheter.~The patient tolerated the procedure well without immediate complications and~ was transferred from the angiography suite in stable condition.~EBL: Minimal. 2 mL.~CONTRAST: 18 mL of Visipaque 320 intravenous contrast.~RADIATION TIME/DOSE: 3.3 min; 84 mGy~IMPRESSION~Fluoroscopic guided Left subclavian vein tunneled dialysis catheter exchange as~ above.~Angioplasty of central venous stenosis as above.~The catheter may be used now for dialysis. ~CPT CODES: 33586581, 7237001, 3522475 and 7597228.~THIS DOCUMENT HAS BEEN ELECTRONICALLY SIGNED~Mr Doctor, MD.~10/09/2013 16:32~|||||||||201310091635||123456^TEST^DOC

OLD CODE RESULTS:

OBX|1|FT|||Referring Physician: ME, MD~~Patient Name: John Doe~~final report~~EXAM: FLUOROSCOPIC GUIDED TUNNELED DIALYSIS CATHETER EXCHANGE AND CENTRAL VENOUS ANGIOPLASTY .~~IMAGES: 12~~EXAM DATE AND TIME: 2013-10-09 10:18:18.0~~REASON FOR EXAM: Poorly functioning left subclavian tunneled dialysis catheter.~~COMPARISON: None.~~OPERATOR: Dr. me operator, MD~~REFERRING PHYSICIAN: Dr. Me~~PREPROCEDURE DIAGNOSIS: Poorly functioning tunneled hemodialysis catheter.~~POST PROCEDURE DIAGNOSIS: Same. Central venous stenosis.~~ANESTHESIA: ~Moderate sedation with Anesthesiology.~Local anesthesia with 10 mL of 1% lidocaine.~~PROCEDURES:~1. Fluoroscopic-guided exchange of tunneled central venous catheter.~2. Venous angioplasty of central venous stenosis.~~PROCEDURE IN DETAIL:~After an explanation of the procedure including risks and benefits, written informed consent was obtained.~~The patient was premedicated with 25 mg of Benadryl IV because of history of hives with IV contrast.~~The patient was placed supine on the angiographic table and the indwelling left subclavian tunneled dialysis catheter and the area around it were cleaned and draped in usual sterile fashion. Propofol anesthesia was given by the Nurse Anesthetist via the indwelling catheter because of the lack of peripheral IV access. Generous local anesthesia was instilled at the exit site of the catheter and around the cuff using 1% lidocaine local anesthesia. The cuff was freed using blunt dissection techniques. Contrast injection via both ports of the catheter showed no fibrin sheath. A 0.035 inch Bentson guidewire and a 0.035 inch angled Glidewire was then advanced via both ports and the tips manipulated into the IVC under fluoroscopic guidance. The catheter was then pulled back until the tip was in the left subclavian vein. A central venogram was then performed which showed high-grade stenosis of the brachiocephalic vein and SVC to the size of the catheter. A 12 mm high-pressure Conquest balloon was then used to perform angioplasty of the stenosed segment of vein with improvement and collateral circulation noted on followup venogram.~~A new 23 cm tip to cuff Equistream tunneled dialysis catheter was then advanced via the guidewire until the tip was in the right atrium under fluoroscopic guidance.~~Flow parameters with a 10 cc syringe were excellent. Hemostasis was ensured. The catheter was then secured to the skin using 2/0 Prolene sutures and a dry dressing was then placed over the catheter.~~The patient tolerated the procedure well without immediate complications and was transferred from the angiography suite in stable condition.~~EBL: Minimal. 2 mL.~~CONTRAST: 18 mL of Visipaque 320 intravenous contrast.~~RADIATION TIME/DOSE: 3.3 min; 84 mGy~~IMPRESSION~Fluoroscopic guided Left subclavian vein tunneled dialysis catheter exchange as above.~~Angioplasty of central venous stenosis as above.~~The catheter may be used now for dialysis. ~~CPT CODES: 3655512481, 77052301, 35147425 and 754591278.~~~~THIS DOCUMENT HAS BEEN ELECTRONICALLY SIGNED~~Mr. Doctor, MD.~~10/09/2013 16:32~|||||||||201310091635||123456^TEST^DOC

Last edited by Jaypell22; 10-10-2013 at 09:20 AM.
Reply With Quote
  #16  
Old 10-10-2013, 07:14 AM
sandersmr sandersmr is offline
OBX.2 Kenobi
 
Join Date: Feb 2013
Posts: 71
sandersmr is on a distinguished road
Default

It's the for each. Replacing with for...

Code:
for (var i = 0; i < msg.OBX.length(); i++)
{
	var obx = msg.OBX[i];
	for(var j = 0; j < obx['OBX.5'].length(); j++)
	{
		var obx5 = obx['OBX.5'][j]['OBX.5.1'];
		while(obx5.toString().length > 80)
		{
			var tmpOBX = obx5.toString().substring(0,80);
			var obxIndex = tmpOBX.lastIndexOf(' ');
			obxArray.push(tmpOBX.substring(0,obxIndex));
			obx5 = obx5.toString().substring(obxIndex,obx5.toString().length);
		}
		obxArray.push(obx5.toString());
	}
}
Reply With Quote
  #17  
Old 10-10-2013, 09:18 AM
Jaypell22 Jaypell22 is offline
OBX.1 Kenobi
 
Join Date: Jul 2011
Location: Upstate NY
Posts: 33
Jaypell22 is on a distinguished road
Default

Looks Fantastic! Thank you for staying with me on this. I only have one item to confirm. It looks like it avoids adding a ~ if there is already one present within 80 characters. Is this the case? That was my only concern as I didn't want to add any extra lines to the report. It certainly looks like it avoids that though as it doesn't just add every 80 characters, it adds ONLY if there hasn't been a ~ for 80 characters.


OBX|1|FT|||Referring Physician: Ref doc, MD~~Patient Name: pt name~~report~~EXAM: FLUOROSCOPIC GUIDED TUNNELED DIALYSIS CATHETER EXCHANGE AND CENTRAL~ VENOUS ANGIOPLASTY .~~IMAGES: 12~~EXAM DATE AND TIME: 2013-10-09 10:18:18.0~~REASON FOR EXAM: Poorly functioning left subclavian tunneled dialysis catheter.~~COMPARISON: None.~~OPERATOR: operator, MD~~REFERRING PHYSICIAN: Dr. me.~~PREPROCEDURE DIAGNOSIS: Poorly functioning tunneled hemodialysis catheter.~~POST PROCEDURE DIAGNOSIS: Same. Central venous stenosis.~~ANESTHESIA: ~Moderate sedation with Anesthesiology.~Local anesthesia with 10 mL of 1% lidocaine.~~PROCEDURES:~1. Fluoroscopic-guided exchange of tunneled central venous catheter.~2. Venous angioplasty of central venous stenosis.~~PROCEDURE IN DETAIL:~After an explanation of the procedure including risks and benefits, written~ informed consent was obtained.~~The patient was premedicated with 25 mg of Benadryl IV because of history of~ hives with IV contrast.~~The patient was placed supine on the angiographic table and the indwelling left~ subclavian tunneled dialysis catheter and the area around it were cleaned and~ draped in usual sterile fashion. Propofol anesthesia was given by the Nurse~ Anesthetist via the indwelling catheter because of the lack of peripheral IV~ access. Generous local anesthesia was instilled at the exit site of the~ catheter and around the cuff using 1% lidocaine local anesthesia. The cuff was~ freed using blunt dissection techniques. Contrast injection via both ports of~ the catheter showed no fibrin sheath. A 0.035 inch Bentson guidewire and a~ 0.035 inch angled Glidewire was then advanced via both ports and the tips~ manipulated into the IVC under fluoroscopic guidance. The catheter was then~ pulled back until the tip was in the left subclavian vein. A central venogram~ was then performed which showed high-grade stenosis of the brachiocephalic~ vein and SVC to the size of the catheter. A 12 mm high-pressure Conquest~ balloon was then used to perform angioplasty of the stenosed segment of vein~ with improvement and collateral circulation noted on followup venogram.~~A new 23 cm tip to cuff Equistream tunneled dialysis catheter was then advanced~ via the guidewire until the tip was in the right atrium under fluoroscopic~ guidance.~~Flow parameters with a 10 cc syringe were excellent. Hemostasis was ensured.~ The catheter was then secured to the skin using 2/0 Prolene sutures and a dry~ dressing was then placed over the catheter.~~The patient tolerated the procedure well without immediate complications and~ was transferred from the angiography suite in stable condition.~~EBL: Minimal. 2 mL.~~CONTRAST: 18 mL of Visipaque 320 intravenous contrast.~~RADIATION TIME/DOSE: 3.3 min; 84 mGy~~IMPRESSION~Fluoroscopic guided Left subclavian vein tunneled dialysis catheter exchange as~ above.~~Angioplasty of central venous stenosis as above.~~The catheter may be used now for dialysis. ~~CPT CODES: 36581, 77001, 35475 and 75978.~~~~THIS DOCUMENT HAS BEEN ELECTRONICALLY SIGNED~~Dr. me, MD.~~10/09/2013 16:32~~|||||||||201310091635||123456^NAME^TEST
Reply With Quote
  #18  
Old 10-10-2013, 10:37 AM
sandersmr sandersmr is offline
OBX.2 Kenobi
 
Join Date: Feb 2013
Posts: 71
sandersmr is on a distinguished road
Default

If you want it to only split every 80 characters since a ~ appeared, I suggest turning on "Parse Field Repetitions" for the message (so if you're doing this transformation on the destination, set that on the Source Outbound properties). A quick test seemed to show that working.
Reply With Quote
Reply

Tags
character limit, combine, insert character, insert tilde ~, obx

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 02:12 AM.


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