<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Forum - Recent Posts				            </title>
            <link>https://www.meditecs.com/forum/</link>
            <description>Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Mon, 27 Jul 2026 22:15:42 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>HL7 v2.4 ADT_A01 message to FHIR R4 in the Mirth Connect</title>
                        <link>https://www.meditecs.com/forum/ai-prompt-contest-health-interoperability/hl7-v2-4-adt_a01-message-to-fhir-r4-in-the-mirth-connect/#post-11</link>
                        <pubDate>Fri, 24 Jan 2025 18:05:08 +0000</pubDate>
                        <description><![CDATA[Question: Can you create a transformation step for converting an HL7 v2.4 ADT_A01 message to FHIR R4 in the Mirth Connect integration engine?
ChatGPT 4o answer 2024
Certainly! Transforming...]]></description>
                        <content:encoded><![CDATA[<p><strong>Question</strong><span>: Can you create a </span><strong>transformation step</strong><span> for converting an HL7 v2.4 ADT_A01 message to FHIR R4 in the Mirth Connect integration engine?</span></p>
<p><strong>ChatGPT 4o answer 2024</strong></p>
<p><span>Certainly! Transforming an HL7 v2.4 ADT_A01 message to a FHIR R4 Patient resource in Mirth Connect requires familiarity with both HL7v2 and FHIR message structures. Below, I’ll guide you through the steps to set up a transformation channel in Mirth Connect to map an ADT_A01 message to a FHIR R4 Patient resource.</span></p>
<p><strong>Prerequisites</strong></p>
<ol class="wp-block-list">
<li><strong>Mirth Connect</strong><span> </span>installed and configured.</li>
<li>Knowledge of the structure of HL7 v2.4 ADT_A01 messages.</li>
<li>Understanding of the FHIR R4 Patient resource JSON structure.</li>
</ol>
<p><strong>Step 1: Set up the Mirth Connect Channel</strong></p>
<ol class="wp-block-list">
<li><strong>Create a New Channel</strong><span> </span>in Mirth Connect and name it something like ADT to FHIR Transformation.</li>
<li><strong>Set the Source Connector</strong><span> </span>to accept HL7v2 messages. This could be configured as a TCP Listener, File Reader, or other suitable source connector depending on your input source.</li>
<li><strong>Set the Destination Connector</strong><span> </span>to output JSON (FHIR format). You may want to use a REST API, File Writer, or Database Writer, depending on the destination requirements.</li>
</ol>
<p><strong>Step 2: Configure the Source Transformer</strong></p>
<ol class="wp-block-list">
<li>Go to the<span> </span><strong>Source Transformer</strong><span> </span>in your Mirth channel and add a new step.</li>
<li>Choose<span> </span><strong>JavaScript</strong><span> </span>as the type for your transformation step.</li>
</ol>
<p><strong>Step 3: Write JavaScript for Transformation</strong></p>
<p>Add the following JavaScript code to transform the HL7 ADT_A01 message to FHIR R4 Patient JSON:</p>
<pre contenteditable="false">// Initialize the FHIR Patient resource
var patientResource = {
  resourceType: "Patient",
  id: $('MSH-10'),  // Unique identifier from MSH segment
  identifier: ,
  active: true,
  name: [
    {
      use: "official",
      family: $('PID-5.1'),  // Last Name
      given:   // First Name
    }
  ],
  telecom: ,
  gender: $('PID-8') === 'M' ? 'male' : 'female',  // Gender mapping
  birthDate: DateUtil.formatDate($('PID-7'), 'yyyyMMdd', 'yyyy-MM-dd'),  // DOB with format change
  address: [
    {
      use: "home",
      line: ,  // Address line
      city: $('PID-11.3'),  // City
      state: $('PID-11.4'),  // State
      postalCode: $('PID-11.5')  // ZIP/Postal Code
    }
  ]
};

// Add managing organization if available
if ($('PV1-3.1')) {
  patientResource.managingOrganization = {
    reference: "Organization/" + $('PV1-3.1')  // Organization reference
  };
}

// Convert the JavaScript object to JSON
var fhirPatientJson = JSON.stringify(patientResource, null, 2);

// Map the JSON output to the destination
msg = fhirPatientJson;</pre>
<p><strong>Explanation of the Transformation Code</strong></p>
<ul class="wp-block-list">
<li><strong>Resource Initialization</strong>: The patientResource object is initialized with the necessary FHIR R4 Patient resource fields.</li>
<li><strong>Identifier</strong>: The identifier is mapped from PID-3.1 (MRN), with a sample OID for the system.</li>
<li><strong>Name</strong>: The name fields use PID-5 for last and first names.</li>
<li><strong>Telecom</strong>: Phone and email details are mapped from PID-13.</li>
<li><strong>Gender</strong>: The gender field maps ‘M’ and ‘F’ to ‘male’ and ‘female’, as per FHIR requirements.</li>
<li><strong>Birth Date</strong>: Formats the birth date from yyyyMMdd (HL7) to yyyy-MM-dd (FHIR).</li>
<li><strong>Address</strong>: Maps address components from PID-11.</li>
<li><strong>Managing Organization</strong>: Maps organization information if present from PV1-3.</li>
</ul>
<p><strong>Step 4: Configure the Destination Connector</strong></p>
<ol class="wp-block-list">
<li>Go to the<span> </span><strong>Destination Connector</strong><span> </span>and set the data type to JSON if you’re outputting JSON directly.</li>
<li>Use msg as the output variable, as it contains the JSON representation of the FHIR Patient resource.</li>
<li>Configure the destination endpoint (such as REST API URL or file location) to send the transformed JSON message to your FHIR-compliant system.</li>
</ol>
<p><strong>Step 5: Test the Channel</strong></p>
<ol class="wp-block-list">
<li>Deploy the channel and send a test ADT_A01 HL7 message to verify the transformation.</li>
<li>Check the output in your configured destination to ensure that the JSON format conforms to FHIR R4 standards.</li>
</ol>
<p><strong>Additional Notes</strong></p>
<ul class="wp-block-list">
<li><strong>Testing and Validation</strong>: Use FHIR validators or online tools to ensure the output JSON complies with FHIR R4 standards.</li>
<li><strong>Enhancements</strong>: You may want to add error handling and additional mappings depending on specific fields in your ADT message or FHIR implementation requirements.</li>
</ul>
<p>This setup will transform an incoming HL7 v2.4 ADT_A01 message into a FHIR R4 Patient resource, ready to be consumed by a FHIR-compliant system.</p>
<p> </p>
<p> </p>]]></content:encoded>
						                            <category domain="https://www.meditecs.com/forum/"></category>                        <dc:creator>Pedro M. Torres</dc:creator>
                        <guid isPermaLink="true">https://www.meditecs.com/forum/ai-prompt-contest-health-interoperability/hl7-v2-4-adt_a01-message-to-fhir-r4-in-the-mirth-connect/#post-11</guid>
                    </item>
				                    <item>
                        <title>HL7 v2.4 to FHIR R4 in the Mirth Connect integration engine</title>
                        <link>https://www.meditecs.com/es/forum/ai-prompt-contest-health-interoperability/hl7-v2-4-to-fhir-r4-in-the-mirth-integration-engine/#post-10</link>
                        <pubDate>Fri, 24 Jan 2025 17:48:50 +0000</pubDate>
                        <description><![CDATA[Hello everyone, welcome to the AI Prompt Contest!
For your inspiration here we share the first two Promts we experimented with at Meditecs (source)
Question: Can you create a sample transf...]]></description>
                        <content:encoded><![CDATA[<p>Hello everyone, welcome to the AI Prompt Contest!</p>
<p>For your inspiration here we share the first two Promts we experimented with at Meditecs (<a href="https://www.meditecs.com/healthcare-interoperability-made-simple-with-ai/" target="_blank" rel="noopener">source</a>)</p>
<p><strong>Question:</strong> Can you create a sample transformation converting HL7 v2.4 to FHIR R4 in Mirth integration engine?</p>
<p><strong>ChatGPT answer in 2024</strong></p>
<hr />
<p>Creating a transformation to convert HL7 v2.4 to FHIR R4 in the Mirth integration engine requires mapping each relevant HL7 segment to its corresponding FHIR resource format. Below is a sample JavaScript transformation script for Mirth Connect, focusing on patient demographics from an HL7 ADT (Admit, Discharge, Transfer) message to a FHIR Patient resource.</p>
<pre contenteditable="false">// Initialize FHIR Patient Resource
var patientResource = {
  resourceType: "Patient",
  identifier: [],
  name: [],
  telecom: [],
  gender: "",
  birthDate: ""
};

// Map HL7 PID Segment to FHIR Patient Resource
var pid = msg;

// Patient Identifier (from PID-3)
if (pid.toString()) {
  patientResource.identifier.push({
    use: "usual",
    system: "urn:oid:1.2.36.146.595.7.3.1.1",
    value: pid.toString()
  });
}

// Patient Name (from PID-5)
if (pid.toString()) {
  patientResource.name.push({
    use: "official",
    family: pid.toString(),
    given: [pid.toString()]
  });
}

// Telecom - Phone Number (from PID-13)
if (pid.toString()) {
  patientResource.telecom.push({
    system: "phone",
    value: pid.toString(),
    use: "home"
  });
}

// Gender (from PID-8)
switch (pid.toString()) {
  case 'M':
    patientResource.gender = "male";
    break;
  case 'F':
    patientResource.gender = "female";
    break;
  default:
    patientResource.gender = "unknown";
}


// Output FHIR Patient Resource as JSON
return JSON.stringify(patientResource, null, 2);</pre>
<p><strong>Explanation of Key Transformations</strong></p>
<ol class="wp-block-list">
<li><strong>Identifier (PID-3)</strong>: Maps the patient identifier from HL7 to the identifier array in the FHIR Patient resource.</li>
<li><strong>Name (PID-5)</strong>: Constructs the name array with family and given names.</li>
<li><strong>Telecom (PID-13)</strong>: Adds the patient’s phone number to the telecom array.</li>
<li><strong>Gender (PID-8)</strong>: Translates gender values (M/F) from HL7 to FHIR-compliant terms.</li>
<li><strong>Birth Date (PID-7)</strong>: Reformats the birth date from HL7 to the FHIR YYYY-MM-DD format.</li>
</ol>
<h3 class="wp-block-heading">Additional Notes</h3>
<ul class="wp-block-list">
<li>Ensure that the<span> </span><strong>Destination Connector</strong><span> </span>is configured to send or store the JSON output.</li>
<li>You may need to modify or expand the script to cover other segments (e.g., visit information) depending on your integration requirements.</li>
</ul>
<p>Would you like an example covering additional HL7 segments or a different FHIR resource?</p>
<hr />
<p> </p>
<p>Feel free to comment and upvote, and of course upload your own Prompt to win!</p>]]></content:encoded>
						                            <category domain="https://www.meditecs.com/forum/"></category>                        <dc:creator>Pedro M. Torres</dc:creator>
                        <guid isPermaLink="true">https://www.meditecs.com/es/forum/ai-prompt-contest-health-interoperability/hl7-v2-4-to-fhir-r4-in-the-mirth-integration-engine/#post-10</guid>
                    </item>
							        </channel>
        </rss>
		