tag:blogger.com,1999:blog-46339992980615300842024-03-12T21:27:53.294-07:00HL7 InterfacingHL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.comBlogger40125tag:blogger.com,1999:blog-4633999298061530084.post-58789938751630324122023-05-14T22:23:00.005-07:002023-11-01T21:30:42.083-07:00Manipulating XML Messages with C# in HL7 Soup’s Integration Host<p style="background-color: rgba(255, 255, 255, 0.6); color: #111111; font-family: -apple-system, Roboto, SegoeUI, "Segoe UI", "Helvetica Neue", Helvetica, "Microsoft YaHei", "Meiryo UI", Meiryo, "Arial Unicode MS", sans-serif; font-size: 14px; font-variation-settings: var(--cib-type-body2-font-variation-settings); line-height: var(--cib-type-body2-line-height); margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 10px !important; margin: 10px 0px 0px; padding: 0px; user-select: text; word-break: break-word;"></p><div class="separator" style="clear: both; text-align: center;"><a href="https://th.bing.com/th/id/OIG.vxbc4X.Tvu5d.Fmo0gIC?pid=ImgGn&w=1024&h=1024&rs=1" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" data-original-height="800" data-original-width="800" height="320" src="https://th.bing.com/th/id/OIG.vxbc4X.Tvu5d.Fmo0gIC?pid=ImgGn&w=1024&h=1024&rs=1" width="320" /></a></div>Are you looking for a way to manipulate XML messages using HL7 Soup’s Integration Host using c#? Look no further! In this post, we’ll show you how to use the code below to do just that.<p></p><p style="background-color: rgba(255, 255, 255, 0.6); color: #111111; font-size: 14px; font-variation-settings: var(--cib-type-body2-font-variation-settings); line-height: var(--cib-type-body2-line-height); margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 10px !important; margin: 10px 0px 0px; padding: 0px; user-select: text; word-break: break-word;"><span face="-apple-system, Roboto, SegoeUI, Segoe UI, Helvetica Neue, Helvetica, Microsoft YaHei, Meiryo UI, Meiryo, Arial Unicode MS, sans-serif"><span style="font-family: arial;">In this sample, we'll demonstrate with</span> </span><span style="background-color: rgba(0, 0, 0, 0.02); font-family: monospace; white-space: pre-wrap;">XDocument,</span><span style="background-color: rgba(0, 0, 0, 0.02); white-space: pre-wrap;"><span style="font-family: arial;"> but</span><span style="font-family: helvetica;"> </span></span><span style="background-color: rgba(0, 0, 0, 0.02); font-family: monospace; white-space: pre-wrap;">XmlDocument</span><span style="background-color: rgba(0, 0, 0, 0.02); white-space: pre-wrap;"><span style="font-family: helvetica;"> will work fine too.</span></span></p><p style="background-color: rgba(255, 255, 255, 0.6); color: #111111; font-family: -apple-system, Roboto, SegoeUI, "Segoe UI", "Helvetica Neue", Helvetica, "Microsoft YaHei", "Meiryo UI", Meiryo, "Arial Unicode MS", sans-serif; font-size: 14px; font-variation-settings: var(--cib-type-body2-font-variation-settings); line-height: var(--cib-type-body2-line-height); margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 10px !important; margin: 10px 0px 0px; padding: 0px; user-select: text; word-break: break-word;">First, make sure that the System.Xml.Linq.dll file is correctly referenced in your code. If you can’t find it, don’t worry - the code will still work, but you may see red squiggly lines in the editor. These can be ignored.</p><p style="background-color: rgba(255, 255, 255, 0.6); color: #111111; font-family: -apple-system, Roboto, SegoeUI, "Segoe UI", "Helvetica Neue", Helvetica, "Microsoft YaHei", "Meiryo UI", Meiryo, "Arial Unicode MS", sans-serif; font-size: 14px; font-variation-settings: var(--cib-type-body2-font-variation-settings); line-height: var(--cib-type-body2-line-height); margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 10px !important; margin: 10px 0px 0px; padding: 0px; user-select: text; word-break: break-word;">Next, get the destination message using the <code style="background: rgba(0, 0, 0, 0.02); border-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.2); box-sizing: border-box; margin: 0px 2px; padding: 1px 4px; white-space: pre-wrap;">activityInstance.Message</code> property. Then, load the incoming message into an XDocument object using <code style="background: rgba(0, 0, 0, 0.02); border-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.2); box-sizing: border-box; margin: 0px 2px; padding: 1px 4px; white-space: pre-wrap;">System.Xml.Linq.XDocument.Parse()</code>.</p><p style="background-color: rgba(255, 255, 255, 0.6); color: #111111; font-family: -apple-system, Roboto, SegoeUI, "Segoe UI", "Helvetica Neue", Helvetica, "Microsoft YaHei", "Meiryo UI", Meiryo, "Arial Unicode MS", sans-serif; font-size: 14px; font-variation-settings: var(--cib-type-body2-font-variation-settings); line-height: var(--cib-type-body2-line-height); margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 10px !important; margin: 10px 0px 0px; padding: 0px; user-select: text; word-break: break-word;">From there, you can update the XML as needed. In our example, we add a new <code style="background: rgba(0, 0, 0, 0.02); border-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.2); box-sizing: border-box; margin: 0px 2px; padding: 1px 4px; white-space: pre-wrap;">ValidFrom</code> element to the root of the document. Once you’ve made your changes, get the updated XML using the <code style="background: rgba(0, 0, 0, 0.02); border-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.2); box-sizing: border-box; margin: 0px 2px; padding: 1px 4px; white-space: pre-wrap;">ToString()</code> method and set it as the new text for the root element.</p><p style="background-color: rgba(255, 255, 255, 0.6); color: #111111; font-family: -apple-system, Roboto, SegoeUI, "Segoe UI", "Helvetica Neue", Helvetica, "Microsoft YaHei", "Meiryo UI", Meiryo, "Arial Unicode MS", sans-serif; font-size: 14px; font-variation-settings: var(--cib-type-body2-font-variation-settings); line-height: var(--cib-type-body2-line-height); margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 10px !important; margin: 10px 0px 0px; padding: 0px; user-select: text; word-break: break-word;">Here’s the full code:</p><pre style="background: rgba(0, 0, 0, 0.02); border-radius: 8px; border: 1px solid var(--cib-color-neutral-stroke); box-sizing: border-box; color: #111111; font-size: 14px; margin-bottom: 4px; margin-top: 0px; padding: 6px 10px;"><code class="language-csharp" style="white-space: pre-wrap;"><span class="hljs-comment" style="color: green; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">//Note, the next line might need redirecting to the file System.Xml.Linq.dll on your computer. </span>
<span class="hljs-comment" style="color: green; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">//Another common location is C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.Xml.Linq.dll</span>
<span class="hljs-comment" style="color: green; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">//Even if you can't find it, don't worry. The code will still work, but you will just see red squiggly lines in the editor. These can be ignored - it's only the editor that cannot find them.</span>
<span class="hljs-meta" style="color: #2b91af; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">#r "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Xml.Linq.dll"</span>
<span class="hljs-comment" style="color: green; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">//Get the destination message</span>
<span class="hljs-keyword" style="color: blue; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">var</span> destinationMessage = activityInstance.Message; <span class="hljs-comment" style="color: green; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">//Use IHL7Message for HL7 Messages and IMessage for other message types</span>
<span class="hljs-built_in" style="color: blue; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">string</span> xmlIn = workflowInstance.ReceivingActivityInstance.Message.Text;
workflowInstance.SetVariable(<span class="hljs-string" style="color: #a31515; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">"xmlIn"</span>,xmlIn); <span class="hljs-comment" style="color: green; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">//put into variable to help debugging. Remove once working</span>
<span class="hljs-comment" style="color: green; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">//Load incoming message into an XDocument object</span>
System.Xml.Linq.XDocument doc = System.Xml.Linq.XDocument.Parse(xmlIn);
<span class="hljs-comment" style="color: green; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">//Update as you see fit.</span>
doc.Root.Add(<span class="hljs-keyword" style="color: blue; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">new</span> System.Xml.Linq.XElement(<span class="hljs-string" style="color: #a31515; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">"ValidFrom"</span>, <span class="hljs-string" style="color: #a31515; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">"2021-06-25T11:45:22Z"</span>));
<span class="hljs-comment" style="color: green; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">//Get the updated XML</span>
<span class="hljs-built_in" style="color: blue; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">string</span> xmlString = doc.ToString();
workflowInstance.SetVariable(<span class="hljs-string" style="color: #a31515; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">"xmlOut"</span>,xmlString);<span class="hljs-comment" style="color: green; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">//put into variable to help debugging. Remove once working</span>
<span class="hljs-comment" style="color: green; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">//Set the root element to be the new XML text.</span>
destinationMessage.SetStructureAtPath(<span class="hljs-string" style="color: #a31515; font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);">"Patient"</span>,xmlString); </code></pre><p><span face="-apple-system, Roboto, SegoeUI, "Segoe UI", "Helvetica Neue", Helvetica, "Microsoft YaHei", "Meiryo UI", Meiryo, "Arial Unicode MS", sans-serif" style="background-color: rgba(255, 255, 255, 0.6); color: #111111; font-size: 14px;">We hope this helps you manipulate XML messages with HL7 Soup’s Integration Host! Let us know if you have any questions or comments.</span> </p>HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-36466559588518946462023-03-23T21:15:00.004-07:002023-04-11T21:36:34.267-07:00Execute a database Sub Query on a Database to generate HL7 message with multiple rows of OBX's.<div><span style="font-family: helvetica;">Are you looking to execute a database query in HL7 Soup's Integration Host and generate an HL7 message from it? Well, I have good news for you! It's <a href="https://hl7soup.com/HL7TutorialCreateHL7FromDatabaseRecords.html">super easy</a>. But what if you needed to retrieve multiple rows of data to generate OBX results or similar (RXA, DG1 etc)? This scenario is certainly a little fiddlier as you need to execute a sub-query and loop over those results too in order to generate the segments. In addition, you don't know how many OBX fields might be needed, so you'll have to create them manually.</span></div><div><span style="font-family: helvetica;"><br /></span></div><div><span style="font-family: helvetica;">Thankfully, Integration Host has a very handy Add Segment Transformer, but it can only access the data in the outer query. So, it's one of those places where code is the best option.</span></div><div><span style="font-family: helvetica;"><br /></span></div><div><span style="font-family: helvetica;">In this post, I'll show you how to do it using a Code Transformer, but keep in mind that there are many possible ways you could also achieve this.</span></div><div><span style="font-family: helvetica;"><br /></span></div><div><span style="font-family: helvetica;">Let's start by executing a sub-query to retrieve the patient details. Once we have those details, we'll loop over the results and generate the OBX segments accordingly. Here's the code snippet that does just that:</span></div><div><div><span style="font-family: arial;"><br /></span></div><div><span style="font-family: arial;"><br /></span></div><div></div>
<pre><code class="language-csharp">#r "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.Data.dll"
using System.Data.SqlClient;
IHL7Message destinationMessage = (IHL7Message)activityInstance.Message; //Use IHL7Message for HL7 Messages and IMessage for other message types
IMessage sourceMessage = workflowInstance.ReceivingActivityInstance.Message;
string patientId = sourceMessage.GetValueAtPath("[0]"); //returned patient ID from my database
string connectionString = @"Server=MyServer\sqlexpress;Database=MyDB;User Id=MyUser;Password=abc123;";
using (SqlConnection connection = new SqlConnection(connectionString))
using (SqlCommand command = connection.CreateCommand())
{
//Get the vax records
command.CommandText =$@"Select * from Vax Where PatientID = {patientId}";
connection.Open();
using(SqlDataReader reader = command.ExecuteReader())
{
int c = 0;
while (reader.Read())
{
c++;
//Get the values from the Vax table
string administeredDate = reader.IsDBNull(0) ? null : reader.GetString(0);
string vaccineType = reader.IsDBNull(1) ? null : reader.GetString(1);
decimal? amount = reader.IsDBNull(2) ? null : (decimal?)reader.GetDecimal(2);
string units = reader.IsDBNull(3) ? null : reader.GetString(3);
//insert the values as a new HL7 Segment line
destinationMessage.AddSegment($"OBX|{c}|CE|{vaccineType}||{amount}|{units}||||||F|||{administeredDate}");
}
}
connection.Close();
}</code></pre><pre><code class="language-csharp"><br /></code></pre><pre><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpJxIRK3O8J0UjPRJVXDsRnZCwoD0rqvyKUOUcHomc5-1JZoOeEak3xyPImiGu1a46mYcLC3HHVgfDqj-ALqiWDadZkFiz7Itb296Bx0DfRZSVdaU4zQHtIC6SYMH8hUD0Wwzt35MaSMKX0ycFfakYVLIHb85BHYdAnw7iD-h4l5DgHFNIlXTc7YHopA/s1024/OIG.u7cgSqVF9K7T5.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1024" data-original-width="1024" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpJxIRK3O8J0UjPRJVXDsRnZCwoD0rqvyKUOUcHomc5-1JZoOeEak3xyPImiGu1a46mYcLC3HHVgfDqj-ALqiWDadZkFiz7Itb296Bx0DfRZSVdaU4zQHtIC6SYMH8hUD0Wwzt35MaSMKX0ycFfakYVLIHb85BHYdAnw7iD-h4l5DgHFNIlXTc7YHopA/s320/OIG.u7cgSqVF9K7T5.jpg" width="320" /></a></div><br /><code class="language-csharp"><br /></code></pre>
</div>HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-14702707755077910542023-03-16T18:29:00.001-07:002023-03-16T18:29:09.995-07:00How to update HL7 messages in a loop with HL7 Soup<p><span style="background-color: white;"> <span style="color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; white-space: pre-wrap;">When working with HL7 messages, it is often necessary to modify certain segments within the message. However, when dealing with a large number of segments, it can be difficult to ensure that the message is not modified in unexpected ways during the modification process. This is where the </span><code style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: var(--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600; white-space: pre-wrap;">BeginUpdate</code><span style="color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; white-space: pre-wrap;"> and </span><code style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: var(--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600; white-space: pre-wrap;">EndUpdate</code><span style="color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; white-space: pre-wrap;"> methods come in handy.</span></span></p><p style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;"><span style="background-color: white;">Consider the following code snippet:</span></p><pre style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: #f7f7f8; border-radius: 0.375rem; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #374151; font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; line-height: 1.71429; margin-bottom: 0px; margin-top: 0px; overflow-x: auto; padding: 0px;"><div class="bg-black rounded-md mb-4" style="--tw-bg-opacity: 1; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: rgba(0,0,0,var(--tw-bg-opacity)); border-radius: 0.375rem; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; margin-bottom: 1rem;"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md" style="--tw-bg-opacity: 1; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-text-opacity: 1; --tw-translate-x: 0; --tw-translate-y: 0; align-items: center; background-color: rgba(52,53,65,var(--tw-bg-opacity)); border-top-left-radius: 0.375rem; border-top-right-radius: 0.375rem; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: rgba(217,217,227,var(--tw-text-opacity)); display: flex; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 0.75rem; justify-content: space-between; line-height: 1rem; padding: 0.5rem 1rem; position: relative;"><span style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box;">scss</span><button class="flex ml-auto gap-2" style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; appearance: button; background-image: none; border-color: rgb(217, 217, 227); border-style: solid; border-width: 0px; cursor: pointer; display: flex; font-family: inherit; font-size: 12px; font-weight: inherit; gap: 0.5rem; line-height: inherit; margin: 0px 0px 0px auto; padding: 0px;"><svg class="h-4 w-4" fill="none" height="1em" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" stroke="currentColor" viewbox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"></path><rect height="4" rx="1" ry="1" width="8" x="8" y="2"></rect></svg>Copy code</button></div><div class="p-4 overflow-y-auto" style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; overflow-y: auto; padding: 1rem;"><code class="!whitespace-pre hljs language-scss" style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background: none; border-radius: 0.3em; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: white; font-family: inherit; font-size: inherit; font-weight: inherit; hyphens: none; line-height: 1.5; overflow-wrap: normal; padding: 0.1em; tab-size: 4; white-space: normal; word-break: normal; word-spacing: normal;"><span class="hljs-comment" style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: rgba(255, 255, 255, 0.5);">//Get the current message we are writing as an HL7 Message </span>
IHL7Message destinationMessage = (IHL7Message)activityInstance<span class="hljs-selector-class" style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #df3079;">.Message</span>;
<span class="hljs-comment" style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: rgba(255, 255, 255, 0.5);">//Get all the IN1 Sgments </span>
<span class="hljs-selector-tag" style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box;">var</span> in1 = destinationMessage<span class="hljs-selector-class" style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #df3079;">.GetSegments</span>("IN1");
<span class="hljs-comment" style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: rgba(255, 255, 255, 0.5);">//Set BeginUpdate as we are updating multiple Segments and don't want our list to change untill we complete </span>
destinationMessage<span class="hljs-selector-class" style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #df3079;">.BeginUpdate</span>();
<span class="hljs-comment" style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: rgba(255, 255, 255, 0.5);">//Loop over all the IN1 segments </span>
foreach (var seg in in1) {
<span class="hljs-comment" style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: rgba(255, 255, 255, 0.5);">//remove the individual Segment </span>
destinationMessage<span class="hljs-selector-class" style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #df3079;">.RemoveSegment</span>(seg);
}
<span class="hljs-comment" style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: rgba(255, 255, 255, 0.5);">//Update the message </span>
destinationMessage<span class="hljs-selector-class" style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #df3079;">.EndUpdate</span>();
</code></div></div></pre><p style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;"><span style="background-color: white;">In this code, we retrieve the current message being processed as an HL7 message object called <code style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: var(--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600;">destinationMessage</code>. We then retrieve all the segments in the message that are of type <code style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: var(--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600;">IN1</code>, which is typically used to store insurance information.</span></p><p style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;"><span style="background-color: white;">Next, we call the <code style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: var(--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600;">BeginUpdate</code> method on the message object to indicate that multiple segments will be updated, and the message should not be changed until the updates are complete. We then use a <code style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: var(--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600;">foreach</code> loop to iterate over each <code style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: var(--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600;">IN1</code> segment in the message, and call the <code style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: var(--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600;">RemoveSegment</code> method on the message object to remove each individual <code style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: var(--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600;">IN1</code> segment from the message.</span></p><p style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;"><span style="background-color: white;">Finally, after all the <code style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: var(--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600;">IN1</code> segments have been removed, we call the <code style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: var(--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600;">EndUpdate</code> method on the message object to indicate that the updates are complete, and the message can be modified again.</span></p><p style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;"><span style="background-color: white;">Without the <code style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: var(--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600;">BeginUpdate</code> and <code style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: var(--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600;">EndUpdate</code> methods, it is possible that the message could be modified unexpectedly during the loop, causing issues with subsequent iterations. For example, if we did not use these methods, only the first item would be deleted as the foreach would then reference another message, and the remaining <code style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: var(--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600;">IN1</code> segments would not be removed.</span></p><p style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; margin: 1.25em 0px 0px; white-space: pre-wrap;"><span style="background-color: white;">In summary, when working with HL7 messages and modifying segments within them, it is important to use the <code style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: var(--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600;">BeginUpdate</code> and <code style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: var(--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600;">EndUpdate</code> methods to prevent unexpected modifications to the message. These methods ensure that the message is not updated until all modifications are complete, allowing for safe and efficient modification of large numbers of segments within the message.</span></p>HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-11380564007350202482023-03-16T16:07:00.001-07:002023-03-16T16:07:15.852-07:00Remove multiple segments from an HL7 message with HL7 Soup<p> <span style="font-family: "Calibri Light", sans-serif;">If you're working with HL7 messages, you
may need to remove multiple segments from a message.</span></p>
<p class="MsoNormal"><span style="font-family: "Calibri Light",sans-serif; mso-ascii-theme-font: major-latin; mso-bidi-theme-font: major-latin; mso-fareast-language: EN-NZ; mso-hansi-theme-font: major-latin;">However, if you do it in a loop, you find
that only the first item is removed.
This is because the delete causes the message to be recreated, and all
remaining segments in the loop reference a different message instance.<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: "Calibri Light",sans-serif; mso-ascii-theme-font: major-latin; mso-bidi-theme-font: major-latin; mso-fareast-language: EN-NZ; mso-hansi-theme-font: major-latin;">Try this instead:</span></p><pre style="color: #333333; line-height: 16.25px; margin-bottom: 0px; margin-top: 0px;"><span style="color: green;">//Get the current message we are writing as an HL7 Message</span>
IHL7Message destinationMessage = (IHL7Message)activityInstance.Message;
<span style="color: green;">//Get all the IN1 Sgments</span>
<span style="color: #2b91af;">var</span> in1 = destinationMessage.GetSegments(<span style="color: #a31515;">"IN1"</span>);
<span style="color: green;">//Set BeginUpdate as we are updating multiple Segments and don't want our list to change until we complete</span>
destinationMessage.BeginUpdate();
<span style="color: green;">//Loop over all the IN1 segments</span>
<span style="color: blue;">foreach</span> (<span style="color: #2b91af;">var</span> seg <span style="color: blue;">in</span> in1)
{
<span style="color: green;">//remove the individual Segment </span>
destinationMessage.RemoveSegment(seg);
}
<span style="color: green;">//Update the message</span>
destinationMessage.EndUpdate();</pre><p class="MsoNormal"><span style="font-family: "Calibri Light",sans-serif; mso-ascii-theme-font: major-latin; mso-bidi-theme-font: major-latin; mso-hansi-theme-font: major-latin;">The above example removes all the IN1 segments from an HL7 message. The code
first gets the current message as an HL7 message and then gets all the IN1
segments. It then sets BeginUpdate as it is updating multiple segments and
doesn’t want the list to change until it completes. It then loops over all the
IN1 segments and removes the individual segment. Finally, it updates the
message.</span><o:p></o:p></p>HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-17310260888423865142023-02-28T17:58:00.005-08:002023-11-01T21:22:06.853-07:00Use HL7 Soup Integration Host as an endpoint for transformations<p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://th.bing.com/th/id/OIG.QXpmCsejHc5CwXMh_Bzp?pid=ImgGn" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" data-original-height="800" data-original-width="800" height="352" src="https://th.bing.com/th/id/OIG.QXpmCsejHc5CwXMh_Bzp?pid=ImgGn" width="352" /></a></div><span style="font-family: arial;">HL7 Soup Integration Host can be used as an endpoint to perform quick transformations of HL7, JSON, FHIR, CSV & XML messages by simply configuring a few settings in your Integration Host client.<br /><br />1. Configure an HTTP receiver to be your endpoint. Set up your bindings if you'd like to use variables in your transformations and configure a dummy JSON response like: {"response": "success"} in the message template.<br /><br />2. Add a run code activity. We won't actually run any code in this activity but it allows us to run our transformations.</span><p></p><p><span style="font-family: arial;">3. Empty the code window and add your transformed message to the message template. If you're not sure about transformations, the HL7 Soup team have a library of great <a href="https://www.hl7soup.com/HL7Tutorials.html">tutorials</a> to get you started.</span></p><p><span style="font-family: arial;">4. Go back to your receiver activity. Click the transformers tab and drag the response variable from the Destination (right hand side) box into the Transformers (middle) box. Select your new transformer and right click in the Source Path down the bottom. Select Insert Activity Message and then Run Code Sent Message.</span></p><p><span style="font-family: arial;">And you're done! Now when you send a request to that HTTP receiver it will perform your transformation on the posted data and return the transformed data in the HTTP response!</span><br /></p>Sean Allenhttp://www.blogger.com/profile/15135186431000287511noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-59523954403377048262023-02-25T12:06:00.004-08:002023-02-25T12:06:57.059-08:00Chat GPT jokes about HL7<p> <span style="background-color: #f7f7f8; color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; white-space: pre-wrap;">Once upon a time, there was a hospital that decided to introduce a new soup on its menu. It was called "HL7 soup" and it promised to be a game-changer for hospital nutrition. But as it turned out, the soup was a lot more complicated than anyone had anticipated.</span></p><p style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: #f7f7f8; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;">The first person to try the soup was Dr. Smith, who was on call that evening. He sat down at the cafeteria table and took a sip of the soup. Suddenly, he was hit with a barrage of information - patient records, lab results, medication lists - it was all flooding into his brain.</p><p style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: #f7f7f8; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;">Dr. Smith's eyes widened in surprise. "What the heck is in this soup?" he exclaimed.</p><p style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: #f7f7f8; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;">"It's HL7 soup!" replied the cafeteria worker with a smile.</p><p style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: #f7f7f8; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;">Dr. Smith shook his head in disbelief. "I don't think I can handle this much data right now. Can I just have a regular chicken noodle soup, please?"</p><p style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: #f7f7f8; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;">But the cafeteria worker insisted that HL7 soup was the way to go. "Trust me, Dr. Smith, this soup will change your life," she said.</p><p style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: #f7f7f8; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;">So, Dr. Smith took another sip of the soup. And sure enough, he started to feel a strange sensation in his stomach. It was like his body was trying to parse and process all of the information that was coming in. He began to sweat, and his heart rate started to increase.</p><p style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: #f7f7f8; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;">Suddenly, Dr. Smith keeled over, unconscious. The cafeteria worker rushed to his side, calling for help.</p><p style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: #f7f7f8; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;">The hospital staff quickly discovered that the soup had been created using an HL7 data model, which was designed to help hospitals exchange information between systems. But somehow, the soup had gone awry, and it was causing patients to experience a deluge of data overload.</p><p style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: #f7f7f8; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;">From that day forward, the hospital decided to stick with more traditional soup recipes. And Dr. Smith recovered just fine, but he still couldn't look at a bowl of soup without feeling a little bit queasy.</p><p style="--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: #f7f7f8; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; color: #374151; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; margin: 1.25em 0px 0px; white-space: pre-wrap;">The moral of the story? When it comes to hospital nutrition, sometimes it's best to keep it simple. And if you're going to experiment with new recipes, maybe leave the HL7 data models out of the kitchen.</p>HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-26792211598368017522023-02-14T12:36:00.001-08:002023-02-14T12:36:27.927-08:00HL7 Soup XML attributes<p>HL7 Soup supports attributes in the expressions, however, the binding tree doesn’t show
them as bindable entities. This means you have to manually type in the
path that includes the attribute address. You can do that with an @
followed by the attribute name.</p>
<p class="MsoNormal">For example:<o:p></o:p></p>
<p class="MsoNormal"><span style="color: #003a8c;"><Patient></span><br />
<span style="color: #003a8c;"><ID ext=”test”></span>1000<span style="color: #003a8c;"></ID><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The path for the
extension attribute would be <o:p></o:p></p>
<p class="MsoNormal">Patient<b><span style="color: mediumslateblue;">/</span></b>ID<b><span style="color: mediumslateblue;">/</span></b>@ext<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Note you still need to have a binding and not just
text. So the easiest way is to bind to the field, then manually edit the
path. You can do this in the transformers.<o:p></o:p></p>
<br />HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-5156886385545819282022-11-16T12:04:00.001-08:002022-11-16T12:21:26.660-08:00Loop over HL7 OBX fields and add the results to a database<p><span style="font-family: helvetica;">I needed to loop over OBX segments in an HL7 message, then extract the values and write them to a database.</span></p><p><span style="font-family: helvetica;">There are several ways of doing this, such as calling a sub-workflow, but I wanted a single-step process, so instead I just created the c# code in a Code Activity. It's pretty straightforward. HL7 Soup has <a href="https://hl7soup.com/HL7TutorialCodingCheatSheet.html">a great API for working with HL7</a>, and I use both Looping over segments as well as the simple to use GetValueAtPath. API details can be found here.</span></p><p><span style="font-family: helvetica;">Note that you can also turn this into a reusable activity <a href="https://hl7soup.com/HL7TutorialAddPatientToDatabaseWithActivities.html">following these steps</a>.</span></p><p><span style="font-family: courier;"><span style="color: green;">//Bring in the assemblies that we need that are not included by default.</span><br />
<span style="color: grey;">#</span><span style="color: grey;">r</span> <span style="color: maroon;">"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.Data.dll"</span><br />
<br />
<span style="color: blue;">string</span> connectionString = <span style="color: maroon;">@"Server=xps17\sqlexpress;Database=HL7 Soup;User Id=HL7 Soup;Password=xxx;"</span>;<br />
<span style="color: green;">//Get the message template</span><br />
<span style="color: teal;">IHL7Message</span> message = (<span style="color: teal;">IHL7Message</span>)activityInstance.Message; <span style="color: green;">//Use IHL7Message for HL7 Messages and IMessage for other message types</span><br />
<br />
<span style="color: blue;">using</span> (System.Data.SqlClient.<span style="color: teal;">SqlConnection</span> connection = <span style="color: blue;">new</span> System.Data.SqlClient.<span style="color: teal;">SqlConnection</span>(connectionString))<br />
{<br />
<span style="color: green;">//get other values not in the loop</span><br />
<span style="color: blue;">string</span> patientName = message.GetValueAtPath(<span style="color: maroon;">"PID-5.2"</span>);<br />
<br />
connection.Open();<br />
<br />
<span style="color: green;">//Get all OBX segments and loop over them</span><br />
<span style="color: teal;">IHL7Segments</span> allSegments = message.GetSegments(<span style="color: maroon;">"OBX"</span>);<br />
<span style="color: blue;">foreach</span> (<span style="color: teal;">IHL7Segment</span> segment <span style="color: blue;">in</span> allSegments)<br />
{<br />
<span style="color: green;">//update your database</span><br />
<span style="color: blue;">using</span> (System.Data.SqlClient.<span style="color: teal;">SqlCommand</span> command = connection.CreateCommand())<br />
{<br />
<span style="color: blue;">string</span> obxvalue2 = segment.GetField(2).Text; <br />
<span style="color: blue;">string</span> obxvalue5 = segment.GetField(5).GetComponent(1).Text;<br />
<br />
command.CommandText =<span style="color: maroon;">$"</span><span style="color: maroon;">Insert into MyTable (fieldname, fieldname2,fieldname3) values ('</span>{patientName}<span style="color: maroon;">','</span>{obxvalue2}<span style="color: maroon;">','</span>{obxvalue5}<span style="color: maroon;">')</span><span style="color: maroon;">"</span>;<br />
command.ExecuteNonQuery();<br />
<br />
}<br />
}<br />
connection.Close();<br />
}</span></p>HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-38869848647209799932022-09-21T18:48:00.000-07:002022-09-21T18:48:01.470-07:00HL7 Soup Licensing Proxy error<p><span style="font-family: arial;">I was attempting to license HL7 Soup and Integration Host on a hospital network, but I was getting an error preventing the license number from activating.</span></p><p><span style="font-family: arial;">The problem was that the calls went through a proxy server.</span></p><p><span style="font-family: arial;">The solution was to open the .config file for each app and uncomment the section that tells the proxy server to use the default credentials.</span></p><p><span style="font-family: arial;"> <system.net></span></p><p><span style="font-family: arial;"> <defaultProxy useDefaultCredentials="true"></span></p><p><span style="font-family: arial;"> </defaultProxy></span></p><p><span style="font-family: arial;"></span></p><p><span style="font-family: arial;"> </system.net></span></p><p><span style="font-family: arial;"><br /></span></p><p><span style="font-family: arial;">This isn't credentials for calling the server, just the proxy server.</span></p><p><span style="font-family: arial;"><br /></span></p><p><span style="font-family: arial;"><br /></span></p>HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-32050327415835972862022-08-22T15:38:00.005-07:002022-08-22T15:38:57.391-07:00Integration Host HTTP sender as code<p> The HTTP Sender in HL7 Soup's Integration Host is simple to use, but doesn't expose every possible feature of HTTP messaging. I had to retrieve response headers, and these are not provided back in the UI.</p><p>Fortunately it uses c# in the code activity, so I was able to add the following code to save the day.</p><p><br /></p><p> //The following code is just a indication for getting started for an Activity. Edit or delete as you wish. Use the variable workflowInstance and activityInstance to access the running states of the workflow.</p>
using System.Net;<br />
using System.IO;<br />
<br />
Encoding encoding = Encoding.UTF8;<br />
<br />
using (WebClient client = new WebClient())<br />
{<br />
client.UseDefaultCredentials = true;<br />
<br />
client.Headers.Add("Content-Type","text/plain"); <br />
<br />
//Add all the headers that you want.<br /> // client.Headers.Add("yourHeaderName", workflowInstance.GetVariable("yourVariableName"));<br />
<br />
<br />
byte[] data = null;<br />
<br />
//Payload for posts if you need it.<br />
//var payload = "";<br />
//if (posting the message)<br />
//{<br />
// payload =activityInstance.Message.Text;<br />
// if (payload != null)<br />
// {<br />
// data = encoding.GetBytes(payload);<br />
// }<br />
// else<br />
// {<br />
// data = new byte[] { };<br />
// }<br />
// }<br />
<br />
//credentials<br />
client.Credentials = new NetworkCredential("","");<br />
<br />
<br />
<br />
//Get the method as a string.<br />
string method = "GET";<br />
<br />
string url = HTTP://url.com";<br />
<br />
//Call HTTP Service<br />
string result = "";<br />
if (method == "GET")<br />
{<br />
//Get cannot pass a payload<br />
using (Stream stream = client.OpenRead(url))<br />
{<br />
using (var streamReader = new StreamReader(stream))<br />
{<br />
result = streamReader.ReadToEnd();<br />
}<br />
}<br />
}<br />
else<br />
{<br />
//Post, Put and Delete pass a payload.<br />
var bytes = client.UploadData(url, method, data);<br />
result = encoding.GetString(bytes);<br />
}<br />
<br />
if ( client.ResponseHeaders!=null)<br />
{<br />
foreach (var responseHeader in client.ResponseHeaders)<br />
{<br />
//process your response headers<br />
//e.g.<br />
workflowInstance.SetVariable("MyVariable", responseHeader.ToString());<br />
}<br />
}<br />
<br />
}<br />HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-44693321949449039372022-05-08T15:37:00.008-07:002022-05-08T15:50:25.426-07:00Processing HL7 in the Cloud<p>While Integration Host has long been my preferred program for processing HL7 messages I've only really used it in local settings. Being able to handle workflows in the cloud was something I've wanted to do for a while now so you can imagine my delight when I saw the announcement on their website that their program was now available as a Docker container and that they'd already published a tutorial on getting it up and running on Azure as a container instance. </p><p> It's stupidly easy to get going and the Azure container instance pulls directly from their Dockerhub repo so there's no mucking around with downloading and uploading files. All in all, I can see this being a popular way to use Integration Host going forward.<br /></p>Sean Allenhttp://www.blogger.com/profile/15135186431000287511noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-21300399713307574732022-02-22T01:32:00.003-08:002022-02-22T01:32:27.938-08:00Change HL7 Soup Senders or Receivers to a text Encoding that is not listed<p> Not all text Encodings are listed in the HL7 Soup UI. It makes it too noisy for most users, so only the common ones are there. However, you can change it to any installed encoding via the following steps.</p><p class="MsoNormal"><o:p></o:p></p>
<ol start="1" style="margin-top: 0cm;" type="1">
<li class="MsoListParagraph" style="margin-left: 0cm; mso-list: l0 level1 lfo1;">Create your sender. Set the Encoding to 8859-1 and save it.<o:p></o:p></li>
<li class="MsoListParagraph" style="margin-left: 0cm; mso-list: l0 level1 lfo1;">Close HL7 Soup<o:p></o:p></li>
<li class="MsoListParagraph" style="margin-left: 0cm; mso-list: l0 level1 lfo1;">Load the file in notepad C:\ProgramData\Popokey\HL7Soup\Settings\1\FunctionSettings.json<o:p></o:p></li>
<li class="MsoListParagraph" style="margin-left: 0cm; mso-list: l0 level1 lfo1;">Search in the file for the name of your sender.</li><li class="MsoListParagraph" style="margin-left: 0cm;">Change the Encoding property to your Encoding. Google "C# encodings" if you want to find the official encoding name.</li><li class="MsoListParagraph" style="margin-left: 0cm;">Save the file</li><li class="MsoListParagraph" style="margin-left: 0cm;">Reopen HL7 Soup.</li></ol>
<p class="MsoNormal">Now, if you send with that sender, it will use your
Encoding.<o:p></o:p></p>HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com1tag:blogger.com,1999:blog-4633999298061530084.post-72026981091373868422021-12-13T21:37:00.004-08:002022-03-17T20:52:58.907-07:00Sending Client Certificates with an HTTP Sender in Azure<p>If you are running inside an Azure App Service and you need to send a client certificate with you message, you'll need to follow these steps. </p><p> 1. To configure the location on the key vault in the config "KeyVault:VaultUri". Set it with the URL of your Azure Vault</p><p> 2. Another app setting, set "WEBSITE_LOAD_USER_PROFILE" with the value of "1". Without this you will get the error "The system cannot find the file specified"</p><p> 3. Add a certificate with a private key in the Azure vault. You can generate one in the azure vault.</p><p> 4. Under the App Service settings/Identity/System Assigned, turn status to ON. Copy Object ID</p><p> 5. In the Vault / Access Policies, Add Access Policy. </p><p> 6. Add Secret Permissions (Get)</p><p> 7. Add Certificate Permissions (Get, List)</p><p> 8. Set the Principle to the App Service using the object ID you got at step 4.</p><p><span> </span><span> </span><span> <span> 8.1 Click "Add", and then also click "Save". "Add" doesn't save even though the window closes, and this caused me much frustration.</span></span><br /></p><p> 9. In the workflow, configure the http sender to use the vaults name of the certificate as the thumbprint.</p><p> 10. <a href="https://dotnetcoretutorials.com/2020/11/19/loading-certificates-from-azure-key-vault-in-net-and-getting-it-working-in-azure-app-service/">This </a>was a very helpfull page that enabled me to work all this out</p><p> </p><div>Note: Integration Host stores the certificates once they have been acquired in memory. It costs money and performance to keep pulling the certificate from the vault. If you update the certificate, don't forget to restart the app.</div>HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-80629084510218789772021-12-06T19:49:00.002-08:002021-12-13T21:43:14.621-08:00Create a self-signed Client Certificate for Mutual SSL authentication<p>Here are the instructions for creating a
self-signed Client Certificate for Mutual SSL authentication. These can be used to client authentication in HL7 Soup, Integration Host, and their deployments to AWS and AZURE.</p><p class="MsoNormal"><o:p></o:p></p>
<ul style="margin-top: 0cm;" type="disc">
<li class="MsoListParagraph" style="margin-left: 0cm; mso-list: l0 level1 lfo1;">Install Open SSL. I got it
from here: <a href="https://slproweb.com/products/Win32OpenSSL.html">https://slproweb.com/products/Win32OpenSSL.html</a>.
It requires a $10 paypal donation.<o:p></o:p></li>
<li class="MsoListParagraph" style="margin-left: 0cm; mso-list: l0 level1 lfo1;">Run Win64 OpenSSL Command Prompt from your start menu.<o:p></o:p></li>
<li class="MsoListParagraph" style="margin-left: 0cm; mso-list: l0 level1 lfo1;">CD to the directory you will create your certificate<o:p></o:p></li>
<li class="MsoListParagraph" style="margin-left: 0cm; mso-list: l0 level1 lfo1;">Execute the following commands.
You will want to run them one at a time, and they will ask you for
details about your business. Fill
it all out:<o:p></o:p></li>
</ul>
<p class="MsoNormal" style="margin-left: 36pt;">openssl ecparam
-name prime256v1 -genkey -noout -out client1.key<o:p></o:p></p>
<p class="MsoNormal" style="margin-left: 36pt;">openssl req -new
-sha256 -key client1.key -out client1.csr<o:p></o:p></p>
<p class="MsoNormal" style="margin-left: 36pt;">openssl x509
-signkey client1.key -req -in client1.csr -out client1.crt -days 1000 -sha256 <o:p></o:p></p>
<p class="MsoNormal" style="margin-left: 36pt;">openssl pkcs12
-export -out client1.pfx -inkey client1.key -in client1.crt <o:p></o:p></p>
<ul style="margin-top: 0cm;" type="disc">
<li class="MsoListParagraph" style="margin-left: 0cm; mso-list: l0 level1 lfo1;">Double-Click the PFX to install it into your user certificates.<o:p></o:p></li>
</ul>
<p class="MsoNormal">Very handy<span face=""Segoe UI Emoji",sans-serif" style="mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-theme-font: minor-bidi; mso-char-type: symbol-ext; mso-fareast-language: EN-US; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-symbol-font-family: "Segoe UI Emoji";">😊</span><o:p></o:p></p><p class="MsoNormal">Edit:</p><p class="MsoNormal">The Azure Certificate Vault also allows you to generate a certificate that has everything you need. It was very easy to do. You can then export it as a PFX. </p>HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-57265773245343074222021-11-10T13:05:00.005-08:002021-11-10T13:09:51.965-08:00OID for MSH-3<p>A lot of the state COVID reporting requires that the MSH-3 uses an OID in their HL7 for the sending application. Yeah, I normally use a human-readable code as a preference as I think that's more helpful, but some states require it.</p><p>HL7 Soup OID is:</p><p><span face=""Arial",sans-serif" style="font-size: 10pt; mso-ansi-language: EN-NZ; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin;">2.16.840.1.113883.2.18.83.1</span></p><p>Integration Host OID is:</p><p><span face="Arial, sans-serif" style="font-size: 13.3333px;">2.16.840.1.113883.2.18.83.2</span></p><p><span face="Arial, sans-serif" style="font-size: 13.3333px;">So you end up with a message that looks like</span></p><p><span style="color: #005aac; font-weight: bold;">MSH</span><span style="color: #007acc; font-weight: bold;">|</span><span style="color: green; font-weight: bold;">^</span><span style="color: deeppink; font-weight: bold;">~</span><span style="color: purple; font-weight: bold;">\</span><span style="color: mediumslateblue; font-weight: bold;">&</span><span style="color: #007acc; font-weight: bold;">|</span>HL7Soup<span style="color: green; font-weight: bold;">^</span>2.16.840.1.113883.2.18.83.2<span style="color: green; font-weight: bold;">^</span>ISO<span style="color: #007acc; font-weight: bold;">|</span>Instance1</p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://lh3.googleusercontent.com/-ZNz6Gc0cHYE/YYw0ADikakI/AAAAAAAARk0/uOB8fQu5c3EBHYyV23JFrkXHVTeyBNllwCLcBGAsYHQ/image.png" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="367" data-original-width="808" height="205" src="https://lh3.googleusercontent.com/-ZNz6Gc0cHYE/YYw0ADikakI/AAAAAAAARk0/uOB8fQu5c3EBHYyV23JFrkXHVTeyBNllwCLcBGAsYHQ/w452-h205/image.png" width="452" /></a></div><br /><br /><p></p>HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-82252141738009131792021-11-04T21:16:00.003-07:002021-11-04T21:16:41.836-07:00Updating a database for each OBX in HL7<p>The other day I needed to loop over each OBX segment in my message, and call an INSERT statement (or Stored Procedure) in my database. I know there are many ways to do this, but this was so simple that I thought it was worth sharing.</p><p>Obviously, in Integration Host (HL7 Soup), the trick is to build up a variable inside a ForEach transformer loop. With each iteration, append the variable with another INSERT statement. Add a semicolon at the end of your line to separate this query from the previous.</p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://lh3.googleusercontent.com/-y_lKkGX9_Io/YYSs-sKgk9I/AAAAAAAARkI/EglOiNP_3vUimZ5sdhSuF5x_Vxa4CegrwCLcBGAsYHQ/image.png" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="523" data-original-width="1185" height="290" src="https://lh3.googleusercontent.com/-y_lKkGX9_Io/YYSs-sKgk9I/AAAAAAAARkI/EglOiNP_3vUimZ5sdhSuF5x_Vxa4CegrwCLcBGAsYHQ/w659-h290/image.png" width="659" /></a></div><p><br /></p>Note how I am setting the Query variable with its value first. This builds up the text with each iteration.<p></p><p>Now you just head over to your Database Query activity and insert (right-click option) your variable as the Query Text.</p><p>How super simple was that! All done in a couple of minutes.</p><p>The only thing to watch out for is that this would be open to a SQL Injection, so only do it for controlled/sanitised data that doesn't allow Mr Johnny Drop Tables to crash your system.<br /><br /></p><p>It's all very much like <a href="https://www.hl7soup.com/HL7TutorialAddRepeatOBXValuesToCSV.html" target="_blank">this tutorial</a> if you want help getting going.</p>HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-80762576638952000292021-09-16T16:13:00.000-07:002021-09-16T16:13:08.283-07:00Looping over repeating OBX values and updating the segment <p><span style="font-family: arial;">I regularly need to update HL7 messages as the data flows between systems. Often, it's significantly cheaper to take the feed designed for another integration and massage the HL7 message before passing it onto your integration. </span></p><p><span style="font-family: arial;">With Integration Host you generally just remap using the Transformers and it's all very simple. But the other day I got a wee bit tangled when trying to update OBX values.</span></p><p><span style="font-family: arial;">I wanted to loop over each OBX segment, look at the value in the OBX-3.4, then use some conditions and lookup tables (note: loving <a href="https://hl7soup.com/IntegrationHostLookupTables.html">lookup tables</a> right now) to alter the value before inserting it back into the OBX-3.2.</span></p><p><span style="font-family: arial;">So I used a FOREACH transformer to loop over the OBX values, then put the OBX-3.4 into a variable that I then updated to the value I needed. This was all easy, but the trick came when I tried to write the value back into the same OBX line the FOREACH was on. My mapping just wrote each value into the first segment, overwriting it each time, leaving the last in place. This stumped me for a bit and I contacted HL7 Soup support.</span></p><p><span style="font-family: arial;">It turns out that the loop is only looping over the incoming OBX values, not
the outgoing ones, so you can’t use it to set the value in the destination
message. Rather you need to create a different HL7 path for each
iteration and set that value. Apparently, they looked at creating a feature in the
UI to allow this several times, but it turns out that code is by far the
easiest way:</span></p><p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family: courier;"><span style="color: green;">//Update the OBX-3.2 on the same
index as the for each loop.</span><br />
<span style="color: teal;">IHL7Message</span> destinationMessage
= (<span style="color: teal;">IHL7Message</span>)activityInstance.Message;<br />
<span style="color: blue;">string</span> path = <span style="color: maroon;">$"OBX[</span>{workflowInstance.GetVariable(<span style="color: maroon;">"ForEachIterator"</span>)}<span style="color: maroon;">]-3.2"</span>;<br />
destinationMessage.SetValueAtPath(path, workflowInstance.GetVariable(<span style="color: maroon;">"UpdatedValueVariable"</span>));</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family: arial;">Above, you can see that you just construct the path we wish to write to using the forEachIterator variable (which is automatically populated by the FOREACH Transformer), then
set the path in the destination message with the needed value - the variable "UpdatedValueVariable" in my case.</span></p><p class="MsoNormal"><o:p></o:p></p>HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-55517291524523536002021-09-16T15:38:00.001-07:002021-09-16T15:38:20.931-07:00Extracting HL7 Fields out of File Names with HL7 Soup<p>Sometimes when generating an HL7 message, the trigger or source of the message is a file that doesn't contain parsable data such as a PDF. It's a fairly common practice to use the 255 filename characters to include some additional metadata. This post shows how to access the filename and then how to extract the values.</p><p>Integration Host makes accessing the filename very easy. If you have a Directory scanner the filename is automatically put into a variable for you to use "<span style="color: maroon; font-family: Calibri, sans-serif; font-size: 11pt;">DirectoryScannerFileName"</span>. The value includes the filename and extension, so it's pretty convenient to use if you just want to update the same file, but as we want to use the values, we need to remove the extension and split that metadata out.</p><p>To do this I used a Code Transformer with the following code:</p><p class="MsoNormal"><span style="font-family: courier;"><span style="color: green;">//Get the destination message</span><br />
<span style="color: teal;">IHL7Message</span> destinationMessage
= (<span style="color: teal;">IHL7Message</span>)activityInstance.Message; <br />
<br />
<span style="color: green;">//Get the filename</span><br />
<span style="color: blue;">string</span> fileName
= workflowInstance.GetVariable(<span style="color: maroon;">"DirectoryScannerFileName"</span>);<br />
<br />
<span style="color: green;">//Remove the extension</span><br />
fileName = System.IO.<span style="color: teal;">Path</span>.GetFileNameWithoutExtension(fileName);<br />
<br />
<span style="color: green;">//split it by the _ character</span><br />
<span style="color: blue;">string</span>[] values = fileName.Split(<span style="color: maroon;">'_'</span>);<br />
<br />
<span style="color: green;">//Write the values to their HL7
location. I've just put them in dummy locations for now, as you can
change them</span><br />
<span style="color: green;">//Note, that to use this the filename must have the
correct number of values or you will get an error.</span><br />
destinationMessage.SetValueAtPath(<span style="color: maroon;">"PV1-19"</span>,
values[0]);<br />
destinationMessage.SetValueAtPath(<span style="color: maroon;">"PV1-20"</span>,
values[1]);<br />
destinationMessage.SetValueAtPath(<span style="color: maroon;">"PV1-21"</span>,
values[2]);</span><b><o:p></o:p></b></p><p>It's pretty straightforward. You can see that I get the variable with the filename, then remove the extension, followed by splitting it by the "_" character.</p><p>Then it's just a matter of placing each value where I want it. I've put it into the PV1-19 to 21, but you can use whichever location you need.</p><p>The one thing to note is that I've written this to error if the number of fields required isn't provided. I prefer this outcome rather than proceeding even if the filename doesn't have all the values, but others may wish to put an IF condition around it to only add the values if the right number of fields exist.</p>HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-56694322069541938562020-10-03T22:52:00.003-07:002020-10-03T22:52:53.733-07:00I'm back<p>Sorry about the missing me...</p><p>I'm still doing this HL7 and FHIR Integrations but have been really busy with it. Also, I'm now using <a href="https://www.hl7soup.com/IntegrationHostIntro.html">Integration Host</a> as my Integration Engine, so don't really have the pain anymore that required this blog. However, I know it's helped a few of your out there, so I'll try and make sure I add in some of the steps I perform. I've updated a couple of my old posts too as Mirth Connect is now called NextGen Connect. I still use "Connect" at a number of sites, but avoid it when possible. HL7 Soup's much cheaper when you add in your time, it's a no brainer (heck, even <a href="https://www.lyniate.com/rhapsody/">Lyniate's </a>cheaper than "Mirth" when you include your time).</p><p><br /></p>HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com2tag:blogger.com,1999:blog-4633999298061530084.post-44435928686163475612020-10-03T21:55:00.003-07:002020-10-03T21:55:23.038-07:00Double double-quotes in HL7<p>Firstly, what does it mean?</p><p><span style="font-family: courier;"><span style="color: #005aac; font-weight: bold;">PID</span><span style="color: #007acc; font-weight: bold;">||</span><span style="background-color: #fcff01;">""</span><span style="color: #007acc; font-weight: bold;">|</span>564346<span style="color: green; font-weight: bold;">^^^</span>MRN<span style="color: green; font-weight: bold;">^</span>MR</span></p><p>The simple answer is that the value represents blank. But that raises the next question: Isn't that the same as just leaving it blank?</p><p>No. In HL7, if nothing is between the pipes it means that the value wasn't provided, or that it isn't known by the sending system. That means that if you receive an update patient message, for example, where the patient's surname name is not provided in the PID-5.1, you should leave your records as they are. It would be wrong to update your database to nothing in this instance.</p><p>However, if you receive an "" then the sending system is telling you to update your database value to nothing, even if you have a value. Yep, it's a way to blank out your value.</p><p>To me it feels like an awkward extension to HL7, I can picture when some tech in the early '90s pointed out this need and it got fudged into the HL7 structure. However, it is what it is...</p><p>But then the important question is how to deal with it?</p><p>Well, now that I do my integrations in HL7 Soup's Integration Host, things have become simpler (yeah, like everything else).</p><p>Any binding between messages or variables supports a right-click option to "HL7 Encode with Quotes" that will automatically add the quotes into any value if it's omitted. Great if you're converting data in your system or another file to HL7 and want to put in the "" when it's blank to update the other system (without having to write code all the time!)</p><p>And the reverse is there too. Say you receive an HL7 message and don't have the capacity in your web services to handle the "" value, well, you can right-click and "HL7 Decode with Quotes" and any "" value will be converted to an empty string of text. </p><p>Even better, these functions will also handle the & and pipes that may occur to. </p><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-gh4nAhD1VhY/X3lVoU_PWaI/AAAAAAAAJ2I/yVcUB7XEQXUdvCb1-uHJgdOSZz5Yd35hwCLcBGAsYHQ/s1022/2020-10-04_17-44-09.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="768" data-original-width="1022" height="410" src="https://1.bp.blogspot.com/-gh4nAhD1VhY/X3lVoU_PWaI/AAAAAAAAJ2I/yVcUB7XEQXUdvCb1-uHJgdOSZz5Yd35hwCLcBGAsYHQ/w546-h410/2020-10-04_17-44-09.png" width="546" /></a></div><br /><p><br /></p>HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-30862531334079447582018-11-08T16:21:00.005-08:002018-11-08T16:21:56.159-08:00Writing Base64 encoded HL7 data to a Binary file<div class="MsoNormal">
It is common to have Base64 encode data in an OBX-5 field. The most common I've come across are PDF documents, but also .Doc, Docx and other Document formats are common, as are the many image formats - TIFF, PNG, JPG, and BMP.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
HL7 Soup is now my go-to HL7 integration engine for binary formats as it's just so simple, while at the same time it's totally flexible. Let me show you. </div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Create a receiver workflow that receives an HL7 message and then writes it out to a file.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-NHQ03j6NO3w/W-TN_5cuzBI/AAAAAAAAAno/1OEITgDYjd4O_1pivQkhZ0XjYZFshi7EQCLcBGAs/s1600/2018-11-09_12-57-49.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="251" data-original-width="179" height="200" src="https://1.bp.blogspot.com/-NHQ03j6NO3w/W-TN_5cuzBI/AAAAAAAAAno/1OEITgDYjd4O_1pivQkhZ0XjYZFshi7EQCLcBGAs/s200/2018-11-09_12-57-49.jpg" width="142" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
In the transformers of the “File Writer” activity, drag the OBX-5 into the transformers list to create a new variable.<o:p></o:p></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-XmQXwSoUNYY/W-TN-gg-l3I/AAAAAAAAAns/2gFsEhUGSzYlUYo9KWzFqtGwS3SNlk24gCEwYBhgL/s1600/2018-11-09_12-13-23.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="353" data-original-width="700" height="201" src="https://2.bp.blogspot.com/-XmQXwSoUNYY/W-TN-gg-l3I/AAAAAAAAAns/2gFsEhUGSzYlUYo9KWzFqtGwS3SNlk24gCEwYBhgL/s400/2018-11-09_12-13-23.jpg" width="400" /></a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<!--[if gte vml 1]><v:shapetype id="_x0000_t75" coordsize="21600,21600"
o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f"
stroked="f">
<v:stroke joinstyle="miter"/>
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype><v:shape id="Picture_x0020_1" o:spid="_x0000_i1025" type="#_x0000_t75"
alt="" style='width:363pt;height:183pt'>
<v:imagedata src="file:///C:/Users/jason/AppData/Local/Temp/msohtmlclip1/01/clip_image001.jpg"
o:href="cid:image001.jpg@01D47829.40195020"/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Then back in the “File Writer” change the message template to write out the variable (delete the default message template, the right click in message template and insert variable).<o:p></o:p></div>
<div class="MsoNormal">
<!--[if gte vml 1]><v:shape id="Picture_x0020_2" o:spid="_x0000_i1026"
type="#_x0000_t75" alt="" style='width:361.65pt;height:274.65pt'>
<v:imagedata src="file:///C:/Users/jason/AppData/Local/Temp/msohtmlclip1/01/clip_image003.jpg"
o:href="cid:image003.jpg@01D47829.40195020"/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-awu21_lEVj0/W-TN-lagqQI/AAAAAAAAAns/92kGk2catxERnUvfiHQg-yoItlpsIRIbQCEwYBhgL/s1600/2018-11-09_12-21-50.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="519" data-original-width="684" height="302" src="https://1.bp.blogspot.com/-awu21_lEVj0/W-TN-lagqQI/AAAAAAAAAns/92kGk2catxERnUvfiHQg-yoItlpsIRIbQCEwYBhgL/s400/2018-11-09_12-21-50.jpg" width="400" /></a></div>
<br />
<div class="MsoNormal">
Now Just change the message type of the file you want to write to binary and you’ll have a binary file.<o:p></o:p></div>
<div class="MsoNormal">
<!--[if gte vml 1]><v:shape id="Picture_x0020_4" o:spid="_x0000_i1027"
type="#_x0000_t75" alt="" style='width:363pt;height:207.65pt'>
<v:imagedata src="file:///C:/Users/jason/AppData/Local/Temp/msohtmlclip1/01/clip_image005.jpg"
o:href="cid:image004.jpg@01D47829.40195020"/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-CINiQkIERSU/W-TQPiCSZGI/AAAAAAAAAoE/X06S-Gjvg-IIFtyVKWcZS3LjktDO10L3gCLcBGAs/s1600/2018-11-09_13-08-55.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="489" data-original-width="697" height="448" src="https://3.bp.blogspot.com/-CINiQkIERSU/W-TQPiCSZGI/AAAAAAAAAoE/X06S-Gjvg-IIFtyVKWcZS3LjktDO10L3gCLcBGAs/s640/2018-11-09_13-08-55.jpg" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="MsoNormal">
And that is it done. Writing out a binary file automatically decodes the value from base64. No mucking about with code or anything fiddly like that. <o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
OK, but what if it wasn’t actually binary data, you just had base64 encoded text for instance? Well, you also have the option to right click on the variable and tell it to base64 decode the value like so. <o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-HcrMiOxCpDo/W-TN-2R6pKI/AAAAAAAAAn0/FA7_-1HWcQA1UgAXg52L0A41XwCXLrH9QCEwYBhgL/s1600/2018-11-09_12-24-22.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="610" data-original-width="676" height="576" src="https://3.bp.blogspot.com/-HcrMiOxCpDo/W-TN-2R6pKI/AAAAAAAAAn0/FA7_-1HWcQA1UgAXg52L0A41XwCXLrH9QCEwYBhgL/s640/2018-11-09_12-24-22.jpg" width="640" /></a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<br />
<div class="MsoNormal">
There are lots of different types of encoding available too. Depending on the Message Type you select, you get different options. E.g. if I had written out an XML document then right-clicking on the variable would allow me to "XML Encode" the data which replaces the &'s &amp; etc.<o:p></o:p></div>
HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com7tag:blogger.com,1999:blog-4633999298061530084.post-72298636892660393142018-08-12T16:16:00.001-07:002020-10-03T22:12:54.269-07:00Get Patient Email Address from HL7 repeat FieldsThe HL7 inbound messages I was receiving were a bit inconsistent on where to find the patient emails. Basically, I need to look at the PID-14 and all repeating instances of this, one at a time until I find an email address.<br />
It sounded to me like a good opportunity to try out HL7 Soups custom parameters, where I can code up my logic in c#.<br />
<br />
Firstly I went through there <a href="http://www.hl7soup.com/HL7TutorialCustomTransformers.html">introduction video on custom transformers</a>, and then grabbed the sample code to base mine transformer on. <br />
<br />
I must say that I love the API, it makes coding with HL7 super easy. The trick I found is to make sure you typecast the messages to IHL7Message right at the beginning. It gives you heaps more methods and properties than the basic IMessage type (which is generic because it also works with JSON, CSV, etc).<br />
<br />
The only thing I tripped up on was finding the repeat fields themselves. I thought they may have been accessible on the GetFields() method, so I mucked around there for a bit. But actually, they are a property of IField. I just needed to call GetRelatedRepeatFields(), and it gave me an iterator that included the original field and its siblings.<br />
<br />
The deployment was easy, and I loved the <a href="http://www.hl7soup.com/HL7TutoriaDebugActivitiesWithVisualStudio.html">debugging right in Visual Studio</a>. So much easier than having to log out each line like in Mirth.<br />
<br />
Anyway, here is the code I created, hope it helps.<br />
<br />
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System.Collections.Generic;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System.ComponentModel;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System.Linq;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System.Text;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System.Threading.Tasks;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> HL7Soup.Integrations;<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">namespace</span><span style="font-family: Consolas; font-size: 9.5pt;"> CustomTransformersSample<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;"> [Variable(</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">"Patient
Email"</span><span style="font-family: Consolas; font-size: 9.5pt;">,
</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">"<a href="mailto:sample@sample.com">sample@sample.com</a>"</span><span style="font-family: Consolas; font-size: 9.5pt;">)]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;"> [DisplayName(</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">"Find Patient
Email"</span><span style="font-family: Consolas; font-size: 9.5pt;">)]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">public</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">class</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;">FindPatientEmail</span><span style="font-family: Consolas; font-size: 9.5pt;"> : CustomTransformer<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">public</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">override</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">void</span><span style="font-family: Consolas; font-size: 9.5pt;">
Transform(IWorkflowInstance workflowInstance, IMessage message, Dictionary<</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">string</span><span style="font-family: Consolas; font-size: 9.5pt;">, </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">string</span><span style="font-family: Consolas; font-size: 9.5pt;">> parameters)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">string</span><span style="font-family: Consolas; font-size: 9.5pt;"> email = </span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">""</span><span style="font-family: Consolas; font-size: 9.5pt;">;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
</span><span style="color: green; font-family: Consolas; font-size: 9.5pt;">//Get the
incoming message</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
IHL7Message hl7 = workflowInstance.Activities[0].Message </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">as</span><span style="font-family: Consolas; font-size: 9.5pt;"> IHL7Message;<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
</span><span style="color: green; font-family: Consolas; font-size: 9.5pt;">//Find
the PID-14</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
IHL7Field pid14 = (IHL7Field)hl7.GetPart(</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">"PID-14"</span><span style="font-family: Consolas; font-size: 9.5pt;">);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">if</span><span style="font-family: Consolas; font-size: 9.5pt;"> (pid14 != </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">null</span><span style="font-family: Consolas; font-size: 9.5pt;">)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
{<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
</span><span style="color: green; font-family: Consolas; font-size: 9.5pt;">//Look at
all the PID 14s</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">foreach</span><span style="font-family: Consolas; font-size: 9.5pt;"> (var repeatField </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">in</span><span style="font-family: Consolas; font-size: 9.5pt;">
pid14.GetRelatedRepeatFields())<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
{<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
</span><span style="color: green; font-family: Consolas; font-size: 9.5pt;">//Get the
4th component (which is email)</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
IHL7Component component = repeatField.GetComponent(</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">"4"</span><span style="font-family: Consolas; font-size: 9.5pt;">);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">if</span><span style="font-family: Consolas; font-size: 9.5pt;"> (component != </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">null</span><span style="font-family: Consolas; font-size: 9.5pt;"> &&
component.Text != </span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">""</span><span style="font-family: Consolas; font-size: 9.5pt;">)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
{<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
</span><span style="color: green; font-family: Consolas; font-size: 9.5pt;">//Found
the email. Return it.</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
email = component.Text;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">break</span><span style="font-family: Consolas; font-size: 9.5pt;">;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
}<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
}<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
}<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">
workflowInstance.SetVariable(</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">"Patient Email"</span><span style="font-family: Consolas; font-size: 9.5pt;">, email);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<br />
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-1279123753737228692017-08-10T02:49:00.000-07:002017-08-10T02:49:04.858-07:00Update HL7 Soup Example messagesWhen you load up HL7 Soup you are presented with a selection of example HL7 messages. They are great to get you going, but won't necessarily be what you normally need at start-up.<br />
You may want your own message samples, or maybe you just want a blank page. The great thing is that you can change these by simply making your changes and clicking save.<br />
You can add your own HL7 messages, delete the ones you don't like, or edit the defaults to your hearts content. Just click save when you are done, and you'll be confronted with your changes when you next load HL7 Soup.<br />
<br />
So where is this stored? Well, I did a bit of hunting and found the file is stored at<br />
<br />
%appdata%\hl7soup\Sample HL7 Messages.txt<br />
<br />
You can just put your own file in its place too and it will be picked up as the HL7 Soup default.<br />
<br />
One last thing, you might want to revert to the HL7 Soup default messages again. I found a simple workaround that recovers these. Just delete the file I mentioned above and when you reload HL7 Soup it will add it back in with the original sample HL7 messages. Very handy.<br />
<br />
<br />
HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com3tag:blogger.com,1999:blog-4633999298061530084.post-54677478879909514742016-11-03T22:51:00.001-07:002017-05-18T03:18:09.290-07:00Setting the Encoding in HL7 SoupI’ve been working on an integration to an old HL7 system where all the messages are encoded with ASCII. This was causing values like µmol/L to show as ?mol/L in HL7 Soup. It also impacts characters like the copyright © symbol.<br />
<br />
OK, so there was a very simple fix – I just had to upgrade to the latest version of HL7 Soup, then everything just started working. However, in the process, I found out some new encoding features.<br />
You can actually set the encoding that is to be used in the HL7 Soup config file.<br />
<br />
Navigate to the HL7 Soup Config file found at<br />
C:\Program Files (x86)\Popokey\HL7 Soup\HL7Soup.exe.config<br />
And copy it to your desktop.<br />
<br />
Open it up in notepad and locate the Encoding setting<br />
<br />
<span style="font-family: Consolas;"><setting name="<span style="background-color: yellow;">Encoding</span>" serializeAs="String"><br /> <value>Default</value><br /></setting></span><br />
<span style="font-family: Consolas;"><br /></span>
The Default option suggests that loading or sending HL7 messages will use the default encoding on the PC, which is most likely ISO-8859-1. I think that the Default will be the best for most users, but the option is still there if you need to force a change.<br />
<span style="font-family: Consolas;"><br /></span>
<span style="font-family: Consolas;"></span> <br />
<i>To change the HL7 message encoding to ASCII</i><br />
<span style="font-family: Consolas;"><setting name="Encoding" serializeAs="String"><br /> <value><span style="background-color: yellow;">ASCII</span></value><br /></setting></span><br />
<span style="font-family: Consolas;"><br /></span>
<br />
<i>To change the HL7 message encoding to</i><i> UTF-8</i><br />
<span style="font-family: Consolas;"><setting name="Encoding" serializeAs="String"><br /> <value><span style="background-color: yellow;">UTF-8</span></value><br /></setting></span><br />
<span style="font-family: Consolas;"><i><br /></i></span>
<i>To change the HL7 message encoding to</i><i> ISO-8859-1</i><br />
<span style="font-family: Consolas;"><setting name="Encoding" serializeAs="String"><br /> <value><span style="background-color: yellow;">UTF-8</span></value><br /></setting></span><br />
<span style="font-family: Consolas;"><br /></span>
There is also DefaultUTF-8 option that loads messages using the default encoding on the PC, but once it is sent it will just use UTF-8. I think that this will come in handy for those that have strict UTF-8 requirements for the sending, but always get sent ISO-8859-1 messages.<br />
<span style="font-family: Consolas;"><br /></span>
<br />
Once you have made your changes, save the file and copy it back to C:\Program Files (x86)\Popokey\HL7 Soup\<br />
Overwrite the existing file with this edited version and restart HL7 Soup for the changes to take effect.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0tag:blogger.com,1999:blog-4633999298061530084.post-8318192505955530702016-07-25T21:59:00.001-07:002016-07-25T21:59:26.282-07:00Mirth CertificateException No name matching found<p>I keep getting emailed questions about this error, so I thought it would be time to put the answer on the web. <p><font size="1" face="Courier New">Web Service Sender error<br>ERROR MESSAGE: Error invoking web servicecom.sun.xml.internal.ws.client.ClientTransportException: HTTP transport error: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching xxxxxxx.com found</font></p> <p>You get this message in Mirth Connect when trying to call a web service destination. Here is the problem. Mirth seems to generate the wrong Location URI. <p>Here you see that I don’t have https in the address, but the Location URI has been generated with the ‘s’ <p><a href="https://lh3.googleusercontent.com/-gZoFhkleYMg/V5buKrqhf5I/AAAAAAAAAgY/Mi8p8yZO8f8/s1600-h/clip_image001%25255B4%25255D.png"><img title="clip_image001" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="clip_image001" src="https://lh3.googleusercontent.com/-2e3eyb31d00/V5buLBTQM0I/AAAAAAAAAgc/6LWNomIKpIU/clip_image001_thumb%25255B1%25255D.png?imgmax=800" width="543" height="242"></a> <p>The reverse applies sometimes too. <p>The work around is simple, just edit the text or the Location URI to match that of the WSDL URL (add or delete an ‘s’). The greyed out text box might make you think this is disabled, but not true – it’s just a poor UI choice. <p>Here is the full error message. <p><font size="1" face="Courier New">Web Service Sender error<br>ERROR MESSAGE: Error invoking web service<br>com.sun.xml.internal.ws.client.ClientTransportException: HTTP transport error: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching xxxxxxx.com found<br> at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(Unknown Source)<br> at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(Unknown Source)<br> at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(Unknown Source)<br> at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(Unknown Source)<br> at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Unknown Source)<br> at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Unknown Source)<br> at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Unknown Source)<br> at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Unknown Source)<br> at com.sun.xml.internal.ws.client.Stub.process(Unknown Source)<br> at com.sun.xml.internal.ws.client.dispatch.DispatchImpl.doInvoke(Unknown Source)<br> at com.sun.xml.internal.ws.client.dispatch.DispatchImpl.invoke(Unknown Source)<br> at com.mirth.connect.connectors.ws.WebServiceDispatcher$DispatchTask.call(WebServiceDispatcher.java:734)<br> at java.util.concurrent.FutureTask.run(Unknown Source)<br> at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)<br> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)<br> at java.lang.Thread.run(Unknown Source)<br>Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching leandrovm2008c.winscribe.com found<br> at sun.security.ssl.Alerts.getSSLException(Unknown Source)<br> at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)<br> at sun.security.ssl.Handshaker.fatalSE(Unknown Source)<br> at sun.security.ssl.Handshaker.fatalSE(Unknown Source)<br> at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)<br> at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)<br> at sun.security.ssl.Handshaker.processLoop(Unknown Source)<br> at sun.security.ssl.Handshaker.process_record(Unknown Source)<br> at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)<br> at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)<br> at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)<br> at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)<br> at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)<br> at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)<br> at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(Unknown Source)<br> at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)<br> at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)<br> ... 16 more<br>Caused by: java.security.cert.CertificateException: No name matching leandrovm2008c.winscribe.com found<br> at sun.security.util.HostnameChecker.matchDNS(Unknown Source)<br> at sun.security.util.HostnameChecker.match(Unknown Source)<br> at sun.security.ssl.X509TrustManagerImpl.checkIdentity(Unknown Source)<br> at sun.security.ssl.X509TrustManagerImpl.checkIdentity(Unknown Source)<br> at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)<br> at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)<br> ... 29 more</font></p>HL7 Interfacerhttp://www.blogger.com/profile/08443506236804050874noreply@blogger.com0