1 2 Previous Next 20 Replies Latest reply on Aug 13, 2017 1:48 PM by fmpdude

    Is it possible to parse a prescripton?

    bgamborg

      I am hoping someone can help.

      I am trying to parse a medical prescription into 3 fields - medication name, dosage, direction.

       

      doctors do not like to tab between fields and it is simpler and more natural to write:

       

      lisinopril 10 mg once daily or HC APAP 5/325 mg every 4 hr if needed

       

      rather than go through a series of drop down menus

       

      parameters:

      doage is always a numeric value followed by one word

      medication name may be either one or two words to the left of the dosage

      directions will be a variable number of words to the right of the dosage

       

      Any ideas?

        • 1. Re: Is it possible to parse a prescripton?
          fmpdude

          If the string format is the same or the words are used the same way, consistently, then sure.

           

          Figure out how you would do it using pencil and paper first. Get the algorithm picking the string apart. Then, and only then, attempt to implement it in code.

          • 2. Re: Is it possible to parse a prescripton?
            TomHays

            While it is possible to write a simple parser in FileMaker if the data consistently follows a nice pattern, in this case I recommend against it since it will be almost guaranteed to fail a significant percentage of the time.  ("Significant" here is relative to context.  In the medical field, a small number of errors is usually too many.)

             

            -Tom

            • 3. Re: Is it possible to parse a prescripton?
              TomHays

              If the format is exactly as you say, then this calc may help.

              It works on the two examples you provided.

               

              Requirements:

              The medicine name must not have a numeric digit in it.

              The dosage must be exactly 2 words.

              The dosage must begin with a numeric digit.

              The order must be: _medication_name  _dosage_  _directions_.

               

              Notes:

              The medicine name can be any length as long as it does not have a digit.

              The directions can be any length.

               

              -Tom

               

              Let([

              // ~theInput = YourField;

              ~theInput = "lisinopril 10 mg once daily";

              ~n = Filter(~theInput; "0123456789");

              ~first_digit = Left(~n; 1);

              ~posn_first_digit = Position(~theInput; ~first_digit; 1;1);

              ~dosageAndDirections = Right(~theInput; Length(~theInput) - ~posn_first_digit + 1);

              ~medication_name = Trim(Left(~theInput;~posn_first_digit-1));

              ~dosage = LeftWords(~dosageAndDirections; 2);

              ~directions =RightWords(~dosageAndDirections; WordCount(~dosageAndDirections) -2)

              ];

              List(

              "Medication name = " & ~medication_name;

              "Dosage = " & ~dosage;

              "Directions = " & ~directions

              )

              )

              1 of 1 people found this helpful
              • 4. Re: Is it possible to parse a prescripton?
                beverly

                In things like this (variable number of words or variable "positions" in text), I have seen an example where you start building a table of such values. All medications, All dosage measurements (include abbreviated and not), All 'common' phrases for the directions.

                 

                Then you can "lookup" what might match (PatternCount, perhaps?) and be able to extract. While not as helpful at first, as the lookup table grows, the process becomes more "automated".

                 

                The same type of method can be used for address parsing for example. Or name/tile parsing. "Values-that-may-be-found" will be the "lookup". You will always find spelling (or abbreviation) errors, so it's not fool-proof. Just being able to get "most of them" can be a great help to the entry person.

                 

                Beverly

                • 5. Re: Is it possible to parse a prescripton?
                  philmodjunk

                  And you might look for a web service that does such parsing. Might find something that runs rings around anything you come up with.

                   

                  But the thought of parsing such medical info and getting it wrong even one time would keep me up at night.

                  • 6. Re: Is it possible to parse a prescripton?
                    jormond

                    I am in that same ballpark. There is a highly liability issue there.

                     

                    Selection of options is more accurate. And almost always faster.

                    • 7. Re: Is it possible to parse a prescripton?
                      Karen

                      Although I agree it is risky,

                      one additional concept is a separator character, if they were willing to type one, that never appears in a prescription, E.g. "|" or such.

                      Whatever the method, I'd make it transactional and force them to approve (legally!) the result or edit.

                      1 of 1 people found this helpful
                      • 8. Re: Is it possible to parse a prescripton?
                        TomHays

                        Karen wrote:

                         

                        one additional concept is a separator character, if they were willing to type one, that never appears in a prescription, E.g. "|" or such.

                         

                        I was going to suggest similar, but the OP stated that the doctors do not like to hit tab.  Typing a specially chosen character or hitting the Tab key seems like the same work to me, and Tab will solve all of these problems immediately.

                         

                        I think requiring the doctors to enter the prescription info into three separate fields is the best method.

                         

                        Let them complain.  Sometimes the UI designer has to be firm in requiring things to be done in a particular way because the user doesn't always know best.

                         

                        -Tom

                        • 9. Re: Is it possible to parse a prescripton?
                          philmodjunk

                          Clearly communicating the risks and potential liabilities--no matter which interface design you use, to every relevant party should be a very important part of this project.

                          • 10. Re: Is it possible to parse a prescripton?
                            beverly

                            Agreed, automate as much as possible, but VALIDATE by carbon-based, what the silicon-based says. That's why I'll:

                            • keep the original in a field (for historical reference)
                            • parse as needed to new fields
                            • verify always

                            Beverly

                            • 11. Re: Is it possible to parse a prescripton?
                              TomHays

                              bgamborg wrote:

                               

                              doctors do not like to tab between fields and it is simpler and more natural to write:

                               

                              Have you figured out why "doctors do not like to tab between fields"?

                               

                              Perhaps the doctors are OK to tab between fields but do not like that the full prescription is visually separated into different boxes.

                              If you provide an on-screen display of the 3 boxes put together as a complete prescription for visual feedback, e.g.

                              <<medication name>> <<dosage>> <<direction>>

                              perhaps the doctors would be OK with hitting tab and typing in the pieces separately.

                               

                              -Tom

                              • 12. Re: Is it possible to parse a prescripton?
                                philmodjunk

                                Tom makes a very good point. It's easier to concatenate than it is to parse.

                                • 13. Re: Is it possible to parse a prescripton?
                                  bgamborg

                                  thanks to all.  You input is greatly appreciated.

                                   

                                  My thought was to have the physician confirm any prescription before validating.

                                   

                                  In real life, erx programs invariable walk physicians through a series of drop down menus and selections in which the average prescription requires 40-50 seconds to create one line. 

                                   

                                  Also "click" errors are a huge problem.  5 mg of morphine can easily become 50 mg of morphine using the current system (although, interestingly, this is not considered a medication error)  My hope is to try and reduce errors by using prescription writing that doc's are familiar with.

                                  • 14. Re: Is it possible to parse a prescripton?
                                    philmodjunk

                                    I fear that you may be exchanging one source of error for another. Also note that users are notorius for clicking to confirm without paying real attention to what they are confirming.

                                     

                                    Using the mouse to pick values from a list is not the only alternative. You might try a separate auto-complete enabled fields for each part of the prescription, the doctor types in the prescription as they would write it except for tabbing between each part. An added field can show the result as a concatenated string for confirmation.

                                    1 2 Previous Next