<?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; Development</title>
	<atom:link href="http://www.brusella.com.ar/index.php/category/dev/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>The different flavors of the Orbital Ion Cannons (DDoS attack tools)</title>
		<link>http://www.brusella.com.ar/index.php/2010/12/the-different-flavors-of-the-orbital-ion-cannons-ddos-attack-tools/</link>
		<comments>http://www.brusella.com.ar/index.php/2010/12/the-different-flavors-of-the-orbital-ion-cannons-ddos-attack-tools/#comments</comments>
		<pubDate>Wed, 15 Dec 2010 16:12:56 +0000</pubDate>
		<dc:creator>gbrusella</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Social]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Anonymous]]></category>
		<category><![CDATA[attack]]></category>
		<category><![CDATA[DDoS]]></category>
		<category><![CDATA[Ion Cannon]]></category>
		<category><![CDATA[Wikileaks]]></category>

		<guid isPermaLink="false">http://www.brusella.com.ar/?p=118</guid>
		<description><![CDATA[WARNING: This is just a study on the tools. I DO NOT encourage you to use them. The source code that I will show is intended to be used ONLY on learning purposes. On my last entry, you found that the Anti-Anti-Wikileaks (Pro Wikileaks, you know all about double negations) groups are using LOIC (Low [...]]]></description>
			<content:encoded><![CDATA[<p align="center"><font color="#ccffcc">WARNING: This is just a study on the tools. I DO NOT encourage you to use them. The source code that I will show is intended to be used ONLY on learning purposes.</font></p>
<p>On my last entry, you found that the Anti-Anti-Wikileaks (Pro Wikileaks, you know all about double negations) groups are using LOIC (Low Orbit Ion Cannon) to provoke DDoS attacks on several sites.</p>
<p>So far I have found 3 tools that makes all the “good” job.</p>
<ul>
<li>LOIC: It means “Low Orbit Ion Cannon”, and is an open source network stress testing application, written in C#. Initially developed by Praetox Technologies but later released in the public domain. Can be found here: <a href="http://sourceforge.net/projects/loic/" target="_blank">http://sourceforge.net/projects/loic/</a>, but the root is: <a href="http://praetox.com/n.php/sw/sauce" target="_blank">http://praetox.com/n.php/sw/sauce</a>. This tool used Framework 3.5,&#160; but if it’s upgraded to .Net 4 and makes use of TPL (yes, I did it, and NO I WON’T release it’s source) can gain some more performance.
<ul>
<li>IRC LOIC: Found&#160; on <a href="https://github.com/NewEraCracker/LOIC/zipball/1.1.2.3" target="_blank">https://github.com/NewEraCracker/LOIC/zipball/1.1.2.3</a> this is the source of the (one of the latest?, you need to lurk more seriously on 4chan’s /b forum to see if there is a newer version) versions of LOIC. It varies from the original LOIC on the fact that it can connect to a IRC server and be controlled from a room by it’s operators (the users prefixed by “@”) . This creates a <em>voluntary </em>botnet called “Hive Mind”. It’s controlled by the members of Anonymous Group.</li>
<li>LOIQ: Located on <a href="http://sourceforge.net/projects/loiq/">http://sourceforge.net/projects/loiq/</a>, is a <span lang="EN">C++/Qt4,</span> port of the original LOIC intended to be executed on X (Mainly Linux, but also Mac OS X).</li>
<li>JS LOIC: <a href="http://anonsp.hostoi.com/" target="_blank">http://anonsp.hostoi.com/</a>&#160; is a JavaScript version of LOIC. Much less effective, but also with no download/install requirements. The source code is in the page’s source code <img src='http://www.brusella.com.ar/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</li>
<li>JavaLOIC: <a href="http://www.mediafire.com/?9rfblvej3ycd8dt" target="_blank">http://www.mediafire.com/?9rfblvej3ycd8dt</a> Not open sourced, but the .jar file is not secured. Maybe the source can be obtained after using a <a href="http://www.google.com.ar/#&amp;q=java+decompiler" target="_blank">Java Decompiler</a></li>
</ul>
</li>
<li>HOIC: It means “High Orbit Ion Cannon”. Located on <a href="http://hoic.99k.org/" target="_blank">http://hoic.99k.org/</a> it claims to be open sourced, but I couldn’t find the source. It Cannot be remotely controlled, but is way more powerful than LOIC.</li>
<li>GOIC: Acronym of “<span class="coMULTI">Geosynchronous orbital ion cannon</span>” <a href="http://pastebin.com/FH6njMew" target="_blank">http://pastebin.com/FH6njMew</a> is a public domain tool that has been released but has no transcendence (so far).</li>
</ul>
<p>As you can see, there is a lot of tools being used, on this matter, but those are the ones related to the Wikileaks-Anonymous matter (as far as I know)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brusella.com.ar/index.php/2010/12/the-different-flavors-of-the-orbital-ion-cannons-ddos-attack-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Haking Infography</title>
		<link>http://www.brusella.com.ar/index.php/2010/05/haking-infography/</link>
		<comments>http://www.brusella.com.ar/index.php/2010/05/haking-infography/#comments</comments>
		<pubDate>Sat, 29 May 2010 23:57:18 +0000</pubDate>
		<dc:creator>gbrusella</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.brusella.com.ar/?p=93</guid>
		<description><![CDATA[Here is a &#8220;little&#8221; and very condensed history of hacking. A remarkable mention to Nash. Via: Online MBA]]></description>
			<content:encoded><![CDATA[<p>Here is a &#8220;little&#8221; and very condensed history of hacking. A remarkable mention to Nash.</p>
<p><a rel="nofollow" href="http://www.onlinemba.com/blog/the-history-of-hacking"><img src="http://www.onlinemba.com/images/hacking.jpg" border="0" alt="The History of Hacking" width="500" /></a><br />Via: <a href="http://www.onlinemba.com">Online MBA</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.brusella.com.ar/index.php/2010/05/haking-infography/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TEDx Buenos Aires Soon!!</title>
		<link>http://www.brusella.com.ar/index.php/2010/04/tedx-buenos-aires-soon/</link>
		<comments>http://www.brusella.com.ar/index.php/2010/04/tedx-buenos-aires-soon/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 14:38:07 +0000</pubDate>
		<dc:creator>gbrusella</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.brusella.com.ar/?p=81</guid>
		<description><![CDATA[I&#8217;m VERY exited about this&#8230; The first TEDx (x is for independent talks) in Buenos Aires is about to be materialized next April 8&#8230; And I got my ticket!! Finding one was a truly adventure. Just 1 in 6 or 7 pre-registered got his ticket. But.. What is TED? TED is a small nonprofit devoted [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m VERY exited about this&#8230; The first TEDx (x is for independent talks) in Buenos Aires is about to be materialized next April 8&#8230; And I got my ticket!! Finding one was a truly adventure. Just 1 in 6 or 7 pre-registered got his ticket.</p>
<p>But.. What is TED?</p>
<blockquote><p>TED is a small nonprofit devoted to Ideas Worth Spreading. It started out (in 1984) as a conference bringing together people from three worlds:  Technology, Entertainment, Design. Since then its scope has become ever broader. Along with the annual TED Conference in Long Beach, California, and the TEDGlobal conference in Oxford UK, TED includes the award-winning TEDTalks video site, the Open Translation Program, the new TEDx community program, this year&#8217;s TEDIndia Conference and the annual TED Prize.</p>
</blockquote>
<p>And TEDx is&#8230;?</p>
<blockquote><p>TEDx was created in the spirit of TED&#8217;s mission, &#8220;ideas worth spreading.&#8221; The program is designed to give communities, organizations and individuals the opportunity to stimulate dialogue through TED-like experiences at the local level.  At TEDx events, unique talks given by live speakers combine with TEDTalks videos to spark deep conversation and connections. TEDx events are fully planned and coordinated independently, on a community-by-community basis.</p>
</blockquote>
<p>I left here some  of my favorites&#8230;<br />
 <!--copy and paste--></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="446" height="326" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="wmode" value="transparent" /><param name="bgColor" value="#ffffff" /><param name="flashvars" value="vu=http://video.ted.com/talks/dynamic/BillGates_2010-embed_medium.mp4&amp;su=http://images.ted.com/images/ted/tedindex/embed-posters/BillGates_2010-embed_thumbnail.jpg&amp;vw=432&amp;vh=240&amp;ap=0&amp;ti=767&amp;introDuration=16500&amp;adDuration=4000&amp;postAdDuration=2000&amp;adKeys=talk=bill_gates;year=2010;theme=new_on_ted_com;theme=what_s_next_in_tech;theme=technology_history_and_destiny;theme=a_greener_future;theme=a_taste_of_ted2010;event=TED2010;&amp;preAdTag=tconf.ted/embed;tile=1;sz=512x288;" /><param name="src" value="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" /><param name="bgcolor" value="#ffffff" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="446" height="326" src="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" flashvars="vu=http://video.ted.com/talks/dynamic/BillGates_2010-embed_medium.mp4&amp;su=http://images.ted.com/images/ted/tedindex/embed-posters/BillGates_2010-embed_thumbnail.jpg&amp;vw=432&amp;vh=240&amp;ap=0&amp;ti=767&amp;introDuration=16500&amp;adDuration=4000&amp;postAdDuration=2000&amp;adKeys=talk=bill_gates;year=2010;theme=new_on_ted_com;theme=what_s_next_in_tech;theme=technology_history_and_destiny;theme=a_greener_future;theme=a_taste_of_ted2010;event=TED2010;&amp;preAdTag=tconf.ted/embed;tile=1;sz=512x288;" bgcolor="#ffffff" wmode="transparent" allowfullscreen="true"></embed></object>
</p>
<p><!--copy and paste--><object width="446" height="326"><param name="movie" value="http://video.ted.com/assets/player/swf/EmbedPlayer.swf"></param><param name="allowFullScreen" value="true" /><param name="wmode" value="transparent"></param><param name="bgColor" value="#ffffff"></param><param name="flashvars" value="vu=http://video.ted.com/talks/dynamic/YannArthus-Bertrand_2009-medium.flv&#038;su=http://images.ted.com/images/ted/tedindex/embed-posters/YannArthus-Bertrand-2009.embed_thumbnail.jpg&#038;vw=432&#038;vh=240&#038;ap=0&#038;ti=561&#038;introDuration=16500&#038;adDuration=4000&#038;postAdDuration=2000&#038;adKeys=talk=yann_arthus_bertrand_captures_fragile_earth_in_wide_ang;year=2009;theme=media_that_matters;theme=inspired_by_nature;theme=speaking_at_ted2009;theme=the_creative_spark;theme=art_unusual;theme=a_greener_future;theme=not_business_as_usual;theme=bold_predictions_stern_warnings;event=TED2009;&#038;preAdTag=tconf.ted/embed;tile=1;sz=512x288;" /><embed src="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" pluginspace="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" bgColor="#ffffff" width="446" height="326" allowFullScreen="true" flashvars="vu=http://video.ted.com/talks/dynamic/YannArthus-Bertrand_2009-medium.flv&#038;su=http://images.ted.com/images/ted/tedindex/embed-posters/YannArthus-Bertrand-2009.embed_thumbnail.jpg&#038;vw=432&#038;vh=240&#038;ap=0&#038;ti=561&#038;introDuration=16500&#038;adDuration=4000&#038;postAdDuration=2000&#038;adKeys=talk=yann_arthus_bertrand_captures_fragile_earth_in_wide_ang;year=2009;theme=media_that_matters;theme=inspired_by_nature;theme=speaking_at_ted2009;theme=the_creative_spark;theme=art_unusual;theme=a_greener_future;theme=not_business_as_usual;theme=bold_predictions_stern_warnings;event=TED2009;"></embed></object></p>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.brusella.com.ar/index.php/2010/04/tedx-buenos-aires-soon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Ballmer Peak</title>
		<link>http://www.brusella.com.ar/index.php/2010/03/the-ballmer-peak/</link>
		<comments>http://www.brusella.com.ar/index.php/2010/03/the-ballmer-peak/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 16:28:19 +0000</pubDate>
		<dc:creator>gbrusella</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[humor]]></category>

		<guid isPermaLink="false">http://www.brusella.com.ar/?p=75</guid>
		<description><![CDATA[I&#8217;ve just saw this on XKCD&#8230; Impressive.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just saw this on <a href="http://xkcd.com">XKCD</a>&#8230; Impressive.</p>
<p> <img class="aligncenter" title="The Ballmer Peak" src=" http://imgs.xkcd.com/comics/ballmer_peak.png" alt="The Ballmer Peak" width="580" height="460" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.brusella.com.ar/index.php/2010/03/the-ballmer-peak/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft Live Labs Pivot project</title>
		<link>http://www.brusella.com.ar/index.php/2009/12/microsoft-live-labs-pivot-project/</link>
		<comments>http://www.brusella.com.ar/index.php/2009/12/microsoft-live-labs-pivot-project/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 04:28:41 +0000</pubDate>
		<dc:creator>gbrusella</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[deep zoom]]></category>
		<category><![CDATA[labs]]></category>
		<category><![CDATA[pivot]]></category>
		<category><![CDATA[silverlight]]></category>

		<guid isPermaLink="false">http://www.brusella.com.ar/?p=58</guid>
		<description><![CDATA[Microsoft Live Labs has a new baby: Pivot. Pivot makes it easier to interact with massive amounts of data in ways that are powerful, informative, and fun. We tried to step back and design an interaction model that accommodates the complexity and scale of information rather than the traditional structure of the Web. My firt [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft Live Labs has a new baby: Pivot.</p>
<blockquote><p>Pivot makes it easier to interact with massive amounts of data in ways that are powerful, informative, and fun. We tried to step back and design an interaction model that accommodates the complexity and scale of information rather than the traditional structure of the Web.</p>
</blockquote>
<p>My firt impression: Huuge potential. It is what I think that future search methods should be. A mix between related data, context information, and visual search. The only thing that I cannot undestabd is why only visual search&#8230; we have a lot of algorithms to index media&#8230; we can do more&#8230;</p>
<p>It uses <a title="Deep Zoom" href="http://msdn.microsoft.com/en-us/library/cc645050%28VS.95%29.aspx">Deep Zoom</a> (a technology that is part of  silverlight) that allows to render images in a smart way (Note to me: Must do a Post on how Deep Zoom works) to render the collections.</p>
<p>You can get an invitation by following the dev team in twitter.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brusella.com.ar/index.php/2009/12/microsoft-live-labs-pivot-project/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>.Net News</title>
		<link>http://www.brusella.com.ar/index.php/2009/12/net-news/</link>
		<comments>http://www.brusella.com.ar/index.php/2009/12/net-news/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 03:45:43 +0000</pubDate>
		<dc:creator>gbrusella</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[Project]]></category>
		<category><![CDATA[TFS]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://www.brusella.com.ar/?p=66</guid>
		<description><![CDATA[I have been using Visual Studio 2010 Beta 2 and TFS 2010. They are awesome! VS2010 is going to be a great poroduct, when it goes RTM. I see a lot of effort on making may life as developer a lot more easy. The integration with Visual Studio Gallery is good (could be better, like [...]]]></description>
			<content:encoded><![CDATA[<p>I have been using Visual Studio 2010 Beta 2 and TFS 2010. They are awesome!</p>
<p>VS2010 is going to be a great poroduct, when it goes RTM. I see a lot of effort on making may life as developer a lot more easy. The integration with Visual Studio Gallery is good (could be better, like allowing to search by cost of the extension, more <em>a la</em> site version). On the PDC 2009 MS that the free version of Code Rush will also be available for Vs2010 developers.</p>
<p>I will include some captures as soon as possible.</p>
<p>On the TFS 2010 side, it&#8217;s becoming a serious contender on his segment. Now with a native integration with project server, the managers can concentrate all the info in just a a tool and get an updated snapshoot on the project status every time they want.</p>
<p>Also the new compilation farms are nice. The compilation process is now Workflow based, so you can adjust the process with custom activities as you need. That and much more to come.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brusella.com.ar/index.php/2009/12/net-news/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Playing With&#8230; Oxite!</title>
		<link>http://www.brusella.com.ar/index.php/2009/11/playing-with-oxite/</link>
		<comments>http://www.brusella.com.ar/index.php/2009/11/playing-with-oxite/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 03:50:24 +0000</pubDate>
		<dc:creator>gbrusella</dc:creator>
				<category><![CDATA[CMS]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[new]]></category>
		<category><![CDATA[open souce]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[Social]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://www.brusella.com.ar/?p=53</guid>
		<description><![CDATA[Right now I am playing With Oxite a Open source CMS made by Microsoft. This is an Alpha release and I must Admit, once i managed to build it (yes, the setup process needs some corrections, but the comments helps a lot with the process). Once it has been compiled… works like a charm. It [...]]]></description>
			<content:encoded><![CDATA[<p>Right now I am playing With <a href="http://oxite.codeplex.com/" target="_blank">Oxite</a> a Open source CMS made by Microsoft. This is an Alpha release and I must Admit, once i managed to build it (yes, the setup process needs some corrections, but the comments helps a lot with the process).</p>
<p>Once it has been compiled… works like a charm. It is a low end blog. It does not have any of the fancy or the minimum features yet (ie: No RSS/Atom, no anti-spam). The developers also say that is not production ready yet… but I saw some sites using it.</p>
<p>Adding this features seems quite easy since the plug-in/module model is very easy to understand and to code. Rumors say that the Beta version is very close… I’m very happy with this.</p>
<p>Nice code. A Big plus is that my preliminary analysis shows that the persistency layer (it uses a LinqToSql provider) seems quite easy to replace with a more malleable ORM.</p>
<p>In summary: this is a project that you must watch.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brusella.com.ar/index.php/2009/11/playing-with-oxite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Wave Embedd Sample</title>
		<link>http://www.brusella.com.ar/index.php/2009/11/google-wave-embedd-sample/</link>
		<comments>http://www.brusella.com.ar/index.php/2009/11/google-wave-embedd-sample/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 18:19:08 +0000</pubDate>
		<dc:creator>gbrusella</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Google Wave]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://www.brusella.com.ar/index.php/2009/11/google-wave-embedd-sample/</guid>
		<description><![CDATA[Me And my friend Ivan are waving a little.]]></description>
			<content:encoded><![CDATA[<p>Me And my friend Ivan are waving a little.</p>

		<div id="waveframe-1"  style="height:1000px;"  ></div>
		 <script type="text/javascript">

				add_wave("waveframe-1",{
					bgcolor:"#ffffff",
					color:"#ff0000",
					font:"",
					font_size:"1em",
					width:"",
					height:"1000px",
					server:"https://wave.google.com/wave/",
					id:"googlewave.com!w+NMOoOKv8A"		});

		</script>
		
]]></content:encoded>
			<wfw:commentRss>http://www.brusella.com.ar/index.php/2009/11/google-wave-embedd-sample/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with HL7 Part 2</title>
		<link>http://www.brusella.com.ar/index.php/2009/10/working-with-hl7-part-2/</link>
		<comments>http://www.brusella.com.ar/index.php/2009/10/working-with-hl7-part-2/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 04:14:00 +0000</pubDate>
		<dc:creator>gbrusella</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[hl7]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[open souce]]></category>
		<category><![CDATA[sample]]></category>

		<guid isPermaLink="false">http://www.brusella.com.ar/index.php/2009/10/working-with-hl7-part-2/</guid>
		<description><![CDATA[I am not a person who loves to leave all things unfinished. This is no exception. A while ago, I started blogging about how to work with HL7 in an easy way. I had to deal with it and I can guarantee you, my reader, that in some cases is not an easy task. On [...]]]></description>
			<content:encoded><![CDATA[<p>I am not a person who loves to leave all things unfinished. This is no exception.</p>
<p>A while ago, I started blogging about how to work with HL7 in an easy way. I had to deal with it and I can guarantee you, my reader, that in some cases is not an easy task. On the <a href="http://www.brusella.com.ar/index.php/2009/09/working-with-hl7-part-1/" target="_blank">first part</a> I wrote about the structure of an HL7 message; now is time to handle this message in a systemic way (aka: developing).</p>
<p>While you have integration suites (I remember a few: <a href="http://www.google.com/search?q=biztalk+hl7" target="_blank">Microsoft’s BizTalk</a>, Oracle’s Fussion, SAP PI, etc.), some times you don’t need a über product for getting the job done. Sometimes it is perfect to write your-own-and-very-flexible code.</p>
<p>After googling a while, I found a little jewel for us developers. <a href="http://hl7api.sourceforge.net/" target="_blank">HAPI</a> for Java developers and <a href="http://nhapi.sourceforge.net" target="_blank">NHAPI</a> for .Net ones. The original project is the Java one, so if you need some documentation you should go to the source project.</p>
<p>Now you got the essentials. It is time to show you some code, but first a little of context.</p>
<p>Recently I had to deal with the validation of affiliates to a Health Care company. This company uses HL7 internally. Also this company does not let you to contact them directly, you must use a carrier (another company who gets your message and, after validating it sends the data in HL7 format to the Health Care company). Some of this carriers asks for a plain (and proprietary) text file format to communicate with them, sometimes they expose an HL7 interface (Kudos from me to them).</p>
<p>Luckily for me in Argentina a long time ago there was an agreement (I don’t remember how I got this info, but it’s true) among the Carriers and the Health Care Companies to standardize the HL7 format for several operations (among others, the operations I needed to do).</p>
<p><strong><span style="text-decoration: underline;">HL7 Note</span>:</strong> In reference to HL7, the protocol aims to create new customized messages types when those provided by the norm does not fit the business need. These messages are called <em>Z messages</em>. The <em>Z messages</em> can contain <em>Z segments</em> and <em>Z groups</em>,<em> </em>and all are <strong>locally defined </strong>by norm, so you can end up with a colliding set of HL7 <em>Z elements </em>(the same <em>name</em> of <em>Z message/segment/group</em> but <em>different</em> internal definition). In a nutshell: a nightmare.</p>
<p>Both HAPI and NHAPI are open source libraries and I choose NHAPI for the samples because I already have some code made on it.</p>
<p>Let’s define a new <em>Z Segment</em>:</p>
<p><a onclick="xcollapse('X1865');return false;" href="#"> Show the code </a></p>
<p>Let’s define a new <em>Z Message</em>:</p>
<p><a onclick="xcollapse('X3246');return false;" href="#"> Show the code </a></p>
<div id="X3246" style="display: none; background: transparent;">
<table style="background: #181818;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="400" valign="top">
<pre class="code"><span style="color: #8080c0">using </span><span style="color: #fef1a9">System</span><span style="color: #e0e0e0">;
</span><span style="color: #8080c0">using </span><span style="color: #fef1a9">NHapi</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Base</span><span style="color: #e0e0e0">;
</span><span style="color: #8080c0">using </span><span style="color: #fef1a9">NHapi</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Base</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Log</span><span style="color: #e0e0e0">;
</span><span style="color: #8080c0">using </span><span style="color: #fef1a9">NHapi</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Base</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Model</span><span style="color: #e0e0e0">;
</span><span style="color: #8080c0">using </span><span style="color: #fef1a9">NHapi</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Base</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Parser</span><span style="color: #e0e0e0">;
</span><span style="color: #8080c0">using </span><span style="color: #fef1a9">NHapi</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Model</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">V24</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Group</span><span style="color: #e0e0e0">;
</span><span style="color: #8080c0">using </span><span style="color: #fef1a9">NHapi</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Model</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">V24</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Segment</span><span style="color: #e0e0e0">;
</span><span style="color: #8080c0">using </span><span style="color: #fef1a9">ValidationProvider</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">HL7</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Segment</span><span style="color: #e0e0e0">;

</span><span style="color: #8080c0">namespace </span><span style="color: #fef1a9">NHapi</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Model</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">V24</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Message
</span><span style="color: #e0e0e0">{
    [</span><span style="color: #c7c7f1">Serializable</span><span style="color: #e0e0e0">]
    </span><span style="color: #8080c0">public class </span><span style="color: #c7c7f1">ZLA_Z22 </span><span style="color: #e0e0e0">: </span><span style="color: #c7c7f1">AbstractMessage
    </span><span style="color: #e0e0e0">{
        </span><span style="color: #8080c0">private string </span><span style="color: #fef1a9">_n1</span><span style="color: #e0e0e0">;
        </span><span style="color: #8080c0">private string </span><span style="color: #fef1a9">_n2</span><span style="color: #e0e0e0">;
        </span><span style="color: #8080c0">private string </span><span style="color: #fef1a9">_n3</span><span style="color: #e0e0e0">;
        </span><span style="color: #8080c0">private string </span><span style="color: #fef1a9">_n4</span><span style="color: #e0e0e0">;

        </span><span style="color: gray">/// </span><span style="color: #c080c0">Creates a new ZLA_Z22 Group with custom IModelClassFactory.
        </span><span style="color: gray">///
        </span><span style="color: #8080c0">public </span><span style="color: #fef1a9">ZLA_Z22</span><span style="color: #e0e0e0">(</span><span style="color: #2b91af">IModelClassFactory </span><span style="color: #fef1a9">factory</span><span style="color: #e0e0e0">)
            : </span><span style="color: #8080c0">base</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">factory</span><span style="color: #e0e0e0">)
        {
            </span><span style="color: #fef1a9">Init</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">factory</span><span style="color: #e0e0e0">);
        }

        </span><span style="color: gray">///
        /// </span><span style="color: #c080c0">Creates a new ZLA_Z22 Group with DefaultModelClassFactory.
        </span><span style="color: gray">///
        </span><span style="color: #8080c0">public </span><span style="color: #fef1a9">ZLA_Z22</span><span style="color: #e0e0e0">()
            : </span><span style="color: #8080c0">base</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">new </span><span style="color: #c7c7f1">DefaultModelClassFactory</span><span style="color: #e0e0e0">())
        {
            </span><span style="color: #fef1a9">Init</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">new </span><span style="color: #c7c7f1">DefaultModelClassFactory</span><span style="color: #e0e0e0">());
        }

        </span><span style="color: gray">///
        /// </span><span style="color: #c080c0">initalize method for ZLA_Z22.  This does the segment setup for the message.
        </span><span style="color: gray">///
        </span><span style="color: #8080c0">private void </span><span style="color: #fef1a9">Init</span><span style="color: #e0e0e0">(</span><span style="color: #2b91af">IModelClassFactory </span><span style="color: #fef1a9">factory</span><span style="color: #e0e0e0">)
        {
            </span><span style="color: #8080c0">try
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #fef1a9">add</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">typeof</span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">MSH</span><span style="color: #e0e0e0">), </span><span style="color: #8080c0">true</span><span style="color: #e0e0e0">, </span><span style="color: #8080c0">false</span><span style="color: #e0e0e0">);
                </span><span style="color: #fef1a9">_n1 </span><span style="color: #e0e0e0">= </span><span style="color: #fef1a9">add</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">typeof</span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">ZLA_Z22_Authorization</span><span style="color: #e0e0e0">), </span><span style="color: #8080c0">false</span><span style="color: #e0e0e0">, </span><span style="color: #8080c0">false</span><span style="color: #e0e0e0">);
                </span><span style="color: #fef1a9">add</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">typeof</span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">ZXX</span><span style="color: #e0e0e0">), </span><span style="color: #8080c0">false</span><span style="color: #e0e0e0">, </span><span style="color: #8080c0">false</span><span style="color: #e0e0e0">);
                </span><span style="color: #fef1a9">_n2 </span><span style="color: #e0e0e0">= </span><span style="color: #fef1a9">add</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">typeof</span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">ZLA_Z22_Data</span><span style="color: #e0e0e0">), </span><span style="color: #8080c0">true</span><span style="color: #e0e0e0">, </span><span style="color: #8080c0">false</span><span style="color: #e0e0e0">);
                </span><span style="color: #fef1a9">add</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">typeof</span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">PID</span><span style="color: #e0e0e0">), </span><span style="color: #8080c0">false</span><span style="color: #e0e0e0">, </span><span style="color: #8080c0">false</span><span style="color: #e0e0e0">);
                </span><span style="color: #fef1a9">_n3 </span><span style="color: #e0e0e0">= </span><span style="color: #fef1a9">add</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">typeof</span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">ZLA_Z22_Insurance</span><span style="color: #e0e0e0">), </span><span style="color: #8080c0">false</span><span style="color: #e0e0e0">, </span><span style="color: #8080c0">true</span><span style="color: #e0e0e0">);
                </span><span style="color: #fef1a9">add</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">typeof</span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">DG1</span><span style="color: #e0e0e0">), </span><span style="color: #8080c0">false</span><span style="color: #e0e0e0">, </span><span style="color: #8080c0">true</span><span style="color: #e0e0e0">);
                </span><span style="color: #fef1a9">_n4 </span><span style="color: #e0e0e0">= </span><span style="color: #fef1a9">add</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">typeof</span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">ZLA_Z22_ProcedureZ</span><span style="color: #e0e0e0">), </span><span style="color: #8080c0">true</span><span style="color: #e0e0e0">, </span><span style="color: #8080c0">true</span><span style="color: #e0e0e0">);
                </span><span style="color: #fef1a9">add</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">typeof</span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">PV1</span><span style="color: #e0e0e0">), </span><span style="color: #8080c0">false</span><span style="color: #e0e0e0">, </span><span style="color: #8080c0">false</span><span style="color: #e0e0e0">);
                </span><span style="color: #fef1a9">add</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">typeof</span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">NTE</span><span style="color: #e0e0e0">), </span><span style="color: #8080c0">false</span><span style="color: #e0e0e0">, </span><span style="color: #8080c0">true</span><span style="color: #e0e0e0">);
            }
            </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">)
            {
                </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"Unexpected error creating " </span><span style="color: #e0e0e0">+ </span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">().</span><span style="color: #fef1a9">Name </span><span style="color: #e0e0e0">+ </span><span style="color: #60ff60">" - this is probably a bug in the source code generator."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
            }
        }

        </span><span style="color: #8080ff">#region </span><span style="color: #e0e0e0">Segments
        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">MSH </span><span style="color: #fef1a9">MSH
        </span><span style="color: #e0e0e0">{
            </span><span style="color: #8080c0">get
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #c7c7f1">MSH </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
                </span><span style="color: #8080c0">try
                </span><span style="color: #e0e0e0">{
                    </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= (</span><span style="color: #c7c7f1">MSH</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">GetStructure</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"MSH"</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"Unexpected error accessing data - this is probably a bug in the source code generator."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
            }
        }

        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">ZLA_Z22_Authorization </span><span style="color: #fef1a9">Authorization
        </span><span style="color: #e0e0e0">{
            </span><span style="color: #8080c0">get
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #c7c7f1">ZLA_Z22_Authorization </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
                </span><span style="color: #8080c0">try
                </span><span style="color: #e0e0e0">{
                    </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= (</span><span style="color: #c7c7f1">ZLA_Z22_Authorization</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">GetStructure</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">_n1</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"Unexpected error accessing data - this is probably a bug in the source code generator."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
            }
        }
        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">ZXX </span><span style="color: #fef1a9">ZXX
        </span><span style="color: #e0e0e0">{
            </span><span style="color: #8080c0">get
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #c7c7f1">ZXX </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
                </span><span style="color: #8080c0">try
                </span><span style="color: #e0e0e0">{
                    </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= (</span><span style="color: #c7c7f1">ZXX</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">GetStructure</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"ZXX"</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"Unexpected error accessing data - this is probably a bug in the source code generator."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
            }
        }
        </span><span style="color: #8080ff">#region </span><span style="color: #e0e0e0">ZLA_Z22_Data
        </span><span style="color: gray">///
        /// </span><span style="color: #c080c0">Returns  first repetition of ZLA_Z22_Data (Notes and Comments) - creates it if necessary
        </span><span style="color: gray">///
        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">ZLA_Z22_Data </span><span style="color: #fef1a9">GetZLA_Z22_Data</span><span style="color: #e0e0e0">()
        {
            </span><span style="color: #c7c7f1">ZLA_Z22_Data </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= </span><span style="color: #8080c0">null</span><span style="color: #e0e0e0">;
            </span><span style="color: #8080c0">try
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= (</span><span style="color: #c7c7f1">ZLA_Z22_Data</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">GetStructure</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">_n2</span><span style="color: #e0e0e0">);
            }
            </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">)
            {
                </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"Unexpected error accessing data - this is probably a bug in the source code generator."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                </span><span style="color: #8080c0">throw new </span><span style="color: #fef1a9">System</span><span style="color: #e0e0e0">.</span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
            }
            </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
        }

        </span><span style="color: gray">///
        ///</span><span style="color: #c080c0">Returns a specific repetition of ZLA_Z22_Data
        </span><span style="color: gray">/// </span><span style="color: #c080c0">* (Notes and Comments) - creates it if necessary
        </span><span style="color: gray">/// </span><span style="color: #c080c0">throws HL7Exception if the repetition requested is more than one
        </span><span style="color: gray">///     </span><span style="color: #c080c0">greater than the number of existing repetitions.
        </span><span style="color: gray">///
        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">ZLA_Z22_Data </span><span style="color: #fef1a9">GetZLA_Z22_Data</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">int </span><span style="color: #fef1a9">rep</span><span style="color: #e0e0e0">)
        {
            </span><span style="color: #8080c0">return </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">ZLA_Z22_Data</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">GetStructure</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">_n2</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">rep</span><span style="color: #e0e0e0">);
        }

        </span><span style="color: #c080c0">/**
         * Returns the number of existing repetitions of ZLA_Z22_Data
         */
        </span><span style="color: #8080c0">public int </span><span style="color: #fef1a9">ZLA_Z22_DataRepetitionsUsed
        </span><span style="color: #e0e0e0">{
            </span><span style="color: #8080c0">get
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #8080c0">int </span><span style="color: #fef1a9">reps </span><span style="color: #e0e0e0">= -1;
                </span><span style="color: #8080c0">try
                </span><span style="color: #e0e0e0">{
                    </span><span style="color: #fef1a9">reps </span><span style="color: #e0e0e0">= </span><span style="color: #fef1a9">GetAll</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">_n2</span><span style="color: #e0e0e0">).</span><span style="color: #fef1a9">Length</span><span style="color: #e0e0e0">;
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #8080c0">const string </span><span style="color: #fef1a9">message </span><span style="color: #e0e0e0">= </span><span style="color: #60ff60">"Unexpected error accessing data - this is probably a bug in the source code generator."</span><span style="color: #e0e0e0">;
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">message</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #fef1a9">System</span><span style="color: #e0e0e0">.</span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">message</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">reps</span><span style="color: #e0e0e0">;
            }
        }

        </span><span style="color: #8080ff">#endregion
        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">PID </span><span style="color: #fef1a9">PID
        </span><span style="color: #e0e0e0">{
            </span><span style="color: #8080c0">get
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #c7c7f1">PID </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
                </span><span style="color: #8080c0">try
                </span><span style="color: #e0e0e0">{
                    </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= (</span><span style="color: #c7c7f1">PID</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">GetStructure</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"PID"</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"Unexpected error accessing data - this is probably a bug in the source code generator."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
            }
        }
        </span><span style="color: #8080ff">#region </span><span style="color: #e0e0e0">ZLA_Z22_Insurance
        </span><span style="color: gray">///
        /// </span><span style="color: #c080c0">Returns  first repetition of ZLA_Z22_Insurance (Notes and Comments) - creates it if necessary
        </span><span style="color: gray">///
        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">ZLA_Z22_Insurance </span><span style="color: #fef1a9">GetZLA_Z22_Insurance</span><span style="color: #e0e0e0">()
        {
            </span><span style="color: #c7c7f1">ZLA_Z22_Insurance </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= </span><span style="color: #8080c0">null</span><span style="color: #e0e0e0">;
            </span><span style="color: #8080c0">try
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= (</span><span style="color: #c7c7f1">ZLA_Z22_Insurance</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">GetStructure</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">_n3</span><span style="color: #e0e0e0">);
            }
            </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">)
            {
                </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"Unexpected error accessing data - this is probably a bug in the source code generator."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                </span><span style="color: #8080c0">throw new </span><span style="color: #fef1a9">System</span><span style="color: #e0e0e0">.</span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
            }
            </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
        }

        </span><span style="color: gray">///
        ///</span><span style="color: #c080c0">Returns a specific repetition of ZLA_Z22_Insurance
        </span><span style="color: gray">/// </span><span style="color: #c080c0">* (Notes and Comments) - creates it if necessary
        </span><span style="color: gray">/// </span><span style="color: #c080c0">throws HL7Exception if the repetition requested is more than one
        </span><span style="color: gray">///     </span><span style="color: #c080c0">greater than the number of existing repetitions.
        </span><span style="color: gray">///
        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">ZLA_Z22_Insurance </span><span style="color: #fef1a9">GetZLA_Z22_Insurance</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">int </span><span style="color: #fef1a9">rep</span><span style="color: #e0e0e0">)
        {
            </span><span style="color: #8080c0">return </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">ZLA_Z22_Insurance</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">GetStructure</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">_n3</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">rep</span><span style="color: #e0e0e0">);
        }

        </span><span style="color: #c080c0">/**
         * Returns the number of existing repetitions of ZLA_Z22_Insurance
         */
        </span><span style="color: #8080c0">public int </span><span style="color: #fef1a9">ZLA_Z22_InsuranceRepetitionsUsed
        </span><span style="color: #e0e0e0">{
            </span><span style="color: #8080c0">get
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #8080c0">int </span><span style="color: #fef1a9">reps </span><span style="color: #e0e0e0">= -1;
                </span><span style="color: #8080c0">try
                </span><span style="color: #e0e0e0">{
                    </span><span style="color: #fef1a9">reps </span><span style="color: #e0e0e0">= </span><span style="color: #fef1a9">GetAll</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">_n3</span><span style="color: #e0e0e0">).</span><span style="color: #fef1a9">Length</span><span style="color: #e0e0e0">;
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #8080c0">const string </span><span style="color: #fef1a9">message </span><span style="color: #e0e0e0">= </span><span style="color: #60ff60">"Unexpected error accessing data - this is probably a bug in the source code generator."</span><span style="color: #e0e0e0">;
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">message</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">message</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">reps</span><span style="color: #e0e0e0">;
            }
        }
        </span><span style="color: #8080ff">#endregion
        #region </span><span style="color: #e0e0e0">ZIN
        </span><span style="color: gray">///
        /// </span><span style="color: #c080c0">Returns  first repetition of ZIN (Notes and Comments) - creates it if necessary
        </span><span style="color: gray">///
        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">ZIN </span><span style="color: #fef1a9">GetZIN</span><span style="color: #e0e0e0">()
        {
            </span><span style="color: #c7c7f1">ZIN </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= </span><span style="color: #8080c0">null</span><span style="color: #e0e0e0">;
            </span><span style="color: #8080c0">try
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= (</span><span style="color: #c7c7f1">ZIN</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">GetStructure</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"ZIN"</span><span style="color: #e0e0e0">);
            }
            </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">)
            {
                </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"Unexpected error accessing data - this is probably a bug in the source code generator."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                </span><span style="color: #8080c0">throw new </span><span style="color: #fef1a9">System</span><span style="color: #e0e0e0">.</span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
            }
            </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
        }

        </span><span style="color: gray">///
        ///</span><span style="color: #c080c0">Returns a specific repetition of ZIN
        </span><span style="color: gray">/// </span><span style="color: #c080c0">* (Notes and Comments) - creates it if necessary
        </span><span style="color: gray">/// </span><span style="color: #c080c0">throws HL7Exception if the repetition requested is more than one
        </span><span style="color: gray">///     </span><span style="color: #c080c0">greater than the number of existing repetitions.
        </span><span style="color: gray">///
        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">ZIN </span><span style="color: #fef1a9">GetZIN</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">int </span><span style="color: #fef1a9">rep</span><span style="color: #e0e0e0">)
        {
            </span><span style="color: #8080c0">return </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">ZIN</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">GetStructure</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"ZIN"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">rep</span><span style="color: #e0e0e0">);
        }

        </span><span style="color: #c080c0">/**
         * Returns the number of existing repetitions of ZIN
         */
        </span><span style="color: #8080c0">public int </span><span style="color: #fef1a9">ZINRepetitionsUsed
        </span><span style="color: #e0e0e0">{
            </span><span style="color: #8080c0">get
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #8080c0">int </span><span style="color: #fef1a9">reps </span><span style="color: #e0e0e0">= -1;
                </span><span style="color: #8080c0">try
                </span><span style="color: #e0e0e0">{
                    </span><span style="color: #fef1a9">reps </span><span style="color: #e0e0e0">= </span><span style="color: #fef1a9">GetAll</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"ZIN"</span><span style="color: #e0e0e0">).</span><span style="color: #fef1a9">Length</span><span style="color: #e0e0e0">;
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #8080c0">const string </span><span style="color: #fef1a9">message </span><span style="color: #e0e0e0">= </span><span style="color: #60ff60">"Unexpected error accessing data - this is probably a bug in the source code generator."</span><span style="color: #e0e0e0">;
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">message</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #fef1a9">System</span><span style="color: #e0e0e0">.</span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">message</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">reps</span><span style="color: #e0e0e0">;
            }
        }

        </span><span style="color: #8080ff">#endregion
        #region </span><span style="color: #e0e0e0">DG1
        </span><span style="color: gray">///
        /// </span><span style="color: #c080c0">Returns  first repetition of DG1 (Notes and Comments) - creates it if necessary
        </span><span style="color: gray">///
        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">DG1 </span><span style="color: #fef1a9">GetDG1</span><span style="color: #e0e0e0">()
        {
            </span><span style="color: #c7c7f1">DG1 </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= </span><span style="color: #8080c0">null</span><span style="color: #e0e0e0">;
            </span><span style="color: #8080c0">try
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= (</span><span style="color: #c7c7f1">DG1</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">GetStructure</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"DG1"</span><span style="color: #e0e0e0">);
            }
            </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">)
            {
                </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"Unexpected error accessing data - this is probably a bug in the source code generator."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                </span><span style="color: #8080c0">throw new </span><span style="color: #fef1a9">System</span><span style="color: #e0e0e0">.</span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
            }
            </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
        }

        </span><span style="color: gray">///
        ///</span><span style="color: #c080c0">Returns a specific repetition of DG1
        </span><span style="color: gray">/// </span><span style="color: #c080c0">* (Notes and Comments) - creates it if necessary
        </span><span style="color: gray">/// </span><span style="color: #c080c0">throws HL7Exception if the repetition requested is more than one
        </span><span style="color: gray">///     </span><span style="color: #c080c0">greater than the number of existing repetitions.
        </span><span style="color: gray">///
        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">DG1 </span><span style="color: #fef1a9">GetDG1</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">int </span><span style="color: #fef1a9">rep</span><span style="color: #e0e0e0">)
        {
            </span><span style="color: #8080c0">return </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">DG1</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">GetStructure</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"DG1"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">rep</span><span style="color: #e0e0e0">);
        }

        </span><span style="color: #c080c0">/**
         * Returns the number of existing repetitions of DG1
         */
        </span><span style="color: #8080c0">public int </span><span style="color: #fef1a9">DG1RepetitionsUsed
        </span><span style="color: #e0e0e0">{
            </span><span style="color: #8080c0">get
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #8080c0">int </span><span style="color: #fef1a9">reps </span><span style="color: #e0e0e0">= -1;
                </span><span style="color: #8080c0">try
                </span><span style="color: #e0e0e0">{
                    </span><span style="color: #fef1a9">reps </span><span style="color: #e0e0e0">= </span><span style="color: #fef1a9">GetAll</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"DG1"</span><span style="color: #e0e0e0">).</span><span style="color: #fef1a9">Length</span><span style="color: #e0e0e0">;
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #8080c0">const string </span><span style="color: #fef1a9">message </span><span style="color: #e0e0e0">= </span><span style="color: #60ff60">"Unexpected error accessing data - this is probably a bug in the source code generator."</span><span style="color: #e0e0e0">;
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">message</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #fef1a9">System</span><span style="color: #e0e0e0">.</span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">message</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">reps</span><span style="color: #e0e0e0">;
            }
        }

        </span><span style="color: #8080ff">#endregion
        #region </span><span style="color: #e0e0e0">ZLA_Z22_ProcedureZ
        </span><span style="color: gray">///
        /// </span><span style="color: #c080c0">Returns  first repetition of ZLA_Z22_ProcedureZ (Notes and Comments) - creates it if necessary
        </span><span style="color: gray">///
        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">ZLA_Z22_ProcedureZ </span><span style="color: #fef1a9">GetZLA_Z22_ProcedureZ</span><span style="color: #e0e0e0">()
        {
            </span><span style="color: #c7c7f1">ZLA_Z22_ProcedureZ </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= </span><span style="color: #8080c0">null</span><span style="color: #e0e0e0">;
            </span><span style="color: #8080c0">try
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= (</span><span style="color: #c7c7f1">ZLA_Z22_ProcedureZ</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">GetStructure</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">_n4</span><span style="color: #e0e0e0">);
            }
            </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">)
            {
                </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"Unexpected error accessing data - this is probably a bug in the source code generator."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                </span><span style="color: #8080c0">throw new </span><span style="color: #fef1a9">System</span><span style="color: #e0e0e0">.</span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
            }
            </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
        }

        </span><span style="color: gray">///
        ///</span><span style="color: #c080c0">Returns a specific repetition of ZLA_Z22_ProcedureZ
        </span><span style="color: gray">/// </span><span style="color: #c080c0">* (Notes and Comments) - creates it if necessary
        </span><span style="color: gray">/// </span><span style="color: #c080c0">throws HL7Exception if the repetition requested is more than one
        </span><span style="color: gray">///     </span><span style="color: #c080c0">greater than the number of existing repetitions.
        </span><span style="color: gray">///
        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">ZLA_Z22_ProcedureZ </span><span style="color: #fef1a9">GetZLA_Z22_ProcedureZ</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">int </span><span style="color: #fef1a9">rep</span><span style="color: #e0e0e0">)
        {
            </span><span style="color: #8080c0">return </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">ZLA_Z22_ProcedureZ</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">GetStructure</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">_n4</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">rep</span><span style="color: #e0e0e0">);
        }

        </span><span style="color: #c080c0">/**
         * Returns the number of existing repetitions of ZLA_Z22_ProcedureZ
         */
        </span><span style="color: #8080c0">public int </span><span style="color: #fef1a9">ZLA_Z22_ProcedureZRepetitionsUsed
        </span><span style="color: #e0e0e0">{
            </span><span style="color: #8080c0">get
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #8080c0">int </span><span style="color: #fef1a9">reps </span><span style="color: #e0e0e0">= -1;
                </span><span style="color: #8080c0">try
                </span><span style="color: #e0e0e0">{
                    </span><span style="color: #fef1a9">reps </span><span style="color: #e0e0e0">= </span><span style="color: #fef1a9">GetAll</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">_n4</span><span style="color: #e0e0e0">).</span><span style="color: #fef1a9">Length</span><span style="color: #e0e0e0">;
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #8080c0">string </span><span style="color: #fef1a9">message </span><span style="color: #e0e0e0">= </span><span style="color: #60ff60">"Unexpected error accessing data - this is probably a bug in the source code generator."</span><span style="color: #e0e0e0">;
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">message</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #fef1a9">System</span><span style="color: #e0e0e0">.</span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">message</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">reps</span><span style="color: #e0e0e0">;
            }
        }
        </span><span style="color: #8080ff">#endregion
        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">PV1 </span><span style="color: #fef1a9">PV1
        </span><span style="color: #e0e0e0">{
            </span><span style="color: #8080c0">get
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #c7c7f1">PV1 </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
                </span><span style="color: #8080c0">try
                </span><span style="color: #e0e0e0">{
                    </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= (</span><span style="color: #c7c7f1">PV1</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">GetStructure</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"PV1"</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"Unexpected error accessing data - this is probably a bug in the source code generator."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
            }
        }
        </span><span style="color: #8080ff">#region </span><span style="color: #e0e0e0">NTE
        </span><span style="color: gray">///
        /// </span><span style="color: #c080c0">Returns  first repetition of NTE (Notes and Comments) - creates it if necessary
        </span><span style="color: gray">///
        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">NTE </span><span style="color: #fef1a9">GetNTE</span><span style="color: #e0e0e0">()
        {
            </span><span style="color: #c7c7f1">NTE </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= </span><span style="color: #8080c0">null</span><span style="color: #e0e0e0">;
            </span><span style="color: #8080c0">try
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= (</span><span style="color: #c7c7f1">NTE</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">GetStructure</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"NTE"</span><span style="color: #e0e0e0">);
            }
            </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">)
            {
                </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"Unexpected error accessing data - this is probably a bug in the source code generator."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                </span><span style="color: #8080c0">throw new </span><span style="color: #fef1a9">System</span><span style="color: #e0e0e0">.</span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
            }
            </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
        }

        </span><span style="color: gray">///
        ///</span><span style="color: #c080c0">Returns a specific repetition of NTE
        </span><span style="color: gray">/// </span><span style="color: #c080c0">* (Notes and Comments) - creates it if necessary
        </span><span style="color: gray">/// </span><span style="color: #c080c0">throws HL7Exception if the repetition requested is more than one
        </span><span style="color: gray">///     </span><span style="color: #c080c0">greater than the number of existing repetitions.
        </span><span style="color: gray">///
        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">NTE </span><span style="color: #fef1a9">GetNTE</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">int </span><span style="color: #fef1a9">rep</span><span style="color: #e0e0e0">)
        {
            </span><span style="color: #8080c0">return </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">NTE</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">GetStructure</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"NTE"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">rep</span><span style="color: #e0e0e0">);
        }

        </span><span style="color: #c080c0">/**
         * Returns the number of existing repetitions of NTE
         */
        </span><span style="color: #8080c0">public int </span><span style="color: #fef1a9">NTERepetitionsUsed
        </span><span style="color: #e0e0e0">{
            </span><span style="color: #8080c0">get
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #8080c0">int </span><span style="color: #fef1a9">reps </span><span style="color: #e0e0e0">= -1;
                </span><span style="color: #8080c0">try
                </span><span style="color: #e0e0e0">{
                    </span><span style="color: #fef1a9">reps </span><span style="color: #e0e0e0">= </span><span style="color: #fef1a9">GetAll</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"NTE"</span><span style="color: #e0e0e0">).</span><span style="color: #fef1a9">Length</span><span style="color: #e0e0e0">;
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #8080c0">const string </span><span style="color: #fef1a9">message </span><span style="color: #e0e0e0">= </span><span style="color: #60ff60">"Unexpected error accessing data - this is probably a bug in the source code generator."</span><span style="color: #e0e0e0">;
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">message</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">e</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #fef1a9">System</span><span style="color: #e0e0e0">.</span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">message</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">reps</span><span style="color: #e0e0e0">;
            }
        }

        </span><span style="color: #8080ff">#endregion

        #endregion
    </span><span style="color: #e0e0e0">}
}</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
</td>
</tr>
</tbody>
</table>
</div>
<p><span style="text-decoration: underline;"><strong><a onclick="xcollapse('X1865');return false;" href="#"> </a>Note</strong></span>: This is not the original post. I had to modify it to avoid futher problems with a previous employer. Feel free to contact me for any HL7 questions you may have.</p>
<div id="X1865" style="display: none; background: transparent;">
<table style="background: #181818 none repeat scroll 0% 0%;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top">
<pre class="code"><span style="color: #8080c0">using </span><span style="color: #fef1a9">System</span><span style="color: #e0e0e0">;
</span><span style="color: #8080c0">using </span><span style="color: #fef1a9">NHapi</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Base</span><span style="color: #e0e0e0">;
</span><span style="color: #8080c0">using </span><span style="color: #fef1a9">NHapi</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Base</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Parser</span><span style="color: #e0e0e0">;
</span><span style="color: #8080c0">using </span><span style="color: #fef1a9">NHapi</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Base</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Model</span><span style="color: #e0e0e0">;
</span><span style="color: #8080c0">using </span><span style="color: #fef1a9">NHapi</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Model</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">V24</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Datatype</span><span style="color: #e0e0e0">;
</span><span style="color: #8080c0">using </span><span style="color: #fef1a9">NHapi</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Base</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Log</span><span style="color: #e0e0e0">;

