No announcement yet.

Some beginner questions

  • Filter
  • Time
  • Show
Clear All
new posts

  • Some beginner questions

    Hi all.

    I just downloaded mirth yesterday, installed it and try use it.

    I m blocked in two aspects :

    1/ My goal is to detect db table update / insert / delete and to generate an HL7 message (the low layer transfer protocol is not a problem).
    I don't understant how I can do this with the database interface : how an sql order can do that ? Maybe with a new row in the table like "transfered" ? Is it a "best practice" to do that ? I think I cant modify the database model in fact.

    2/ I don't really understand the transformer channel interface : someone has a real exemple (with a lot of processed fields ?)

    Thanks in advance

    Sorry for my english I m french

  • #2
    Re: Some beginner questions

    Thanks for giving Mirth a try -

    1) Mirth needs to be able to check and modify some sort of status field on the database. Either an actual status column or a date modified.

    The select statement would be something like:

    SELECT id, pd_lname FROM db_name WHERE status = 1;
    The update would be:

    UPDATE db_name SET status = 0 WHERE id = ${id}
    In the first case, Mirth will poll the database and each row that has a status code of "1" in this case will be sent to the transformer as XML. If you pull out the pd_lname column, you can access it from the transformer like this:

    var patient_lastname = msg['pd_lname'];
    Any named column from the SQL can be used like this.

    The update statement will have access to the id (or any other column) from your select. Here you can set the status to "0" so Mirth will not process the row again.

    As far as example transformers and filters, check the file repository for a few examples. For your scenario, you will basically:

    1) Read data from a database
    2) Write HL7 out.

    In order to write the HL7 out, Mirth needs a template for the hl7 message you'd like to create. (All you really need is an MSH segment with the message type and message version). From here you use the message builder in the transformer:

    1) Paste a template into the HL7 Template tab
    2) Click on the HL7 Tree to parse the template
    3) Click "Add New Step"
    4) Go through the HL7 tree and find the field you want to populate.
    5) Drag that field to the HL7 Message Segment text field in on the left side of the frame
    6) On the variables and functions tab, drag the database variable you want mapped to the "Mapping" area.

    You can also build an HL7 message manually using the Javascript steps...but that's a bit more complex.

    Hope this helps!
    Chris Lang


    • #3
      Re: Some beginner questions

      Hi chrisl, thanks you for your quick answer.

      For the database I m ok whith you, I didn't saw another solution, I will see if is it possible to modify the database model in order to manage the sent status.

      For the HL7 transformation, I think I miss a step in fact.
      I will re-read your answer and try to find this templates (are them stored in site ?)

      Many thanks.


      • #4
        Re: Some beginner questions

        Hum in fact a template is just an hl7 message I m wrong ?


        • #5
          Re: Some beginner questions

          Ok, I understand how to do the two things.

          Thanks you for you really good answer.

          Just a little remark : the sample in file repository have some errors with the last mirth version : it is a little bit destabilizing

          Good job anyway.