web stats
Editing Values in DICOM Structured Report - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 02-18-2015, 08:58 AM
csphu csphu is offline
What's HL7?
 
Join Date: Feb 2015
Posts: 3
csphu is on a distinguished road
Default Editing Values in DICOM Structured Report

I have been working on this project for a few weeks now, and I have made some pretty good progress... but now I am stuck! I have poured over the forums and watched as many Mirth Connect videos as I can find and still no dice... and that is why I finally humble myself and ask you all for some help.

In our PACS system, we map data from DICOM Structured Reports, that were generated on Philips Ultrasound machines (IU22), to our radiologist reports. I am trying to format a few specific values (Gestational Age based off of fetal measurements) so that when our PACS system inserts the mapped data into the Radiologists report it is consistent with other data displayed on exam images. Gestational Age values based off of fetal measurements, which are reported in "days" come over from the modality (Philips US) with trailing decimals, for example "104.237849d". We want these values to be rounded up to the nearest integer, "105d".

Although it took me a while, with the help of this forum I was able to figure out how edit DICOM SR values using JavaScript and Math.ceil() in the source transformer:

Code:
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][1]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A'] = Math.ceil(msg['tag0040A730']['item'][2]['tag0040A730']['item'][1]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A'].toString());
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][1]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@len']="10";
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][1]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@tag']="0040A30A";
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][1]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@vr']="DS";
Now the real issue: The values I am trying to edit are moving targets. There is no guarantee these values will be in the same location from report to report; it all depends on how the exam was performed by the Ultrasound Technologist (see PACS_ScreenShot.png). I have tried using if statements to check all possible locations, against a unique identifier found close by in the report, but I am finding there are just too many places where the data can wind up. Here is an example of my latest attempt:

