Here’s a loopy question

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Here’s a loopy question

  • Creator
    Topic
  • #53216
    Tim Gobbel
    Participant

      Still working on flat files to HL7.  I took Charlie’s advice and wrote a tcl proc to read in the file and make a mock HL7 message with Z segments.

      It’s working great except for one thing.  I am stuck on how to loop thru a single line of data to find all the 03 records in the message so I can have repeating Z03 segments.  I am attaching the proc so if any one has some wisdom for me, I’d appreciate it.  Thanx!

    Viewing 7 reply threads
    • Author
      Replies
      • #76948
        Derrick Ray
        Participant

          Do you have a sample of the input file?

        • #76949
          Tim Gobbel
          Participant

            here is a data file with three scrubbed records.  the second one has the multiple 03 records.  Thanx!

          • #76950
            Charlie Bursell
            Participant

              I am confused Tim.  How do you delimit your records?  I don’t see any line feeds.

              How do you know where a type 03 record starts?

            • #76951
              Tim Gobbel
              Participant

                By the 03 which is fine as long as there is only one 03 but when there are multiples i do not know how to loop on the same line of data.  is it possible?  if not, i may have to go back to the source and ask for another file with

                01

                02

                03

                01

                02

                03

                03

                03

                01 ETC.  Thanx!

              • #76952
                Charlie Bursell
                Participant

                  There are no line feeds in your data.  How do you know where the 03 record is?  If I look for 03 there is one in the record header and one in the data itself

                • #76953
                  Tim Gobbel
                  Participant

                    If you download into notpad, there are line feeds before the 01 records. There are three records. The first and third have only one 03 record while the second one has two 03 records. The tcl proc gets the Z01 record from the whole stringfrom 0 thru the index for the 02 record. It gets the Z02 from the whole string from the 02 index thru the first 03 record. The Z03 record gets the first 03 from the whole string from the first 03 record thru the end of the string. I can get each subsequent 03 record from the Z03 string.  I just don’t know how many there will be. I just need some syntax that i can use to tell me when to stop; when the string search returns a 0 or -1.  Thanx!

                  • #76954
                    Charlie Bursell
                    Participant

                      below is what I get with notepad:

                      I would begine to tell you how to parse this unless each line started with a known sequence or each line was some sort of flat record layout

                      I don’t know how you would find all of the 03 records without some sort of rule-based parsing.  How would you differeniate between 03 as a record start and 03 in the date field?

                      Maybe it is something this web site does to you data?

                      01 2867840 “last,first m” 4061976 1 999-99-9999 1 2062012 2323 4 02 2 2

                      “last,first” 1010 OAK 03 7241976 1042 1901203VC42 BPZ810914413 2 “last,first” 1

                      306 HEATHER LANE 2 1012011 555-555-5555 01 2980946 “last,first” 10281949 2

                      9999-99-9999 6 1 3272012 771 4 02 1 999-99-9999 230766 5 1979 MILKY WAY

                      608-271-9000 555-555-5555 2 “last,first” 2405 BROOKFIELD AVE 03 10281949 2211

                      999999999A 2 “last,first” 5 2405 BROOKFIELD AVE 01 12012011 800-800-8000 03

                      10281949 69521 xxx123 R59723788 2 “last,first” 5 2405 BROOKFIELD AVE 1 1012009

                      555-555-5555 01 2999240 “last,first” 1311989 1 1 2062012 15376 4 02 1 475678 1

                      555-555-5555 1 “last,first” 4102 GLADDEN AVE 03 1311989 1193 44702569500 1

                      “last,first” 1 4102 GLADDEN AVE 01 555-555-5550

                    • #76955
                      Tim Gobbel
                      Participant

                        Thanx!  don’t waste any more time on this.  We sent it over to another group here at Johns Hopkins and they got me a file of HL7 messages.  This is just an exercise for me now. I’ll play around with it. Thanx!

                    Viewing 7 reply threads
                    • The forum ‘Cloverleaf’ is closed to new topics and replies.