Examination and orders¶
app.encounter.services
¶
Examination and investigation services: authored findings only, never invented.
Requests are normalized through synonym tables (English and Hindi). Broad examination requests follow the case's declared granularity rule, compound orders are confirmed before any result is released, and unavailable versus ambiguous requests get distinct replies. Requesting an examination never demonstrates that the learner can perform it.
EXAM_SYNONYMS = {'vitals': ['vitals', 'vital signs', 'temperature', 'pulse', 'heart rate', 'bp', 'blood pressure', 'respiratory rate', 'spo2', 'saturation', 'oxygen level', 'बुखार नापें', 'बुखार नापता', 'बुखार नाप लूँ', 'नब्ज़', 'नब्ज', 'बीपी'], 'general': ['general examination', 'general exam', 'general appearance', 'pallor', 'dehydration', 'hydration', 'capillary refill', 'dry mouth', 'tongue', 'jaundice', 'icterus', 'extremities warm', 'cool hands', 'हाथ ठंडे'], 'throat': ['throat', 'pharynx', 'tonsil', 'tonsils', 'गला', 'गले'], 'chest': ['chest', 'lungs', 'lung', 'auscultate', 'auscultation', 'breath sounds', 'respiratory system', 'respiratory exam', 'wheeze', 'crackles', 'छाती', 'फेफड़े', 'फेफड़ों'], 'cardiovascular': ['heart sounds', 'cardiac exam', 'cardiovascular', 'cvs', 'दिल की धड़कन'], 'abdomen': ['abdomen', 'abdominal', 'tummy', 'belly', 'palpate', 'पेट'], 'neck': ['neck', 'lymph node', 'lymph nodes', 'cervical node', 'supraclavicular', 'गर्दन', 'गाँठ', 'गांठ'], 'skin': ['skin', 'rash', 'दाने'], 'joints': ['joints', 'joint', 'synovitis', 'जोड़'], 'extremities': ['legs', 'leg swelling', 'pedal edema', 'edema', 'oedema', 'calf', 'peripheral', 'पैर'], 'neuro': ['neurological', 'neuro exam', 'power', 'reflexes', 'cranial nerves', 'orientation'], 'oral': ['oral cavity', 'oral exam', 'mouth exam', 'inside the mouth', 'मुँह के अंदर'], 'rectal': ['rectal', 'per rectal', 'digital rectal', 'dre', 'stool examination']}
module-attribute
¶
BROAD = ['examine', 'examination', 'check him', 'check her', 'check the patient', 'full exam', 'complete exam', 'physical exam', 'जाँच', 'जांच', 'देख लूँ', 'चेक']
module-attribute
¶
ORDER_SYNONYMS = {'cbc': ['cbc', 'complete blood count', 'blood count', 'hemogram', 'haemogram', 'platelet count', 'platelets', 'hemoglobin', 'haemoglobin'], 'chemistry': ['chemistry', 'electrolytes', 'kidney function', 'renal function', 'kft', 'rft', 'lft', 'liver function', 'creatinine', 'urea', 'sodium', 'potassium', 'biochemistry', 'metabolic panel'], 'cxr': ['cxr', 'chest x-ray', 'chest xray', 'chest x ray', 'x-ray chest', 'xray chest', 'छाती का x-ray', 'छाती का एक्सरे'], 'ecg': ['ecg', 'ekg', 'electrocardiogram'], 'blood_gas': ['abg', 'vbg', 'blood gas', 'arterial blood gas'], 'malaria': ['malaria', 'peripheral smear', 'smear for mp', 'mp smear', 'rapid malaria', 'malaria rdt', 'मलेरिया'], 'g6pd': ['g6pd'], 'inflammatory': ['esr', 'crp', 'inflammatory markers'], 'coagulation': ['coagulation', 'pt inr', 'inr', 'aptt', 'clotting'], 'endoscopy': ['endoscopy', 'ogd', 'upper gi endoscopy'], 'ultrasound': ['ultrasound', 'usg', 'sonography', 'sonogram'], 'stool_routine': ['stool routine', 'routine stool', 'stool microscopy'], 'stool_pathogen': ['stool culture', 'stool pathogen', 'stool pcr'], 'respiratory': ['flu test', 'influenza', 'covid', 'respiratory panel', 'viral swab', 'swab test', 'rt-pcr', 'rtpcr'], 'routine': ['routine tests', 'routine blood tests', 'routine panel', 'basic tests'], 'node_sampling': ['fnac', 'node biopsy', 'lymph node biopsy', 'node sampling', 'biopsy of the node'], 'microbiology': ['sputum culture', 'blood culture', 'microbiology', 'gram stain', 'cultures'], 'reports': ['reports', 'report', 'records', 'scan report', 'biopsy report', 'old reports', 'रिपोर्ट'], 'sputum_tb': ['sputum for tb', 'sputum naat', 'cbnaat', 'genexpert', 'gene xpert', 'truenat', 'sputum afb', 'afb', 'tb test', 'टीबी की जाँच', 'बलगम की जाँच'], 'hiv': ['hiv', 'hiv test'], 'glucose': ['blood sugar', 'glucose', 'rbs', 'fbs', 'grbs', 'sugar test', 'capillary glucose', 'शुगर की जाँच'], 'ketones': ['ketones', 'serum ketones', 'blood ketones', 'urine ketones'], 'urine': ['urine routine', 'urine test', 'urinalysis', 'urine examination'], 'foot_xray': ['foot x-ray', 'x-ray foot', 'x-ray of the foot', 'foot xray']}
module-attribute
¶
KEY_CONCEPTS = {'routine_panel': 'routine', 'respiratory_test': 'respiratory', 'cbc_if_requested': 'cbc', 'cbc_now': 'cbc', 'cbc': 'cbc', 'chemistry': 'chemistry', 'chemistry_if_requested': 'chemistry', 'ultrasound_if_indicated': 'ultrasound', 'malaria_microscopy': 'malaria', 'g6pd': 'g6pd', 'esr_crp': 'inflammatory', 'prior_cxr': 'cxr', 'cxr': 'cxr', 'node_sampling_later': 'node_sampling', 'blood_gas_on_room_air': 'blood_gas', 'ecg': 'ecg', 'routine_stool_testing': 'stool_routine', 'stool_pathogen': 'stool_pathogen', 'coagulation': 'coagulation', 'endoscopy_later': 'endoscopy', 'microbiology': 'microbiology', 'reports_if_requested': 'reports', 'sputum_naat': 'sputum_tb', 'hiv_test': 'hiv', 'glucose': 'glucose', 'ketones': 'ketones', 'blood_gas': 'blood_gas', 'foot_xray': 'foot_xray', 'urine_routine': 'urine'}
module-attribute
¶
CONFIRM = re.compile('^\\s*(yes|confirm|confirmed|ok|okay|go ahead|हाँ|हां|haan|ji|जी)\\b', re.I)
module-attribute
¶
REPLIES = {'unavailable': 'That finding or result is not available in this case. Nothing has been invented.', 'ambiguous_exam': 'Please name the part of the examination you want (for example vitals, chest or abdomen).', 'ambiguous_order': 'Please name the specific investigation you want.', 'confirm': 'You requested: {items}. Reply "confirm" to see these results, or ask for a different set.'}
module-attribute
¶
WORD = '\\w\\u0900-\\u0DFF'
module-attribute
¶
examine(case, text, target=None)
¶
Return (reply, component ids, status) for one examination request.
order(case, state, text, target=None)
¶
Return (reply, test keys, status). Compound requests wait for confirmation.