Announcement

Collapse
No announcement yet.

newbie question

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

  • newbie question

    I am trying to read a message like this:

    MSH|^~\&|NextGen|NG|LabX|LX|200307250948||ORM^O01| 1059140905|T|2.5|||AL
    PID|1|200|||Patient^Test||19901017|M|||||(610)123-4567||||||23456788
    PV1|1|O|4747^^^4747||||UP2666^Devaki MD^Padma|||||||||||||||||||||||||||||||||||||20030 7240000
    IN1|1|HM0|BLUE|Blue Cross|AddressLine 1^AddressLine 2^City^Sta^99999|||543879|||||||HM|Family Name^Given Name^M|1||AddressLine 1^AddressLine 2^City^Sta^99999||||||||||||N|||||1234567||||||||| ||T
    IN1|1|HM0|BLUE|Blue Cross|AddressLine 1^AddressLine 2^City^Sta^99999|||543879|||||||HM|Family Name^Given Name^M|1||AddressLine 1^AddressLine 2^City^Sta^99999||||||||||||N|||||1234567||||||||| ||T
    GT1|1||Family Name^Given Name^M||AddressLine 1^AddressLine 2^City^Sta^99999|6106577010|||||1
    GT1|1||Family Name^Given Name^M||AddressLine 1^AddressLine 2^City^Sta^99999|6106577010|||||1
    ORC|NW|NGT6228|||||||200307241523|0071^supruser^su pruser||UP2666^Devaki MD^Padma
    OBR|1|NGT6228||1032^Glucose, Serum^L|||200307240105||56^ml||N||||BL^none^Blood| UP2666^Devaki MD^Padma|||||||||||^^^^^R
    NTE|1|P|Please, call Dr. Smith with results ASAP. Call his cell phone:
    NTE|2|P|345-678-9012
    DG1|1|I9|251.1^Hypoglycemia NEC^I9|Hypoglycemia NEC
    DG1|2|I9|251.2^Hypoglycemia NOS^I9|Hypoglycemia NOS
    OBR|2|NGT6228||100123^Immunoglobulin M, Quant, CSF^L|||200307250948||||N|||||UP2666^Devaki MD^Padma|||||||||||^^^^^R
    DG1|1|I9|255.4^Insufficiency, corticoadrenal^I9|Insufficiency, corticoadrenal

    and store some of the fields into a database.

    With my connector and transformer some of the fields are read correctly. For example, the insurance company's name, IN1.4.1, comes in as "Blue Cross". The transformer shows this is mapped as msg['IN1']['IN1.4']['IN1.4.1'].toString().

    However, the insurance company's street address, IN1.5.1, for example, comes in as "<IN1.5.1>AddressLine 1</IN1.5.1<IN1.5.1>AddressLine 1</IN1.5.1>". That is, it is repeated and surrounded by the xml tags, which I don't want. The transformer shows this should be mapped as msg['IN1']['IN1.5']['IN1.5.1'].toString(), which looks right.

    So, about half of the fields are mapped correctly, and about half of the them are duplicated and surrounded by xml tags. They were both added to the transformer in the same way, as far as I can tell, so I am mystified as to why this is happening.

    I am entirely new to Mirth Connect and I'm sure there is a simple explanation for all this. However, I would appreciate it immensely if someone could tell me what it is.

    Matthew Fleming, MD
    Fleming Dermatopathology

  • #2
    Because you have multiple segments of the same name, IN1, you need to tell Mirth which segment you need. So instead of msg['IN1']['IN1.5']['IN1.5.1'].toString() you will need to use msg['IN1'][0]['IN1.5']['IN1.5.1'].toString(). The [0] points to the first IN1.

    Your best bet for doing such mappings is to place the sample message into the Inbound Message Tree of the Source Transformer. From there you can use the Message Tree tab to drag and drop pieces of the message you wish to use.

    Comment


    • #3
      Thanks. I have been using the sample message tree, but I changed the sample message halfway through because I realized I should plan for more than one insurance and guarantor segment.

      At this point I can manually change the mappings to point to the right insurance or guarantor segments (first or second). What happens if there is a mapping for a second IN1, eg, and the message only contains one?

      Matthew

      Comment


      • #4
        I have now changed the source transformer along the lines mentioned above -- changing msg['IN1']['IN1.4']['IN1.4.1'].toString() tomsg['IN1'][0]['IN1.4']['IN1.4.1'].toString(), for example. However, this has not corrected the problem, and when I look at the Mappings in the Source message using the message browser, I see that the mappings are as they were *before* the source transformer was changed. I saved the changes to the channel and stopped and restarted channel processing. How do I get the changes to stick?

        Matthew

        Comment


        • #5
          Don't forget to deploy your channel
          JJ Mouris
          FFE Luxembourg
          IT-Department

          Comment


          • #6
            Thanks! working now.

            Comment


            • #7
              Did we ever resolve "What happens if there is a mapping for a second IN1, eg, and the message only contains one?"

              Does anyone have a suggestion on how to count the number of repeating segments, put the count in a variable, and then loop on a counter up to the number of repetitions?

              Comment


              • #8
                If your messages have a correct syntax, you should heve a counter in IN1.1

                To avoid problems with variable number of IN1-segments, you should use a loop.Thus processing will always be fine, whatever number of IN1 segments you have.
                JJ Mouris
                FFE Luxembourg
                IT-Department

                Comment

                Working...
                X