Hello. Y have POSOLOGY text field that could read: "TAKE 1 TABLET \/IA G-TUBE THREE TIMES A DAY/ SPASJIC 9UADRIPLEGIA (6AM-10AM-12N-4PM-8PM)"
I am trying to script a dose schedule based on the hours above that warns when it is time to administer the dose to a patient or patients.
First, I parsed out the hours within the parenthesis from the text field above.
Next is what gets complicated for me:
- I counted on separated variables how many "AM' and "PM: hours there are., together with the "N" for noon.
- Since the AM and PM hours go from 1 to 12, not in a military hour format, nor I can't script it to take the first one or the first two digits before the "am" or "pm" because, for instance, 6AM is not written with a "0" in front of it.
- Should I use "Position" function, based on the number of either "AM" or "PM" there are to parse out the hours?
- Last, what is recommended once I got the hour. Do I place it on a global field so the script searches for the meds needed to be administered within that parsed hour? Again, how to know if 8 is AM and not PM or vice-versa?
Thank you in advance for your time and interest to help me.