Announcement

Collapse

Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Using Xpath in Mirth create/modify XML messages

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using Xpath in Mirth create/modify XML messages

    Hi !
    I have to use Xpath inside mirth to transform simple messages into complex messages ... :sick: but the questions is : How to use Xpath with Mirth ?
    Is there something to import before ? Does Xpath is already loaded ? etc ...

    A sample incoming message :
    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <data>
      <patient_information>
        <patient_id>123456789</patient_id>
        <patient_birth param1="datetime">2007-01-15 12:00:00</patient_birth>
        ...
      </patient_information>
      <patient_information>
        <patient_id>999999999</patient_id>
        <patient_birth param1="datetime">2005-05-20 17:29:00</patient_birth>
        ...
      </patient_information>
    </data>
    and convert it into something like this ... (how to get the params of everything ... the target message will be based on LOINC and SNOMED without the associated implementation guide)
    So I have to generate it step by step.

    Code:
    <entry typeCode="DRIV">
      <organizer moodCode="EVN " classCode="CLUSTER">
        <templateId root="2.16.840.1.113883.10.20.1.???"/>
        <!-- Social history organizer template -->
        <statusCode code="completed"/>
        <subject> typeCode ="SBJ">
          <relatedSubject classCode="PRS ">
          <code code="HUSB " codeSystem="2.16.840.1.113883.5.111" codeSystemName="RoleCode? displayName="Husband"/>
            <subjectPersonn>
              <administrativeGenderCode code="M" codeSystem="2.16.840.1.113883.5.1" displayName="Male"/>
              <birthTime value="1912"/>
            </subjectPersonn>
          </relatedSubject>
        </subject>
        <component typeCode="COMP">
          <observation classCode="OBS" moodCode="EVN">
            <templateId root="2.16.840.1.113883.10.20.1.33"/> <!-- Social history observation template -->
            <templateId root="2.16.840.1.113883.10.20.1.4.13.4"/>
            <id root=" " extension =" " />
            <code code="SITFAM" codeSystem=" OID XXXX" codeSystemName="XXXXXX" displayName="Family Situation"/>
            <statusCode code="completed"/>
            <effectiveTime><low value="1947"/><high value="1972"/></effectiveTime>
            <value xsi:type="CD code="1" codeSystem=" OID XXXX" codeSystemName="XXXXXX-SITFAM" displayName="maried"/>
          </observation>
        </component>
        <component typeCode="COMP">
          <observation classCode="OBS" moodCode="EVN">
            <templateId root="2.16.840.1.113883.10.20.1.33"/> <!-- Social history observation template -->
            <templateId root="2.16.840.1.113883.10.20.1.4.13.4"
            <id root=" " extension =" " />
            <code code="ORIGEO" codeSystem=" OID XXXX" codeSystemName="XXXXXX" displayName="Origine géographique"/>
            <statusCode code="completed"/> 
            <value xsi:type="CD code="1" codeSystem=" OID XXXXX" codeSystemName="XXXXXX-ORIGEO" displayName="usa .... etc"/>
          </observation>
        </component>
      </organizer>
    </entry>
    How to create/modify nodes, accessing parameters like that ?

    Can you help me to do this ... example of Xpath request ...
    Give me the ?tools? to do this ...
    Please :unsure:

    Thanks for your replies.

    [Using Mirth 1.6.1 on Windows XP]

    Post edited by: Antaris, at: 11/05/2007 08:46

  • #2
    Re:Using Xpath in Mirth create/modify XML messages

    You can use standard JAVA Xpath code in your transformer/scripts. Example: http://www.ibm.com/developerworks/li...axpathapi.html

    You can mix and match Java and Javascript code ANYWHERE there is a script in Mirth, however you MUST use the fully qualified path name, prefixed by "Packages"

    For example, to use java.xml classes, you would do importPackage(java.xml); or call the classes directly with Packages.java.xml....

    Check this out for more info on using Java code in Mirth's scripts: http://www.mozilla.org/rhino/ScriptingJava.html

    Post edited by: chrisl, at: 11/09/2007 00:44
    Chris Lang

    Comment


    • #3
      Re:Using Xpath in Mirth create/modify XML messages

      Thanks a lot Chris for your reply !
      I'm trying do do this
      Antaris

      Comment


      • #4
        I am currently working on it ? Did you already figured out ?

        Comment

        Working...
        X