<?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>Blog of Gonzalo Brusella &#187; idea</title>
	<atom:link href="http://www.brusella.com.ar/index.php/tag/idea/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brusella.com.ar</link>
	<description>The personal blog of a developer on the loose</description>
	<lastBuildDate>Tue, 04 Jan 2011 15:04:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Working with HL7 Part 1</title>
		<link>http://www.brusella.com.ar/index.php/2009/09/working-with-hl7-part-1/</link>
		<comments>http://www.brusella.com.ar/index.php/2009/09/working-with-hl7-part-1/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 19:08:57 +0000</pubDate>
		<dc:creator>gbrusella</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[hl7]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[idea]]></category>

		<guid isPermaLink="false">http://www.brusella.com.ar/index.php/2009/09/working-with-hl7-part-1/</guid>
		<description><![CDATA[What is HL7 HL7 is a standar for health&#8217;s clinical and administrative data. One of objective of this standard is to develop a coherent, extendible standard that permit structured, encoded health care information of the type required to support patient care, to be exchanged between computer applications while preserving meaning. How a HL7 Message looks [...]]]></description>
			<content:encoded><![CDATA[<h3>What is HL7</h3>
<p>HL7 is a standar for health&#8217;s clinical and administrative data. One of objective of this standard is to develop a coherent, extendible standard that permit structured, encoded health care information of the type required to support patient care, to be exchanged between computer applications while preserving meaning.</p>
<h3>How a HL7 Message looks like</h3>
<blockquote><p>MSH|^~\&amp;|GHH LAB|ELAB-3|GHH OE|BLDG4|200202150930||ORU^R01|CNTRL-3456|P|2.4<br />
PID|||555-44-4444||EVERYWOMAN^EVE^E^^^^L|JONES|19620320|F|||153 FERNWOOD DR.^^STATESVILLE^OH^35292||(206)3345232|(206)752-121||||AC555444444||67-A4335^OH^20030520<br />
OBR|1|845439^GHH OE|1045813^GHH LAB|15545^GLUCOSE|||200202150730|||||||||555-55-5555^PRIMARY^PATRICIA P^^^^MD^^|||||||||F||||||444-44-4444^HIPPOCRATES^HOWARD H^^^^MD<br />
OBX|1|SN|1554-5^GLUCOSE^POST 12H CFST:MCNC:PT:SER/PLAS:QN||^182|mg/dl|70_105|H|||F</p></blockquote>
<p>Yes&#8230; Looks strange at first sight&#8230; but believe me, it is perfectly logic.</p>
<h3>Dissecting the message</h3>
<p>An HL7 message consists of the following data elements.</p>
<p align="center"><a href="http://www.brusella.com.ar/wp-content/uploads/2009/09/hlk_data_element_hier.gif"></a></p>
<p align="center">
<h4>Message type</h4>
<p>An HL7 message type is a unique identifier for the business purpose of a message. Every message must contain a message type id as way to announce the purpose of the message. For example, ADT is a unique message ID to Patient Administration.</p>
<p>However, it is rather not a unique classification on the structure of a message. One message type can have more than one message structure.</p>
<p>The message type is advertised in the message header segment</p>
<h4>Message event</h4>
<p>The message event, sometimes called a trigger, is a unique identifier to the context in which message is generated. The message event consists of an upper case letter and two digits. For example, A01 is for admission/visit notification and A61 is for changing consulting doctor. Both A01 and A61 are used with ADT messages</p>
<p>Event type is advertised in the message header segment.</p>
<h4>Message structure</h4>
<p align="center"><a href="http://www.brusella.com.ar/wp-content/uploads/2009/09/hlk_data_element_hier.gif"><img src="http://www.brusella.com.ar/wp-content/uploads/2009/09/hlk_data_element_hier-small.gif" alt="hlk data element hier" width="450" height="332" /></a></p>
<p>The message structure is a data structure used to express an association of a message type with an event for a class of messages. Each message structure also contains a unique ID.</p>
<p>It structurally consists of a well-defined list of HL7 segments. Segments can be optional, and can repeat. There is no limit on how many times a segment can repeat.</p>
<p>Segments can be aggregated together to form a segment group, which can repeat as well. In the standard specification, segment group is indicated by {} or [], where {} signifies repetition and [] signifies optionality.</p>
<p>Relative position of segments in a message structure and segment groups is well defined. At the message structure level, segment is the atomic data type.</p>
<p>Message structures are defined by both message type and events. One message type can associate with more than one event, but one event can only associate with exactly one message type. Furthermore, some events with a given message type associate with the same message structure. For example message type ADT with both event A01 and event A04 uses message structure ADT_A01</p>
<p><strong>Message structure of ADT_A61</strong></p>
<table border="1" width="100%">
<tbody>
<tr bgcolor="silver">
<th id="1" width="39%" align="left" valign="bottom">ADT^A61^ADT_A61</th>
<th id="2" width="61%" align="left" valign="bottom">ADT Message</th>
</tr>
<tr>
<td width="39%" align="left" valign="top">MSH</td>
<td width="61%" align="left" valign="top">Message header</td>
</tr>
<tr>
<td width="39%" align="left" valign="top">EVN</td>
<td width="61%" align="left" valign="top">Event type</td>
</tr>
<tr>
<td width="39%" align="left" valign="top">[ PD1 ]</td>
<td width="61%" align="left" valign="top">Additional demographics</td>
</tr>
<tr>
<td width="39%" align="left" valign="top">[ {ROL} ]</td>
<td width="61%" align="left" valign="top">Roll</td>
</tr>
<tr>
<td width="39%" align="left" valign="top">[ PV2 ]</td>
<td width="61%" align="left" valign="top">Patient visit&#8211;additional information</td>
</tr>
</tbody>
</table>
<p align="center">
<h4>Segments</h4>
<p>Segment is a well-defined list attributes, each of an HL7 data type. All segments start with three upper case letter segment IDs. Segment attributes can be optional and can repeat. The maximum number of how many times an attribute can repeat is specified. Various tables define the validity of certain attribute value.</p>
<dl>
<dt><strong>Note:</strong> The relative position of segment attribute is significant in how it is defined.</dt>
</dl>
<p>Every segment ends with a segment terminator, either the ASCII carriage return or x0D.</p>
<p>HL7 calls the segment attribute Field. The standard designates a delimiter, whose value is a defined by the user on per message instances basis, to separate fields.</p>
<p>When the fields repeat, the standard designates a user-defined delimiter, whose value is defined on per message instance basis, to separate repeating fields. Delimiters that separate repeating instances of a field are also defined by use, and call repetition</p>
<table border="1" width="100%">
<tbody>
<tr bgcolor="silver">
<td>Separator</td>
<td>Character</td>
</tr>
<tr>
<td>Segment</td>
<td>\x0D</td>
</tr>
<tr>
<td>Field Repeat</td>
<td>~</td>
</tr>
<tr>
<td>Null Value</td>
<td>&#8220;&#8221;</td>
</tr>
<tr>
<td>1st Level Field</td>
<td>|</td>
</tr>
<tr>
<td>2nd Level Field</td>
<td>^</td>
</tr>
<tr>
<td>3rd Level Field</td>
<td>&amp;</td>
</tr>
<tr>
<td>User Defined String 1</td>
<td>\</td>
</tr>
</tbody>
</table>
<p align="center"><strong>MSH segment specification</strong></p>
<table border="1" cellspacing="0" width="100%">
<tbody>
<tr bgcolor="silver">
<td width="4%" align="center"></td>
<td width="25%" align="left">Name</td>
<td width="10%" align="center">Data Type</td>
<td width="10%" align="center">Required</td>
<td width="10%" align="center">Length</td>
<td width="10%" align="center">Repeats</td>
</tr>
<tr>
<td width="4%" align="left">1</td>
<td width="25%" align="left">field separator</td>
<td width="10%" align="left">String</td>
<td width="10%" align="center">Yes</td>
<td width="10%" align="center">0&#8230;1</td>
<td width="10%" align="center">1..1</td>
</tr>
<tr>
<td width="4%" align="left">2</td>
<td width="25%" align="left">encoding characters</td>
<td width="10%" align="left">String</td>
<td width="10%" align="center">Yes</td>
<td width="10%" align="center">0&#8230;4</td>
<td width="10%" align="center">1..1</td>
</tr>
<tr>
<td width="4%" align="left">3</td>
<td width="25%" align="left">sending application</td>
<td width="10%" align="left">HD</td>
<td width="10%" align="center">No</td>
<td width="10%" align="center">0&#8230;180</td>
<td width="10%" align="center">..</td>
</tr>
<tr>
<td width="4%" align="left">4</td>
<td width="25%" align="left">sending facility</td>
<td width="10%" align="left">HD</td>
<td width="10%" align="center">No</td>
<td width="10%" align="center">0&#8230;180</td>
<td width="10%" align="center">..</td>
</tr>
<tr>
<td width="4%" align="left">5</td>
<td width="25%" align="left">receiving application</td>
<td width="10%" align="left">HD</td>
<td width="10%" align="center">No</td>
<td width="10%" align="center">0&#8230;180</td>
<td width="10%" align="center">..</td>
</tr>
<tr>
<td width="4%" align="left">6</td>
<td width="25%" align="left">receiving facility</td>
<td width="10%" align="left">HD</td>
<td width="10%" align="center">No</td>
<td width="10%" align="center">0&#8230;180</td>
<td width="10%" align="center">..</td>
</tr>
<tr>
<td width="4%" align="left">7</td>
<td width="25%" align="left">Date Time Of Message</td>
<td width="10%" align="left">TS</td>
<td width="10%" align="center">Yes</td>
<td width="10%" align="center">0&#8230;26</td>
<td width="10%" align="center">..</td>
</tr>
<tr>
<td width="4%" align="left">8</td>
<td width="25%" align="left">Security</td>
<td width="10%" align="left">String</td>
<td width="10%" align="center">No</td>
<td width="10%" align="center">0&#8230;40</td>
<td width="10%" align="center">..</td>
</tr>
<tr>
<td width="4%" align="left">9</td>
<td width="25%" align="left">message type</td>
<td width="10%" align="left">CM_MT</td>
<td width="10%" align="center">Yes</td>
<td width="10%" align="center">0&#8230;15</td>
<td width="10%" align="center">1..1</td>
</tr>
<tr>
<td width="4%" align="left">10</td>
<td width="25%" align="left">Message Control ID</td>
<td width="10%" align="left">String</td>
<td width="10%" align="center">Yes</td>
<td width="10%" align="center">0&#8230;36</td>
<td width="10%" align="center">1..1</td>
</tr>
<tr>
<td width="4%" align="left">11</td>
<td width="25%" align="left">Processing ID</td>
<td width="10%" align="left">PT</td>
<td width="10%" align="center">Yes</td>
<td width="10%" align="center">0&#8230;3</td>
<td width="10%" align="center">1..1</td>
</tr>
<tr>
<td width="4%" align="left">12</td>
<td width="25%" align="left">Version ID</td>
<td width="10%" align="left">VID</td>
<td width="10%" align="center">Yes</td>
<td width="10%" align="center">0&#8230;60</td>
<td width="10%" align="center">1..1</td>
</tr>
<tr>
<td width="4%" align="left">13</td>
<td width="25%" align="left">sequence number</td>
<td width="10%" align="left">4 Byte Long</td>
<td width="10%" align="center">No</td>
<td width="10%" align="center">0&#8230;15</td>
<td width="10%" align="center">..</td>
</tr>
<tr>
<td width="4%" align="left">14</td>
<td width="25%" align="left">continuation pointer</td>
<td width="10%" align="left">String</td>
<td width="10%" align="center">No</td>
<td width="10%" align="center">0&#8230;180</td>
<td width="10%" align="center">..</td>
</tr>
<tr>
<td width="4%" align="left">15</td>
<td width="25%" align="left">AcceptAcknowledgementType</td>
<td width="10%" align="left">String</td>
<td width="10%" align="center">No</td>
<td width="10%" align="center">0&#8230;2</td>
<td width="10%" align="center">..</td>
</tr>
<tr>
<td width="4%" align="left">16</td>
<td width="25%" align="left">ApplicationAcknowledgementType</td>
<td width="10%" align="left">String</td>
<td width="10%" align="center">No</td>
<td width="10%" align="center">0&#8230;2</td>
<td width="10%" align="center">..</td>
</tr>
<tr>
<td width="4%" align="left">17</td>
<td width="25%" align="left">country code</td>
<td width="10%" align="left">String</td>
<td width="10%" align="center">No</td>
<td width="10%" align="center">0&#8230;3</td>
<td width="10%" align="center">..</td>
</tr>
<tr>
<td width="4%" align="left">18</td>
<td width="25%" align="left">character set</td>
<td width="10%" align="left">String</td>
<td width="10%" align="center">No</td>
<td width="10%" align="center">0&#8230;7</td>
<td width="10%" align="center">0..No Max</td>
</tr>
<tr>
<td width="4%" align="left">19</td>
<td width="25%" align="left">PrincipalLanguageOfMessage</td>
<td width="10%" align="left">CE</td>
<td width="10%" align="center">No</td>
<td width="10%" align="center">0&#8230;250</td>
<td width="10%" align="center">..</td>
</tr>
<tr>
<td width="4%" align="left">20</td>
<td width="25%" align="left">AlternateCharacterSetHandlingScheme</td>
<td width="10%" align="left">String</td>
<td width="10%" align="center">No</td>
<td width="10%" align="center">0&#8230;20</td>
<td width="10%" align="center">..</td>
</tr>
<tr>
<td width="4%" align="left">21</td>
<td width="25%" align="left">ConformanceStatementId</td>
<td width="10%" align="left">String</td>
<td width="10%" align="center">No</td>
<td width="10%" align="center">0&#8230;10</td>
<td width="10%" align="center">0..No Max</td>
</tr>
</tbody>
</table>
<p align="center">
<dl>
<dt><strong>Note:</strong> In the previous table, &#8220;Len&#8221; stands for maximum length in number of characters; &#8220;DT&#8221; stands for data type; &#8220;OPT&#8221; stands for optionality; &#8220;Element Name&#8221; stands for brief descriptive name of the field.</dt>
</dl>
<p>The structures of many segments are statically defined and can be shared in many message structures. There are also some segments that share the same segment ID but have a different structure &#8212; different attribute in name and data type. QPD, QED, RCP, QAK belong to this category of segments</p>
<h4>Data types</h4>
<p>HL7 defines a long list of data types. Some are as defined as a primitive type, while others are defined as a complex type. A complex data type consists of more than one attribute of the primitive type. HL7 calls the attributes of a complex data type a <em>component</em></p>
<p>For example, the following HD data type uses three components, namespace ID, universal ID, and universal ID type.</p>
<pre>&lt;namespace ID (IS)&gt;^&lt;universal ID (ST)&gt;^&lt;universal ID type )ID)&gt;</pre>
<p>The standard designates a delimiter, whose value is defined by the user on per message instances basis, to separate components.</p>
<p>Other complex data type can further define a component of a given data type. HL7 calls the attribute of this complex data type <tt><strong>subcomponent</strong></tt>. The complex data type must have all attributes be of primitive type.</p>
<p>The standard also designates a delimiter to separate subcomponents whose value is defined by the user on per message instances basis.</p>
<p>The component delimiter of the data type that defines a component is then demoted to subcomponent delimiter.</p>
<p>HL7 also designates an escape character for escapting characters that are identical to various delimiters. These are defined by the user on per message instance basis.</p>
<p>Most data types are well are statically specified as distinct data structures in the standard. A few data types, notably the CM and * data type, exhibit dynamic behavior, and warrant special attention.</p>
<h4>Custom made data types</h4>
<p>CM is also called a Composite data type. This data type is a custom construction using previously defined data types for each unique situation, in a different segment, or at different field of the same segment. There are number of data structures associated with the CM data type.</p>
<p>The data structures for the CM types, which can differ widely from one another, are solidified at time when segments they belong to are defined. The CM data type is known at design time.</p>
<p>In earlier versions of the HL7 standard, CM is meant to be custom-made data type, data type defined on local site of deployment. For this reason, CM data type represents endless number of structures with different combination and permutation of readily defined data types.</p>
<p>Version 2.4 of HL7 only has finite number of data structures that is labeled with CM data type.</p>
<h4>Polymorphic data type</h4>
<p>This is the data type that is marked with * symbol or with &#8220;varies&#8221; data type label, instead of the usual two or three capital letters.</p>
<p>This data type exhibits a common behavior that it can be any one of the already defined data type and the data type is declare in some other place. For example, OBX-2 declares the data type of OBX-5, which is actual data carrier of this polymorphic data type. For ease of discussion, lets call the field that announce the data type of polymorphic data type data Data Type Announcer, and call the field that contains the actual data of the polymorphic data type Data Carrier.</p>
<p>The data type announcer and data carrier can coexist in the same segment; they can also exist on different segments. For example, OBX segment has OBX-2 field being the data type announcer and OBX-5 field being the data carrier. RDF segment contains a field of RCD data type, of which each instance of the RCD field acts as a data announcer for data carrier in the RDT segment. The relationship of the RDF and RDT segment is in analogues to relationship database&#8217;s table description meta-data and rows of actual data.</p>
<p>In the case of both data type announcer and data carrier residing in the same segment, the relative position of the announcer field and the data carrier field can also vary. Data type announcer can precede data carrier, or the other way around.</p>
<p>There is no fixed number of fields that sets data type announcer and data carrier apart. Their relationship is shown in the following diagram.</p>
<h4>Delimiter and enhaced data model</h4>
<p>The delimiters for segment, field, component, and subcomponent are all user-defined Delimiters are announced in the message header for each individual message.</p>
<p>A segment delimiter is defined as an ASCII carriage return or x0A. When data containing the characters identical to these delimiters, an escape sequence is used to mark the character.</p>
<p>Component delimiters can be demoted to subcomponent delimiters when a data type is used on anther data type&#8217;s components. The use of repetition delimiters in most data elements is contextual depending the nature of its data elements, with certain excpetions.</p>
<p>The repetition delimiter is used between repeating instances of data type element segment fields. The common character used is &#8220;~&#8221;. Components of data type element are generally not expected to repeat, except for MA, NA, and QIP data types.</p>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.brusella.com.ar/index.php/2009/09/working-with-hl7-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

