Announcement

Collapse
No announcement yet.

encoding from xml to hl7 v3 with javascript

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

  • encoding from xml to hl7 v3 with javascript

    I have this JS statement.
    tmp['PRPM_IN301010']['controlActProcess']['subject']['registrationEvent']['subject1']['healthCareProvider']['id']['validTime']['low'] = msg['Provider_Identifier_Effective_Start_Date'].toString();

    I am not getting any value set in the target (tmp) item.
    If I set tmp=msg, It displays the contents of the input xml corresponding to msg before the encoded data but no encoding is done.

    The template on the destination panel is set to ${message.encodedData}

    What have I missed. This should be a basic operation in Mirth.

  • #2
    I have the hl7 v3 message schema in the outbound message template area.

    Comment


    • #3
      Looks like an issue with namespaces.
      Make sure you set your default namespace if you don't want to specify it in your statements:
      default xml namespace = "mynamespace";

      You can also wildcard your namespaces:
      var startDate = msg.*::Provider_Identifier_Effective_Start_Date.to String();
      Daniel Svanstedt
      Software Engineer
      Mirth Corporation

      Want professional services, support, and enterprise or virtual appliances? It's all available from the Mirth Corporation:
      Mirth Support | Mirth Training | Mirth Appliances | Online Training | Developer Q&A

      Don't forget, Mirth Support gives you access to all of our online training videos, and silver support gives you access to developer Q&As!

      Comment


      • #4
        I am using
        default xml namespace = "urn:hl7-org:v3"; as a default

        Comment


        • #5
          Originally posted by dans View Post
          Looks like an issue with namespaces.
          Make sure you set your default namespace if you don't want to specify it in your statements:
          default xml namespace = "mynamespace";

          You can also wildcard your namespaces:
          var startDate = msg.*::Provider_Identifier_Effective_Start_Date.to String();

          I have more than one item that is not being set. In that case would it be

          msg.*::*;[/QUOTE]

          Comment


          • #6
            make sure "strip xml namespaces" is unchecked on both inbound and outbound transformer properties.
            Daniel Svanstedt
            Software Engineer
            Mirth Corporation

            Want professional services, support, and enterprise or virtual appliances? It's all available from the Mirth Corporation:
            Mirth Support | Mirth Training | Mirth Appliances | Online Training | Developer Q&A

            Don't forget, Mirth Support gives you access to all of our online training videos, and silver support gives you access to developer Q&As!

            Comment


            • #7
              Originally posted by dans View Post
              Looks like an issue with namespaces.
              Make sure you set your default namespace if you don't want to specify it in your statements:
              default xml namespace = "mynamespace";

              You can also wildcard your namespaces:
              var startDate = msg.*::Provider_Identifier_Effective_Start_Date.to String();
              So I would have to create var item name = msg.*:rovider_itemname();
              for item item I am encoding in the script

              Comment


              • #8
                Originally posted by dans View Post
                make sure "strip xml namespaces" is unchecked on both inbound and outbound transformer properties.
                Yes I have done that.

                Comment


                • #9
                  No, you don't need to create a variable. I was just giving an example. Does both in coming and outgoing message have the same namespace (urn:hl7-org:v3) ?
                  Daniel Svanstedt
                  Software Engineer
                  Mirth Corporation

                  Want professional services, support, and enterprise or virtual appliances? It's all available from the Mirth Corporation:
                  Mirth Support | Mirth Training | Mirth Appliances | Online Training | Developer Q&A

                  Don't forget, Mirth Support gives you access to all of our online training videos, and silver support gives you access to developer Q&As!

                  Comment


                  • #10
                    Originally posted by dans View Post
                    No, you don't need to create a variable. I was just giving an example. Does both in coming and outgoing message have the same namespace (urn:hl7-org:v3) ?
                    No. incoming is xml from a database query. I have unchecked on both incoming and outgoing the strip namespace box.
                    I am only using javascript on outgoing.

                    Maybe I need to specify the same default on the incoming.

                    Comment


                    • #11
                      So you will need to wildcard or specify the namespace when you get a value from the incoming data as it is using a different namespace (namespace is blank).

                      This should work:
                      Code:
                      default xml namespace = "urn:hl7-org:v3";
                      tmp['PRPM_IN301010']['controlActProcess']['subject']['registrationEvent']['subject1']['healthCareProvider']['id']['validTime']['low'] = msg..*::Provider_Identifier_Effective_Start_Date.toString();
                      Daniel Svanstedt
                      Software Engineer
                      Mirth Corporation

                      Want professional services, support, and enterprise or virtual appliances? It's all available from the Mirth Corporation:
                      Mirth Support | Mirth Training | Mirth Appliances | Online Training | Developer Q&A

                      Don't forget, Mirth Support gives you access to all of our online training videos, and silver support gives you access to developer Q&As!

                      Comment


                      • #12
                        This works

                        so this works for me in binding the xml value to hl7v3 template. It was a namespace issue. I used the following wildcard and syntax .

                        var surname1 = msg.*::['Surname'].toString();
                        then

                        tmp['PRPM_IN301010']['controlActProcess']['subject']['registrationEvent']['subject1']['healthCareProvider']['healthCarePrincipalPerson']['name']['family']= surname1;

                        Comment


                        • #13
                          Did you finally get the solution to this?
                          I'm having the same problem with the namespaces when I try to map from XML to HL7v3 messages...

                          My question is:
                          did you put 'default xml namespace = "urn:hl7-org:v3";' before those assign statements?
                          Last edited by irener; 10-13-2010, 11:17 PM.

                          Comment

                          Working...
                          X