<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Technology Bits and Bytes &#187; HL7</title>
	<atom:link href="http://blogs.circlesource.com/category/hl7/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.circlesource.com</link>
	<description>CircleSource Technical Talent ShowCase</description>
	<lastBuildDate>Thu, 10 Dec 2009 20:01:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mirth on Windows Server 2008 and SQL server 2008</title>
		<link>http://blogs.circlesource.com/2009/12/11/mirth-on-windows-server-2008-and-sql-server-2008/</link>
		<comments>http://blogs.circlesource.com/2009/12/11/mirth-on-windows-server-2008-and-sql-server-2008/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 20:01:18 +0000</pubDate>
		<dc:creator>maqbool</dc:creator>
				<category><![CDATA[HL7]]></category>
		<category><![CDATA[Mirth]]></category>
		<category><![CDATA[healthcare]]></category>

		<guid isPermaLink="false">http://blogs.circlesource.com/?p=473</guid>
		<description><![CDATA[If you are in HL7 business and have not looked at Mirth, you must. Kudos to the Mirth team, they have brought out a phenominal product. More I use it more I get amazed with its capabilities. In one of my recent project I had to install Mirth on a brand new Windows server 2008 [...]]]></description>
			<content:encoded><![CDATA[<p>If you are in HL7 business and have not looked at <a href="http://www.mirthcorp.com/">Mirth</a>, you must. Kudos to the Mirth team, they have brought out a phenominal product. More I use it more I get amazed with its capabilities. In one of my recent project I had to install Mirth on a brand new Windows server 2008 running SQL Server 2008. I had not done this kind of implementation earlier and was skeptical as to how it will work. My previous installations on Windows and Linux boxes used MySQL as the internal datbase, this one was different, I had to use SQL Server 2008 for internal database. But it is quite simple, here are the steps:</p>
<p>1. Edit &#8220;C:\Program Files (x86)\Mirth\conf\mirth.properties&#8221;  and make sure the database property is set to sqlserver2005</p>
<p>database=sqlserver2005</p>
<p>2. Login to SQL Server management studio and create an database called &#8220;mirthdb&#8221;</p>
<p>3. Inside SQL Server Management Studio, execute the script  &#8220;C:\Program Files (x86)\Mirth\sqlserver2005-database.sql&#8221; which creates all the necessary tables within mirthdb database.</p>
<p>4. Create an account called &#8220;mirthdb&#8221; and grant necessary priviledges to this account for mirthdb database.</p>
<p>5.  Edit &#8220;C:\Program Files (x86)\Mirth\conf\sqlserver2005-SqlMapConfig.properties&#8221; and add the username and password for the SQL Server user created above.</p>
<p>Thats it, restart the Mirth servcie and login to Mirth. It is as simple as that.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.circlesource.com/2009/12/11/mirth-on-windows-server-2008-and-sql-server-2008/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to parse multiple OBX segments in Mirth</title>
		<link>http://blogs.circlesource.com/2009/10/25/how-to-parse-multiple-obx-segments-in-mirth/</link>
		<comments>http://blogs.circlesource.com/2009/10/25/how-to-parse-multiple-obx-segments-in-mirth/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 01:45:05 +0000</pubDate>
		<dc:creator>maqbool</dc:creator>
				<category><![CDATA[HL7]]></category>
		<category><![CDATA[Mirth]]></category>
		<category><![CDATA[healthcare]]></category>

		<guid isPermaLink="false">http://blogs.circlesource.com/?p=466</guid>
		<description><![CDATA[Often there is a need to parse segments that occur multiple time in an HL7 message like OBX or Ali segments. For example, in an ADT message you will get height and weight in two OBX segments. How do you parse these multiple OBX segments and make the available to the channel map? I am [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="line-height: 10.2pt; margin: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><span style="font-family: &quot;Georgia&quot;,&quot;serif&quot;; color: black; font-size: 7pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">Often there is a need to parse segments that occur multiple time in an HL7 message like OBX or Ali segments. For example, in an ADT message you will get height and weight in two OBX segments. How do you parse these multiple OBX segments and make the available to the channel map? I am going to show you how to parse multiple OBX segments in an ADT message and populate variables in to a channel map so they are accessible for further manipulation in the destination connector&#8230;.</span></p>
<p class="MsoNormal" style="line-height: 10.2pt; margin: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><span style="font-family: &quot;Georgia&quot;,&quot;serif&quot;; color: black; font-size: 7pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">For brevity sake I am just going to showing the OBX segments that I am going to parse here instead of the whole message. The following two OBX segments are present in my message:</span></p>
<p class="MsoNormal" style="line-height: 10.2pt; margin: 0in 0in 0pt;"><span style="font-family: &quot;Courier New&quot;; color: black; font-size: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt;">OBX|1|ST|HT^PATIENT HEIGHT||142.9</span><span style="font-family: &quot;Times New Roman&quot;,&quot;serif&quot;; color: black; font-size: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt;"></span></p>
<p class="MsoNormal" style="line-height: 10.2pt; margin: 0in 0in 0pt;"><span style="font-family: &quot;Courier New&quot;; color: black; font-size: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt;">OBX|2|ST|WT^PATIENT WEIGHT||45.2</span><span style="font-family: &quot;Times New Roman&quot;,&quot;serif&quot;; color: black; font-size: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt;"></span></p>
<p class="MsoNormal" style="line-height: 10.2pt; margin: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><span style="font-family: &quot;Georgia&quot;,&quot;serif&quot;; color: black; font-size: 7pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">I want to create three variables, one to hold the height, one to hold the weight and one to hold the number of segments we parsed.</span></p>
<p class="MsoNormal" style="line-height: 10.2pt; margin: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><span style="font-family: &quot;Georgia&quot;,&quot;serif&quot;; color: black; font-size: 7pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">The first step is to create the channel. I am assuming here you already know how to create a channel. For my channel l have my source as a file reader and a database reader as the destination. I create a transformer for the destination. In the transformer, I paste my sample message in the template section and create a step with step being &#8220;Javascript&#8221;. Then I type the following script as my Java script:</span></p>
<p class="MsoNormal" style="line-height: 10.2pt; margin: 0in 0in 0pt;"><span style="font-family: &quot;Courier New&quot;; color: black; font-size: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt;">var i=0;<br />
for each (seg in msg..OBX)<br />
{<br />
 <span style="mso-tab-count: 1;">      </span>i++;<br />
 <span style="mso-tab-count: 1;">      </span>var key = seg['OBX.3']['OBX.3.2'].toString()<br />
 <span style="mso-tab-count: 1;">      </span>var obx_val = seg['OBX.5']['OBX.5.1'].toString() ;<br />
 <span style="mso-tab-count: 1;">      </span>if(key.search(/HEIGHT/) != -1)channelMap.put(&#8216;HEIGHT&#8217;, obx_val);<br />
 <span style="mso-tab-count: 1;">      </span>if(key.search(/WEIGHT/) != -1)channelMap.put(&#8216;WEIGHT&#8217;, obx_val);<br />
}<br />
channelMap.put(&#8220;obx_seg_count&#8221;, i);</span></p>
<p class="MsoNormal" style="line-height: 10.2pt; margin: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><span style="font-family: &quot;Georgia&quot;,&quot;serif&quot;; color: black; font-size: 7pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> This script creates three variables, HEIGHT, WEIGHT and &#8220;obx_seg_count&#8221; that are now available to us in the destination for inserting in to a data base as follows.</span></p>
<p class="MsoNormal" style="line-height: 10.2pt; margin: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><span style="font-family: &quot;Georgia&quot;,&quot;serif&quot;; color: black; font-size: 7pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> Assuming I have a table called ‘OBX’ and columns called ‘ht’ and ‘wt’, I insert the values in to the table as follows in the detonation tab&#8230;.</span></p>
<p class="MsoNormal" style="line-height: 10.2pt; margin: 0in 0in 0pt;"><span style="font-family: &quot;Courier New&quot;; color: black; font-size: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt;">expression = &#8220;insert into OBX (ht, wt ) values (&#8216;&#8221; + $(&#8216;HEIGHT&#8217;) + &#8220;&#8216; , &#8216;&#8221; + $(&#8216;WEIGHT&#8217;) + &#8220;&#8216;)&#8221;;<br />
var result = dbConn.executeUpdate(expression);</span></p>
<p class="MsoNormal" style="line-height: 10.2pt; margin: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><span style="font-family: &quot;Georgia&quot;,&quot;serif&quot;; color: black; font-size: 7pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">The trick in this is the for each loop above. The expression in the parenthesis is simple XML E4X expression (see <a href="https://wso2.org/project/mashup/0.2/docs/e4xquickstart.html"><span style="color: black; text-decoration: none; text-underline: none;">https://wso2.org/project/mashup/0.2/docs/e4xquickstart.html</span></a> for more details). The other concept to grasp here is to note that the incoming message is available as ‘msg’ object and is just a XML object. Knowing this we can traverse the XML object with E4X and find the elements we are interested in which are OBX elements. The other concept to understand is the ‘maps’ in the Mirth. You need to populate the ‘channel map’ so those variable you create are available throughout your channel. </span></p>
<p class="MsoNormal" style="line-height: 10.2pt; margin: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><span style="font-family: &quot;Georgia&quot;,&quot;serif&quot;; color: black; font-size: 7pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">If you have unknown number of OBX segments in a message, like in a ORU message where you get a report, you can do two things, we can either loop through the way I did up here and concatenate each OBX segment to create on variable called ‘report’ with &lt;cr&gt; at the end and put that in to channel map. Or you could create several variables like following….</span></p>
<p class="MsoNormal" style="line-height: 10.2pt; margin: 0in 0in 0pt;"><span style="font-family: &quot;Courier New&quot;; color: black; font-size: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt;">var i=0;<br />
for each (seg in msg..OBX)<br />
{<br />
 <span style="mso-tab-count: 1;">      </span>i++;<br />
 <span style="mso-tab-count: 1;">      </span>var key = “report_seg_”+I;<br />
 <span style="mso-tab-count: 1;">      </span>var obx_val = seg['OBX.5']['OBX.5.1'].toString() ;</span></p>
<p class="MsoNormal" style="line-height: 10.2pt; margin: 0in 0in 0pt;"><span style="font-family: &quot;Courier New&quot;; color: black; font-size: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt;"> <span style="mso-tab-count: 1;">      </span>channelMap.put(key, obx_val);<br />
}<br />
channelMap.put(&#8220;obx_seg_count&#8221;, i);</span></p>
<p class="MsoNormal" style="line-height: 10.2pt; margin: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><span style="font-family: &quot;Georgia&quot;,&quot;serif&quot;; color: black; font-size: 7pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> </span></p>
<p class="MsoNormal" style="line-height: 10.2pt; margin: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><span style="font-family: &quot;Georgia&quot;,&quot;serif&quot;; color: black; font-size: 7pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> </span></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.circlesource.com/2009/10/25/how-to-parse-multiple-obx-segments-in-mirth/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mirth Channel to write to a MySQL database</title>
		<link>http://blogs.circlesource.com/2008/12/24/mirth-channel-to-write-to-a-mysql-database/</link>
		<comments>http://blogs.circlesource.com/2008/12/24/mirth-channel-to-write-to-a-mysql-database/#comments</comments>
		<pubDate>Wed, 24 Dec 2008 01:27:37 +0000</pubDate>
		<dc:creator>maqbool</dc:creator>
				<category><![CDATA[HL7]]></category>
		<category><![CDATA[Mirth]]></category>
		<category><![CDATA[healthcare]]></category>

		<guid isPermaLink="false">http://blogs.circlesource.com/?p=21</guid>
		<description><![CDATA[Attahced is a screen capture of the process to create a simple channle to write to a MySQL database. The channel reads messages form a text file, parses it and then writes to MySQL database.
create mirth channel movie 
]]></description>
			<content:encoded><![CDATA[<p>Attahced is a screen capture of the process to create a simple channle to write to a MySQL database. The channel reads messages form a text file, parses it and then writes to MySQL database.</p>
<p><a href="http://blogs.circlesource.com/wp-content/uploads/2008/12/mirth1.zip">create mirth channel movie </a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.circlesource.com/2008/12/24/mirth-channel-to-write-to-a-mysql-database/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