Code:
try{
	if (msg['tag0040A730']['item'][2]['tag0040A730']['item'][1]['tag0040A730']['item'][2]['tag0040A730']['item']['tag0040A168']['item']['tag00080104'].toString() == "AC, Hadlock 1984" || "BPD, Hadlock 1984" || "FL, Hadlock 1984" || "HC, Hadlock 1984") {
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][1]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A'] = Math.ceil(msg['tag0040A730']['item'][2]['tag0040A730']['item'][1]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A'].toString());
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][1]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@len']="10";
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][1]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@tag']="0040A30A";
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][1]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@vr']="DS";
	}	
}
catch (e){
	//catch and just supress error
}
try{
	if (msg['tag0040A730']['item'][2]['tag0040A730']['item'][2]['tag0040A730']['item'][2]['tag0040A730']['item']['tag0040A168']['item']['tag00080104'].toString() == "AC, Hadlock 1984" || "BPD, Hadlock 1984" || "FL, Hadlock 1984" || "HC, Hadlock 1984") {
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][2]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A'] = Math.ceil(msg['tag0040A730']['item'][2]['tag0040A730']['item'][2]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A'].toString());
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][2]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@len']="10";
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][2]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@tag']="0040A30A";
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][2]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@vr']="DS";	
	}
}	
catch (e){
	//catch and just supress error
}
try{
	if (msg['tag0040A730']['item'][2]['tag0040A730']['item'][3]['tag0040A730']['item'][2]['tag0040A730']['item']['tag0040A168']['item']['tag00080104'].toString() == "AC, Hadlock 1984" || "BPD, Hadlock 1984" || "FL, Hadlock 1984" || "HC, Hadlock 1984") {
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][3]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A'] = Math.ceil(msg['tag0040A730']['item'][2]['tag0040A730']['item'][3]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A'].toString());
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][3]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@len']="10";
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][3]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@tag']="0040A30A";
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][3]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@vr']="DS";	
	}
}
catch (e){
	//catch and just supress error
}
try{
	if (msg['tag0040A730']['item'][2]['tag0040A730']['item'][4]['tag0040A730']['item'][2]['tag0040A730']['item']['tag0040A168']['item']['tag00080104'].toString() == "AC, Hadlock 1984" || "BPD, Hadlock 1984" || "FL, Hadlock 1984" || "HC, Hadlock 1984") {
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][4]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A'] = Math.ceil(msg['tag0040A730']['item'][2]['tag0040A730']['item'][4]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A'].toString());
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][4]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@len']="10";
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][4]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@tag']="0040A30A";
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][4]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@vr']="DS";	
	}
}
catch (e){
	//catch and just supress error
}
try{
	if (msg['tag0040A730']['item'][2]['tag0040A730']['item'][5]['tag0040A730']['item'][2]['tag0040A730']['item']['tag0040A168']['item']['tag00080104'].toString() == "AC, Hadlock 1984" || "BPD, Hadlock 1984" || "FL, Hadlock 1984" || "HC, Hadlock 1984") {
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][5]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A'] = Math.ceil(msg['tag0040A730']['item'][2]['tag0040A730']['item'][4]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A'].toString());
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][5]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@len']="10";
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][5]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@tag']="0040A30A";
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][5]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@vr']="DS";	
	}
}
catch (e){
	//catch and just supress error
}
try{
	if (msg['tag0040A730']['item'][2]['tag0040A730']['item'][6]['tag0040A730']['item'][2]['tag0040A730']['item']['tag0040A168']['item']['tag00080104'].toString() == "AC, Hadlock 1984" || "BPD, Hadlock 1984" || "FL, Hadlock 1984" || "HC, Hadlock 1984") {
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][6]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A'] = Math.ceil(msg['tag0040A730']['item'][2]['tag0040A730']['item'][4]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A'].toString());
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][6]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@len']="10";
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][6]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@tag']="0040A30A";
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][6]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@vr']="DS";	
	}
}
catch (e){
	//catch and just supress error
}
try{
	if (msg['tag0040A730']['item'][2]['tag0040A730']['item'][7]['tag0040A730']['item'][2]['tag0040A730']['item']['tag0040A168']['item']['tag00080104'].toString() == "AC, Hadlock 1984" || "BPD, Hadlock 1984" || "FL, Hadlock 1984" || "HC, Hadlock 1984") {
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][7]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A'] = Math.ceil(msg['tag0040A730']['item'][2]['tag0040A730']['item'][4]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A'].toString());
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][7]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@len']="10";
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][7]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@tag']="0040A30A";
		msg['tag0040A730']['item'][2]['tag0040A730']['item'][7]['tag0040A730']['item'][2]['tag0040A300']['item']['tag0040A30A']['@vr']="DS";	
	}
}
catch (e){
	//catch and just supress error
}
There has to be a better way. Is it possible to search the Structured Report for "Gestational Age" and return its msg location as a variable that can then be parsed and concatenated with it's corresponding value?

I'm not a JavaScript guru... any help would be greatly appreciated!
Attached Images
File Type: png PACS_ScreenShot.png (185.2 KB, 60 views)
Attached Files
File Type: xml UltrasoundCleanUpChannel.xml (178.3 KB, 64 views)
File Type: zip Structured Report Samples.zip (5.2 KB, 37 views)
__________________
Calvin Sphuler, R.T.(R)(CT)
PACS QC Specialist

Mirth Connect Server 3.1.1.7461

Last edited by csphu; 02-19-2015 at 06:32 AM.
Reply With Quote
  #2  
Old 02-19-2015, 06:36 AM
csphu csphu is offline
What's HL7?
 
Join Date: Feb 2015
Posts: 3
csphu is on a distinguished road
Default

I'm thinking I need to understand how to iterate over segments in a message.
__________________
Calvin Sphuler, R.T.(R)(CT)
PACS QC Specialist

Mirth Connect Server 3.1.1.7461
Reply With Quote
  #3  
Old 05-29-2015, 06:28 AM
hintham hintham is offline
Mirth Newb
 
Join Date: Mar 2010
Posts: 18
hintham is on a distinguished road
Default

Hi Calvin,

I'm facing a similar requirement, I need to convert a DICOM SR text report to HL7 ORU. My SR objects are sometimes repeating and even recursive/ I was wondering if and how you managed to address your problem? Perhaps it could help me as well.

Ron
Reply With Quote
Reply

Tags
dicom, javascript, pacs, structured report, ultrasound

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 12:29 PM.


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