|
66 | 66 | # NOTE: periodUnit 'day' should include pretty much all of 'when' array |
67 | 67 | # for FHIR conversion: https://www.hl7.org/fhir/valueset-units-of-time.html |
68 | 68 | PERIOD_UNIT = { |
69 | | - 'day': [ 'daily', 'dialy', 'nightly', 'days', 'day', r'\bd\b', 'morning', 'morn', 'am', 'afternoon', 'aft', 'pm', 'evening at bedtime', 'bedtime', 'evening', 'eve', 'night', 'hs' ], |
| 69 | + 'day': [ 'daily', 'dialy', 'nightly', 'days', 'day', r'\bd\b', 'morning', 'morn', 'am', 'afternoon', 'aft', 'pm', r'evening at bed(?:\s)?time', r'bed(?:\s)?time', 'evening', 'eve', 'night', 'hs' ], |
70 | 70 | 'week': [ 'weekly', 'weeks', 'week', 'wks', 'wk', r'\bw\b' ], |
71 | 71 | 'month': [ 'monthly', 'months', 'month', 'mon', 'mo' ], |
72 | 72 | 'hour': [ 'hourly', 'hours', 'hour', 'hrs', 'hr', r'\bh\b' ], |
|
90 | 90 | WHEN = { |
91 | 91 | 'in the morning': [ r'(?:in the|every|each)\s?(?:morn(?:ing)?|a m\b|am)', r'a m\b', r'\bam\b', r'\bqam\b', r'q am\b' ], |
92 | 92 | 'in the afternoon': [ r'(?:in the|every|each|at)\s?(?:aft(?:ernoon)?|p m\b|pm)', r'\bqpm\b', 'q afternoon' ], |
93 | | - 'in the evening at bedtime': [r'(?:in the|every)\s?evening at bedtime'], |
94 | | - 'in the evening': [ r'(?:in the|every|each)\s?eve(?:ning)?(?! at bedtime)' ], |
95 | | - 'at night': [ r'(?:in the|at|every|each)\s?night(?! at bedtime)', r'nightly(?! at bedtime)' ], |
96 | | - 'at bedtime': [ r'(?!eve(?:ning) )(?:in the|at|every|every night at|nightly at|each)\s?bedtime', r'\bqhs\b', r'q hs\b', 'bedtime', r'\bhs\b' ], |
| 93 | + 'in the evening at bedtime': [r'(?:in the|every)\s?evening at bed(?:\s)?time'], |
| 94 | + 'in the evening': [ r'(?:in the|every|each)\s?eve(?:ning)?(?! at bed(?:\s)?time)' ], |
| 95 | + 'at night': [ r'(?:in the|at|every|each)\s?night(?! at bed(?:\s)?time)', r'nightly(?! at bed(?:\s)?time)' ], |
| 96 | + 'at bedtime': [ r'(?!eve(?:ning) )(?:in the|at|every|before|every night at|nightly at|each)\s?bed(?:\s)?time', r'\bqhs\b', r'q hs\b', r'bed(?:\s)?time', r'\bhs\b' ], |
97 | 97 | 'with meal': [ r'(?:with|each|every|at)?\s?meal(?:s)?', r'c c\b', r'\bcc\b' ], |
98 | 98 | 'with breakfast': [ r'(?:with|each|every|at)? breakfast' ], |
99 | 99 | 'with lunch': [ r'(?:with|each|every|at)?\s?lunch', r'\bcd\b', r'c d\b' ], |
|
123 | 123 | 'use': [], |
124 | 124 | 'push': [], |
125 | 125 | 'give': [], |
126 | | - 'take': [r'\btk(?:\b|\d)', r'^t(?:\b|\d)'], |
| 126 | + 'take': [r'\btk(?:\b|\d)', r'^t(?:\b|\d)', 'taking'], |
127 | 127 | 'swallow': [], |
128 | 128 | 'instill': [], |
129 | 129 | 'chew': [], |
|
181 | 181 | 'by mouth': ['by oral route', 'oral', r'orally(?! disintegrating)', r'po\b', r'p o\b', r'oral\b'], |
182 | 182 | 'in left ear': [r'(?:in to |into |in |to |per )?(?:the )?left ear', r'\ba\.s\.\b'], |
183 | 183 | 'in right ear': [r'(?:in to |into |in |to |per )?(?:the )?right ear', r'\ba\.d\.\b'], |
184 | | - 'in each ear': [r'(?:in to |into |in |to |per )?(?:both ears|each ear|(?!affected )ears)', r'\ba\.u\.\b', r'\bau\b'], |
| 184 | + 'in each ear': [r'(?:in to |into |in |to |per )?(?:bilateral ears|both ears|each ear|(?!affected )ears)', r'\ba\.u\.\b', r'\bau\b'], |
185 | 185 | 'in affected ear': [r'(?:in to |into |in |to |per )?(?:the )?affected ear\b'], |
186 | 186 | 'in ear(s)': ['by ear', 'otically', 'otic', r'(?:in to |into |in |to |per )?(?:the )?(?!affected )ear\b'], |
187 | 187 | 'in left nostril': [r'(?:in to |into |in |to |per )?(?:the )?left (?:nose|nostril|nare)'], |
188 | 188 | 'in right nostril': [r'(?:in to |into |in |to |per )?(?:the )?right (?:nose|nostril|nare)'], |
189 | 189 | 'in each nostril': [r'(?:in to |into |in |to |per )?(?:both nostrils|each nostril|(?<!affected )nostrils|each nare)', r'\bien\b'], |
190 | | - 'in nostril(s)': ['by nose', 'nasally', r'nasal(?! spray)', 'intranasal', r'(?:in to |into |in |to |per )?(?:the )?(?!each|left|right|both)(?:affected)?(?:nose|nostrils|nostril|nare)\b'], |
| 190 | + 'in nostril(s)': [r'\bvn\b', 'by nose', 'nasally', r'nasal(?! spray)', 'intranasal', r'(?:in to |into |in |to |per )?(?:the )?(?!each|left|right|both)(?:affected)?(?:nose|nostrils|nostril|nare)\b'], |
191 | 191 | 'in left eye': [r'(?:in to |into |in |to |per )?(?:the )?left eye', r'\bo\.s\.\b', r'\bos\b'], |
192 | 192 | 'in right eye': [r'(?:in to |into |in |to |per )?(?:the )?right eye', r'\bo\.d\.\b', r'\bod\b'], |
193 | 193 | 'in each eye': [r'(?:in to |into |in |to |per )?(?:both eyes|each eye|(?!affected )eyes)', r'\bo\.u\.\b', r'\bou\b'], |
|
198 | 198 | 'under the tongue': ['sublingually', 'sublingual', r'under (?:the )?tongue', r'sub(?: |-)?lingual(?:ly)?', r'\bs\.l\.\b', r'\bsl\b'], |
199 | 199 | 'under the skin': ['subcutaneously', 'subcutaneous', r'(?:into|in|under) (?:the )?skin', r'sub(?: |-)*cutaneous(?:ly)?', r'subq\b', r'sub\.q\.', r'sc\b', r'subcu\b', r's\.c\.', r'sq\b', r's\.q\.', 's/q'], |
200 | 200 | 'rectally': ['rectal', r'p\.r\.\b', r'pr\b', r'in(?:to)* (?:the )?(?:butt|anus|rectum)'], |
201 | | - 'into the muscle': ['intramuscularly', r'i\.m\.\b', r'\bim\b', 'intramuscular', r'in(?:to)?(?: the)? muscle' ], |
| 201 | + 'into the muscle': ['intramuscularly', r'i\.m\.\b', r'\bim\b', 'intramuscular', r'in(?:to)?(?: the)? muscle', 'intramuscularrly'], |
202 | 202 | 'intravenously': [r'i\.v\.', r'\biv\b', 'intravenous'], |
203 | 203 | 'cutaneously': [r'\bcutaneous'], |
204 | 204 | 'to the skin': ['transdermally', 'transdermal', 'patch', 'patches'], |
|
347 | 347 | """ |
348 | 348 |
|
349 | 349 | TOPICAL_ROUTES = { |
350 | | - 'topically': [r'topical\b', 'application', 'apply', 'patch'], |
| 350 | + 'topically': [r'topical\b', r'\btop\b', 'application', 'apply', 'patch'], |
351 | 351 | 'affected areas': [r'involved (?:areas|sites)'], |
352 | 352 | 'affected area': [r'\baa\b', r'involved (?:area|site)\b'], |
353 | 353 | 'back': [], |
354 | 354 | 'scalp': [], |
355 | 355 | 'torso': [], |
356 | 356 | 'arms': [], |
| 357 | + 'legs': [], |
| 358 | + 'abdomen': [], |
357 | 359 | 'arm': [], |
358 | 360 | 'eyelids': ['eye lids'], |
359 | 361 | 'eyelid': [r'eye lid\b'], |
|
366 | 368 | 'buttocks': [r'butt\b'], |
367 | 369 | 'blood blister': [], |
368 | 370 | 'face': [], |
| 371 | + 'chest': [], |
| 372 | + 'shoulders': [], |
369 | 373 | } |
370 | 374 |
|
371 | 375 | INHALATION_ROUTES = { |
|
441 | 445 | # tablet |
442 | 446 | # TODO: add all synonyms to exclusion for tablet |
443 | 447 | # ERROR: make sure "tablespoon" does not match on "tab" -- use a negative lookahead |
444 | | - 'tablet': [r'(?<!film-coated)(?<!effervescentgastro-resistant)(?<!orodispersible)(?<!prolonged-release)(?<!vaginal)(?<!effervescent vaginal)(?<!modified-release)(?<!chewable)(?<!sublingual)(?<!buccalmuco-adhesive buccal)(?<!soluble)(?<!dispersible)(?<!delayed-release particles)(?<!oral)(?<!inhalation vapor)(?<!implantation)(?<!extended-release film coated)(?<!ultramicronized)(?<!extended-release)(?<!extended-release enteric coated)(?<!delayed-release)(?<!coated particles)(?<!sustained-release buccal)(?<!multilayer)\s*tab(?:let)?(?:s)?', r't\b', r'ts\b'], |
| 448 | + 'tablet': [r'(?<!film-coated)(?<!effervescentgastro-resistant)(?<!orodispersible)(?<!prolonged-release)(?<!vaginal)(?<!effervescent vaginal)(?<!modified-release)(?<!chewable)(?<!sublingual)(?<!buccalmuco-adhesive buccal)(?<!soluble)(?<!dispersible)(?<!delayed-release particles)(?<!oral)(?<!inhalation vapor)(?<!implantation)(?<!extended-release film coated)(?<!ultramicronized)(?<!extended-release)(?<!extended-release enteric coated)(?<!delayed-release)(?<!coated particles)(?<!sustained-release buccal)(?<!multilayer)\s*tab(?:let)?(?:s)?', r'tb\b', r't\b', r'ts\b'], |
445 | 449 | 'film-coated tablet': [r'(?:film-coated|film coated) tab(?:let)?(?:s)?'], |
446 | 450 | 'effervescent tablet': [r'effervescent tab(?:let)?(?:s)?'], |
447 | 451 | 'gastro-resistant tablet': [r'(?:gastro-resistant|gastro resistant) tab(?:let)?(?:s)?'], |
|
482 | 486 | 'prolonged-release capsule': [r'(?:prolonged-release|prolonged release) cap(?:sule)?(?:s)?\b'], |
483 | 487 | 'coated pellets capsule': [r'coated pellets cap(?:sule)?(?:s)?\b'], |
484 | 488 | 'delayed-release capsule': [r'(?:delayed-release|delayed release|d.r.|dr) cap(?:sule)?(?:s)?\b'], |
485 | | - 'oral capsule': [r'oral cap(?:sule)?(?:s)?\b'], |
486 | 489 | 'extended-release film coated capsule': [r'(?:extended-release|extended release|e.r.|er) (?:film coated|film-coated) cap(?:sule)?(?:s)?\b'], |
487 | 490 | 'extended-release coated capsule': [r'(?:extended-release|extended release|e.r.|er) coated cap(?:sule)?(?:s)?\b'], |
488 | 491 | 'extended-release capsule': [r'(?:extended-release|extended release|e.r.|er) cap(?:sule)?(?:s)?\b'], |
|
540 | 543 | 'cutaneous aerosol': [], |
541 | 544 | 'metered dose aerosol': [], |
542 | 545 | # gum |
| 546 | + 'gummie': [], |
543 | 547 | 'gum': [], |
544 | 548 | 'oral gum': [], |
545 | 549 | 'medicated chewing-gum': [r'medicated chewing gum'], |
|
630 | 634 | 'pen': [], |
631 | 635 | 'applicatorful': ['applicatorsful', 'applicator'], |
632 | 636 | # NOTE: have a separate parser for generic application keywords (i.e. 'apply') |
633 | | - 'application': [r'app\b', r'applic\b'], |
| 637 | + 'application': [ r'applic\b', r'appl\b', r'app\b'], |
634 | 638 | 'capful': [], |
635 | 639 | 'injection': [], |
636 | 640 | 'packet': ['pkt'], |
|
645 | 649 | 'swab': [], |
646 | 650 | 'squirt': [], |
647 | 651 | 'pump': [], |
| 652 | + 'troche': [], |
| 653 | + 'cartridge': ['cartridges'], |
648 | 654 | } |
649 | 655 |
|
650 | 656 | PAIN_SEVERITIES = { |
|
669 | 675 | 'eye': [], |
670 | 676 | 'muscle/joint': [], |
671 | 677 | 'muscle': [], |
| 678 | + 'nerve': [], |
| 679 | + 'neuropathic': [], |
672 | 680 | 'joint': [], |
673 | 681 | 'throat': [], |
674 | 682 | 'back': [], |
|
719 | 727 | 'bladder irritation': [], |
720 | 728 | 'bladder spasm': [], |
721 | 729 | 'bleeding': [], |
| 730 | + 'blood glucose monitoring': [], |
722 | 731 | 'blood sugar less than': [], |
| 732 | + 'blood pressure': [], |
723 | 733 | 'bradycardia': [], |
724 | 734 | 'burning with urination': [], |
| 735 | + 'cholesterol': ['choleserol'], |
725 | 736 | 'chest pain': [], |
726 | 737 | 'cold sore': ['cold sores'], |
727 | 738 | 'cold': [], |
|
735 | 746 | 'demand feeding': [], |
736 | 747 | 'depression': [], |
737 | 748 | 'diarrhea': [], |
| 749 | + 'diabetes': ['type 2 diabetes'], |
738 | 750 | 'difficulty breathing': [], |
739 | 751 | 'discomfort': [], |
740 | 752 | 'dizziness': [], |
|
763 | 775 | 'hallucination': [], |
764 | 776 | 'headache': [], |
765 | 777 | 'heartburn': [], |
| 778 | + 'heart rate': ['heart rates', r'\bhr\b'], |
766 | 779 | 'hiccups': [], |
| 780 | + 'heart failure': [], |
| 781 | + 'heart': [], |
767 | 782 | 'hemorrhoids': [], |
| 783 | + 'hair': [], |
768 | 784 | 'high blood pressure': [], |
769 | 785 | 'high blood sugar': [], |
| 786 | + 'high cholesterol': ['hyperlipidemia'], |
770 | 787 | 'hives': [], |
771 | 788 | 'hypoglycemia': [], |
| 789 | + 'hypothyroidism': ['underactive thyroid'], |
772 | 790 | 'incontinence': [], |
773 | 791 | 'indigestion': [], |
774 | 792 | 'infection': [], |
775 | 793 | 'inflammation': [], |
| 794 | + 'inflammatory bowel disease': [r'\bibd\b'], |
776 | 795 | 'insomnia': [], |
777 | 796 | 'intercourse': [], |
778 | 797 | 'irritation': [], |
|
782 | 801 | 'low blood sugar': [], |
783 | 802 | 'low heart rate': [], |
784 | 803 | 'migraine': [], |
| 804 | + 'mood': [], |
785 | 805 | 'mucositis': [], |
786 | 806 | 'movement disorder': [], |
787 | 807 | 'muscle spasm': [], |
788 | 808 | 'nasal congestion': [], |
789 | 809 | 'nasal dryness': [], |
790 | 810 | 'nausea': [], |
791 | 811 | 'numbness': [], |
| 812 | + 'opioid dependence': [], |
792 | 813 | 'opioid reversal': [], |
793 | 814 | 'outbreak': [], |
| 815 | + 'overdose': [], |
794 | 816 | 'palpitations': [], |
| 817 | + 'panic attack': [], |
795 | 818 | 'perianal irritation': [], |
796 | 819 | 'pharyngitis': [], |
| 820 | + 'prostate': [], |
797 | 821 | 'rash': [], |
798 | 822 | 'reflux': [], |
799 | 823 | 'respiratory distress': [], |
800 | 824 | 'respiratory depression': [], |
| 825 | + 'restlessness': [], |
801 | 826 | 'rhinitis': [], |
802 | 827 | 'rigors': [], |
803 | 828 | 'seasonal allergies': [], |
|
822 | 847 | 'soreness': [], |
823 | 848 | 'spasm': [], |
824 | 849 | 'stomatitis': [], |
| 850 | + 'stroke': [], |
825 | 851 | 'swelling': [], |
826 | 852 | 'teething': [], |
827 | 853 | 'thrush': [], |
828 | 854 | 'thyroid': [], |
| 855 | + 'tick bite': [], |
829 | 856 | 'tremor': ['tremors'], |
| 857 | + 'ulcerative colitis': [], |
830 | 858 | 'unable to take po': [], |
831 | 859 | 'urge to smoke': [], |
832 | 860 | 'urinary burning': [], |
| 861 | + 'urinary tract infection': [r'\buti'], |
833 | 862 | 'urinary tract irritation': [], |
834 | 863 | 'urinary tract symptoms': [], |
835 | 864 | 'vertigo': [], |
|
0 commit comments