Announcement

Collapse
No announcement yet.

Noobie trying to understand concept

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

  • Noobie trying to understand concept

    Hi Guys,

    I am just trying to understand the concept of Mirth, and the process of getting data from my DB to a HL7 file.

    Well that's it in a nutshell, I have looked around at some of the downloads and examples and the wiki, and I think I am still in the dark.

    I have done a few tests with HL7 files, and they get processed, and moved to the correct folders (file read/write etc etc)

    What I want to do is query my Oracle DB (from my application, let's say get patient detail).
    Then I need to get that into a HL7 file and dump it in a folder (for the 3rd party).

    So the question is how do I 'transform' this data from the DB to a HL7 file ??

    Like I say, I looked at the example downloads, and one method was an 'outbound channel example' which was XML.
    Another was using 'transformers' and 'filters' which was 'source code'.

    So I am a little confused on how to do this, and the best method (if there is more than one)

    And a final question, the examples I saw had DB username/passwords hard-coded.
    I'd like to avoid that also ;-)

  • #2
    Re:Noobie trying to understand concept

    This is done using transformer.


    1. Paste an HL7 template file in the "outgoing Data" tab.
    2. Create a new transformer step (a map one).
    3. Drag&drop the field of the message you want to the "message segment" field
    4. Drag&drop the incoming data you want to map to the "mapping" field

    Deploy and test. You can get complex mappings using JavaScript Steps.

    Comment


    • #3
      Re:Noobie trying to understand concept

      Hi,

      Thanks for the reply !

      I have managed to get an Oracle DB connection, and I am pulling back my patient data.

      I have copied a basic hl7 message (template) and specified a destination folder/file.

      So now I edit a transformer (from the destination tab), and get a little confued !!

      I can't see my incoming data anywhere (but I know it's pulling it in if I view the channel via the dashboard)

      I also pasted the template in the 'outgoing data' tab.

      Now I'm not sure what or how to drag & drop anything ...

      Any pointers

      THANKS :-)

      Comment


      • #4
        Re:Noobie trying to understand concept

        In a db reader connector, the "incoming data" are all the fields you're retrieving from the db. If you are using a expression like "select * from t", then mirth can't know which are your fieds, you should use expressions like "select a,b,c from t".

        The hl7 template should be pasted to the "Outgouing data" tab of the tranformer (not at destination template) At destintation template you should drag&drop the "Transformed Data" label.

        Comment


        • #5
          Re:Noobie trying to understand concept

          ok thats better, I had the hl7 pasted in the destination/template also.

          So now I have the HL7 pasted in the outgoing data tab, but I get the message, "does not appear to be a valid hl7 2.x"

          That might be my following problem.....

          But I added a variable in the mapper, called test_map.

          What goes in 'mapping, and 'default value' and string replacement ???

          I kept reading about a 'tree' or something but have not seen it yet, I wonder if it should be there, or if it's a problem with the hl7 template ...

          my template ...

          MSH|^~\\&|ZZ-NQFP||||200705031344||ORM^R01||P|2.4|||||||||
          PID|1|007|||BOND^JAMES^||19550325|M|||123 ANYWHERE LANE^^TAMPA^FL^33617||8135551212|8135551213||||123 45^^^C|123456789


          It was longer but had problems, so I shortened it, to what I think is the minimum required.

          Comment


          • #6
            Re:Noobie trying to understand concept

            This is because the message is not HL7 valid. There is no HL7 message of type "ORM^R01" (Perhaps ORU^R01 or ORM^O01).

            If your messages is not strict-hl7 you can try checking out the "use strict parser" property at the properties button of the Outgoing data.

            Comment


            • #7
              Re:Noobie trying to understand concept

              Thanks albertosaez,

              That resolved the issue, I have a valid template in the outgoing data tab now.

              My tree appears, and I can create the mapper, name it (variable), and drag the fields over to 'mapping'

              Variable: Patient_ID
              Mapping: tmp['ORM_O01.PATIENT']['PID']['PID.2']['CX.1']

              Now back on my Destination tab, I copy the template again right? but replace the data (say Patient ID & name) with the mapped field I just created (${Patient_ID} ${L_Name})

              PID|1|${Patient_ID}|||${L_Name}^${F_Name}^||195503 25|M|||123 ANYWHERE LANE^^TAMPA^FL^33617||||||||

              I know I have 9 records in my database from my SQL statement, and Mirth creates 9 files.
              But the data is ALL the same, and it is the data from the template, not the data from the database result.

              ** How do I link the selected field 'pat_ID' from my SQL statement, to be the new 'mapped' field I created ${Patient_ID}

              Sorry if I am a little vague, I am on a real tight 'time frame' here to review this, to see if it's something we want to test further !

              Post edited by: dflynn, at: 05/07/2007 10:51

              Post edited by: dflynn, at: 05/07/2007 11:01

              Comment


              • #8
                Re:Noobie trying to understand concept

                1) On the transformer you should use "Message Builder", not Mapper. (You're building a message)



                Message Segment: tmp['ORM_O01.PATIENT']['PID']['PID.2']['CX.1']
                Mapping: msg['pat_ID']


                (You can find your db variables at the "reference" tab)


                2) On the destination tab you should put only "${message.transformedData}" (As the transformed message has all the substututions made).

                Comment


                • #9
                  Re:Noobie trying to understand concept

                  ooohhh, something happened lol.

                  OK now I have result data different for each file.
                  So I'm pretty sure the 'source' is setup, it's the output is the problem.

                  However it's no longer a HL7 it's XML-(ish) :unsure:

                  Code:
                  <ORM_O01>
                      <MSH>
                          <MSH.1>|</MSH.1>
                          <MSH.2>^~\\&</MSH.2>
                          <MSH.3>
                              <HD.1>ZZ-NQFP</HD.1>
                          </MSH.3>
                          <MSH.7>
                              <TS.1>200705031344</TS.1>
                          </MSH.7>
                          <MSH.9>
                              <MSG.1>ORM</MSG.1>
                              <MSG.2>O01</MSG.2>
                          </MSH.9>
                          <MSH.11>
                              <PT.1>P</PT.1>
                          </MSH.11>
                          <MSH.12>
                              <VID.1>2.4</VID.1>
                          </MSH.12>
                      </MSH>
                      <NTE/>
                      <ORM_O01.PATIENT>
                          <PID>
                              <PID.1>1</PID.1>
                              <PID.2>
                                  <CX.1>2-007</CX.1> 
                              </PID.2>
                              <PID.5>
                                  <XPN.1>
                                      <FN.1>ABC</FN.1>
                                  </XPN.1>
                                  <XPN.2>DEF</XPN.2>
                              </PID.5>
                  When I did the message mapping, there where no variables available under the reference tab. inch:
                  I manualy typed from the above post ...
                  Mapping: msg['pat_ID']

                  But the fields/variables are available in a box (lower right) of the "source tab", next to the "SQL Update" window.

                  My Transformer Output is still set to HL7 v2.x so why have I lost the HL7 output, and now have the code posted above ??

                  Post edited by: dflynn, at: 05/07/2007 12:28

                  Post edited by: dflynn, at: 05/07/2007 12:29

                  Comment


                  • #10
                    Re:Noobie trying to understand concept

                    OK,

                    So I figured out I need to use ... ${message.encodedData}
                    instead of ${message.transformedData}

                    So now I have a formatted HL7 message.

                    But I still do not see any variables/fields from my SQL select statemant in the referance tab.

                    After following another thread, I viewed the dashboard messages, and copied the encoded XML into the 'Destination' 'Incoming Data' tab.

                    Then did my mapping from there.

                    This does seem pretty complex and unstructured just to get a basic msg with patient detail.
                    Even the msg builder seemed to be 'named' by the msg segments, and makes it difficult to visually identify anything quickly.

                    Is there any better documentation available other than the wiki.

                    And how do I make result variables appear in the reference tab ?

                    Thanks

                    Comment


                    • #11
                      Re:Noobie trying to understand concept

                      what is your sql ?

                      Comment


                      • #12
                        Re:Noobie trying to understand concept

                        Hi,

                        My SQL statement:

                        SELECT pat_id, f_name, m_name, l_name FROM Patients
                        WHERE pat_id like '%007'

                        I added the 'WHERE' clause after just to reduce the result count, but that hasn't really effected anything

                        Cheers

                        Comment


                        • #13
                          Re:Noobie trying to understand concept

                          I'm sorry, the variables readed from the db, can be found at the 'Incoming Data" tab, not at 'Refence' tab.


                          By the Way: Your where clause has a problem: it get always the same records. You need to "mark" in any way the record you've proceesed.

                          For example, you can add a field caled 'readed' with a defaul values of 'N', and add to the WERE clause ' AND readed='S', and add to the UPDATE form field, the sentece "UPDATE Patients set readed='S' WHERE pat_id=${pat_id} "

                          Comment


                          • #14
                            Re:Noobie trying to understand concept

                            Will you export your Channel and post it so that I can look at it. I'm basically doing the same thing you're doing except I am trying to change a field in ah HL7 incoming message with data from a database. Not a lot of examples out here.

                            Comment

                            Working...
                            X