</span><span style="color: #8080c0">namespace </span><span style="color: #fef1a9">ValidationProvider</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">HL7</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">Segment
</span><span style="color: #e0e0e0">{
    </span><span style="color: gray">///
    /// </span><span style="color: #c080c0">Represents a ZXX Segment. This is a locally defined segment
    </span><span style="color: gray">///
    </span><span style="color: #e0e0e0">[</span><span style="color: #c7c7f1">Serializable</span><span style="color: #e0e0e0">]
    </span><span style="color: #8080c0">public sealed class </span><span style="color: #c7c7f1">ZXX </span><span style="color: #e0e0e0">: </span><span style="color: #c7c7f1">AbstractSegment
    </span><span style="color: #e0e0e0">{
        </span><span style="color: #8080c0">public </span><span style="color: #fef1a9">ZXX</span><span style="color: #e0e0e0">(</span><span style="color: #2b91af">IGroup </span><span style="color: #fef1a9">parent</span><span style="color: #e0e0e0">, </span><span style="color: #2b91af">IModelClassFactory </span><span style="color: #fef1a9">factory</span><span style="color: #e0e0e0">): </span><span style="color: #8080c0">base</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">parent</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">factory</span><span style="color: #e0e0e0">)
        {
            </span><span style="color: #2b91af">IMessage </span><span style="color: #fef1a9">message </span><span style="color: #e0e0e0">= </span><span style="color: #fef1a9">Message</span><span style="color: #e0e0e0">;
            </span><span style="color: #8080c0">try
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #fef1a9">add</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">typeof</span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">EI</span><span style="color: #e0e0e0">), </span><span style="color: #8080c0">true</span><span style="color: #e0e0e0">, 0, 1, </span><span style="color: #8080c0">new object</span><span style="color: #e0e0e0">[] { </span><span style="color: #fef1a9">message </span><span style="color: #e0e0e0">}, </span><span style="color: #60ff60">"NroControlDelPrestador"</span><span style="color: #e0e0e0">);
                </span><span style="color: #fef1a9">add</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">typeof</span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">EI</span><span style="color: #e0e0e0">), </span><span style="color: #8080c0">false</span><span style="color: #e0e0e0">,1, 4, </span><span style="color: #8080c0">new object</span><span style="color: #e0e0e0">[] { </span><span style="color: #fef1a9">message </span><span style="color: #e0e0e0">}, </span><span style="color: #60ff60">"NroControlDelFinanciador"</span><span style="color: #e0e0e0">);
                </span><span style="color: #fef1a9">add</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">typeof</span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">CE</span><span style="color: #e0e0e0">), </span><span style="color: #8080c0">false</span><span style="color: #e0e0e0">, 1, 180, </span><span style="color: #8080c0">new object</span><span style="color: #e0e0e0">[] { </span><span style="color: #fef1a9">message </span><span style="color: #e0e0e0">}, </span><span style="color: #60ff60">"EstadoDeLaAutorizacion"</span><span style="color: #e0e0e0">);
                </span><span style="color: #fef1a9">add</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">typeof</span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">EI</span><span style="color: #e0e0e0">), </span><span style="color: #8080c0">false</span><span style="color: #e0e0e0">, 1, 180, </span><span style="color: #8080c0">new object</span><span style="color: #e0e0e0">[] { </span><span style="color: #fef1a9">message </span><span style="color: #e0e0e0">}, </span><span style="color: #60ff60">"NumeroDePreAutorizacion"</span><span style="color: #e0e0e0">);
                </span><span style="color: #fef1a9">add</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">typeof</span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">TS</span><span style="color: #e0e0e0">), </span><span style="color: #8080c0">false</span><span style="color: #e0e0e0">, 1, 180, </span><span style="color: #8080c0">new object</span><span style="color: #e0e0e0">[] { </span><span style="color: #fef1a9">message </span><span style="color: #e0e0e0">}, </span><span style="color: #60ff60">"FechaDeEmisionDePreAutorizacion"</span><span style="color: #e0e0e0">);
                </span><span style="color: #fef1a9">add</span><span style="color: #e0e0e0">(</span><span style="color: #8080c0">typeof</span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">CPMO</span><span style="color: #e0e0e0">), </span><span style="color: #8080c0">false</span><span style="color: #e0e0e0">, 1, 180, </span><span style="color: #8080c0">new object</span><span style="color: #e0e0e0">[] { </span><span style="color: #fef1a9">message </span><span style="color: #e0e0e0">}, </span><span style="color: #60ff60">"ValorDelArancelDelCopago"</span><span style="color: #e0e0e0">);
            }
            </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">)
            {
                </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"Can't instantiate " </span><span style="color: #e0e0e0">+ </span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">().</span><span style="color: #fef1a9">Name</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">);
            }

        }

        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">EI </span><span style="color: #fef1a9">NroControlPrestador
        </span><span style="color: #e0e0e0">{
            </span><span style="color: #8080c0">get
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #c7c7f1">EI </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
                </span><span style="color: #8080c0">try
                </span><span style="color: #e0e0e0">{
                    </span><span style="color: #2b91af">IType </span><span style="color: #fef1a9">t </span><span style="color: #e0e0e0">= </span><span style="color: #fef1a9">GetField</span><span style="color: #e0e0e0">(1,0);
                    </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= (</span><span style="color: #c7c7f1">EI</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">t</span><span style="color: #e0e0e0">;
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(
                        </span><span style="color: #60ff60">"Unexpected problem obtaining field value.  This is a bug."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">Exception </span><span style="color: #fef1a9">ex</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(
                        </span><span style="color: #60ff60">"Unexpected problem obtaining field value.  This is a bug."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">ex</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">ex</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;

            }
        }

        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">EI </span><span style="color: #fef1a9">NroControlFinanciador
        </span><span style="color: #e0e0e0">{
            </span><span style="color: #8080c0">get
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #c7c7f1">EI </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
                </span><span style="color: #8080c0">try
                </span><span style="color: #e0e0e0">{
                    </span><span style="color: #2b91af">IType </span><span style="color: #fef1a9">t </span><span style="color: #e0e0e0">= </span><span style="color: #fef1a9">GetField</span><span style="color: #e0e0e0">(2, 0);
                    </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= (</span><span style="color: #c7c7f1">EI</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">t</span><span style="color: #e0e0e0">;
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(
                        </span><span style="color: #60ff60">"Unexpected problem obtaining field value.  This is a bug."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">Exception </span><span style="color: #fef1a9">ex</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(
                        </span><span style="color: #60ff60">"Unexpected problem obtaining field value.  This is a bug."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">ex</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">ex</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;

            }
        }

        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">CE </span><span style="color: #fef1a9">EstadoAutorizacion
        </span><span style="color: #e0e0e0">{
            </span><span style="color: #8080c0">get
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #c7c7f1">CE </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
                </span><span style="color: #8080c0">try
                </span><span style="color: #e0e0e0">{
                    </span><span style="color: #2b91af">IType </span><span style="color: #fef1a9">t </span><span style="color: #e0e0e0">= </span><span style="color: #fef1a9">GetField</span><span style="color: #e0e0e0">(3, 0);
                    </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= (</span><span style="color: #c7c7f1">CE</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">t</span><span style="color: #e0e0e0">;
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(
                        </span><span style="color: #60ff60">"Unexpected problem obtaining field value.  This is a bug."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">Exception </span><span style="color: #fef1a9">ex</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(
                        </span><span style="color: #60ff60">"Unexpected problem obtaining field value.  This is a bug."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">ex</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">ex</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;

            }
        }

        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">EI </span><span style="color: #fef1a9">NumeroPreAutorizacion
        </span><span style="color: #e0e0e0">{
            </span><span style="color: #8080c0">get
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #c7c7f1">EI </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
                </span><span style="color: #8080c0">try
                </span><span style="color: #e0e0e0">{
                    </span><span style="color: #2b91af">IType </span><span style="color: #fef1a9">t </span><span style="color: #e0e0e0">= </span><span style="color: #fef1a9">GetField</span><span style="color: #e0e0e0">(4, 0);
                    </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= (</span><span style="color: #c7c7f1">EI</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">t</span><span style="color: #e0e0e0">;
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(
                        </span><span style="color: #60ff60">"Unexpected problem obtaining field value.  This is a bug."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">Exception </span><span style="color: #fef1a9">ex</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(
                        </span><span style="color: #60ff60">"Unexpected problem obtaining field value.  This is a bug."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">ex</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">ex</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;

            }
        }

        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">TS </span><span style="color: #fef1a9">FechaEmisionPreAutorizacion
        </span><span style="color: #e0e0e0">{
            </span><span style="color: #8080c0">get
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #c7c7f1">TS </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
                </span><span style="color: #8080c0">try
                </span><span style="color: #e0e0e0">{
                    </span><span style="color: #2b91af">IType </span><span style="color: #fef1a9">t </span><span style="color: #e0e0e0">= </span><span style="color: #fef1a9">GetField</span><span style="color: #e0e0e0">(5, 0);
                    </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= (</span><span style="color: #c7c7f1">TS</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">t</span><span style="color: #e0e0e0">;
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(
                        </span><span style="color: #60ff60">"Unexpected problem obtaining field value.  This is a bug."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">Exception </span><span style="color: #fef1a9">ex</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(
                        </span><span style="color: #60ff60">"Unexpected problem obtaining field value.  This is a bug."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">ex</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">ex</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;

            }
        }
        </span><span style="color: #8080c0">public </span><span style="color: #c7c7f1">CPMO </span><span style="color: #fef1a9">ValorArancelCopago
        </span><span style="color: #e0e0e0">{
            </span><span style="color: #8080c0">get
            </span><span style="color: #e0e0e0">{
                </span><span style="color: #c7c7f1">CPMO </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;
                </span><span style="color: #8080c0">try
                </span><span style="color: #e0e0e0">{
                    </span><span style="color: #2b91af">IType </span><span style="color: #fef1a9">t </span><span style="color: #e0e0e0">= </span><span style="color: #fef1a9">GetField</span><span style="color: #e0e0e0">(6, 0);
                    </span><span style="color: #fef1a9">ret </span><span style="color: #e0e0e0">= (</span><span style="color: #c7c7f1">CPMO</span><span style="color: #e0e0e0">)</span><span style="color: #fef1a9">t</span><span style="color: #e0e0e0">;
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">HL7Exception </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(
                        </span><span style="color: #60ff60">"Unexpected problem obtaining field value.  This is a bug."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">he</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">catch </span><span style="color: #e0e0e0">(</span><span style="color: #c7c7f1">Exception </span><span style="color: #fef1a9">ex</span><span style="color: #e0e0e0">)
                {
                    </span><span style="color: #c7c7f1">HapiLogFactory</span><span style="color: #e0e0e0">.</span><span style="color: #fef1a9">GetHapiLog</span><span style="color: #e0e0e0">(</span><span style="color: #fef1a9">GetType</span><span style="color: #e0e0e0">()).</span><span style="color: #fef1a9">Error</span><span style="color: #e0e0e0">(
                        </span><span style="color: #60ff60">"Unexpected problem obtaining field value.  This is a bug."</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">ex</span><span style="color: #e0e0e0">);
                    </span><span style="color: #8080c0">throw new </span><span style="color: #c7c7f1">Exception</span><span style="color: #e0e0e0">(</span><span style="color: #60ff60">"An unexpected error ocurred"</span><span style="color: #e0e0e0">, </span><span style="color: #fef1a9">ex</span><span style="color: #e0e0e0">);
                }
                </span><span style="color: #8080c0">return </span><span style="color: #fef1a9">ret</span><span style="color: #e0e0e0">;

            }
        }

    }
}</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<p><code><br />
 </code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.brusella.com.ar/index.php/2009/10/working-with-hl7-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>

