Skip to content

Case compiler

app.encounter.compiler

Compile an authored case into an immutable, content-hashed version that an encounter pins.

SCHEMA = 'compiled-case-v8' module-attribute

ASSESSOR_ONLY = ('truth', 'timeline', 'ddx', 'kernel', 'actions', 'unsafe', 'closure', 'assessment', 'review', 'critical_rules') module-attribute

PATIENT_FACING = ('title', 'opening', 'persona', 'patient_knowledge', 'speech_style', 'voice', 'permitted_negatives') module-attribute

SOURCE_LANGUAGE = 'hi-IN' module-attribute

SARVAM_SPEAKERS = frozenset('shubh aditya ritu priya neha rahul pooja rohan simran kavya amit dev ishita shreya ratan varun manan sumit roopa kabir aayan ashutosh advait anand tanya tarun sunny mani gokul vijay shruti suhani mohit kavitha rehan soham rupali'.split()) module-attribute

GEMINI_VOICES = frozenset('Zephyr Puck Charon Kore Fenrir Leda Orus Aoede Callirrhoe Autonoe Enceladus Iapetus Umbriel Algieba Despina Erinome Algenib Rasalgethi Laomedeia Achernar Alnilam Schedar Gacrux Pulcherrima Achird Zubenelgenubi Vindemiatrix Sadachbia Sadaltager Sulafat'.split()) module-attribute

REVIEWED = 'approved' module-attribute

METADATA = ('specialty', 'variant', 'palliative', 'approval', 'status', 'activate_in_app', 'cohort', 'cohort_label', 'content_notice', 'learner_levels', 'location_claim', 'source_ids', 'review_notes') module-attribute

DEFAULT_TRIGGERS = {'duration': ['कब', 'दिन', 'कितने', 'since', 'duration'], 'course': ['कब', 'दिन', 'fever', 'बुखार'], 'fever': ['बुखार', 'fever', 'temperature'], 'respiratory': ['खाँसी', 'cough', 'गला'], 'severity': ['साँस', 'breath', 'बेहोश', 'चक्कर', 'severe'], 'hydration': ['पानी', 'पेशाब', 'urine', 'drink'], 'intake': ['पानी', 'खा', 'drink'], 'intake_output': ['पानी', 'पेशाब', 'drink'], 'medication': ['दवा', 'दवाई', 'medicine', 'दवाई', 'tablet'], 'medications': ['दवा', 'inhaler', 'पंप'], 'meds': ['दवा', 'medicine', 'painkiller'], 'drugs': ['दवा', 'medicine', 'tablet'], 'travel': ['यात्रा', 'बाहर', 'travel', 'गाँव'], 'exposure': ['संपर्क', 'contact', 'travel'], 'background': ['पहले', 'बीमारी', 'history'], 'history': ['पहले', 'history'], 'allergy': ['allerg', 'एलर्जी'], 'expectation': ['चिंता', 'concern', 'उम्मीद'], 'concern': ['चिंता', 'डर', 'concern'], 'belief': ['लगता', 'क्यों', 'think'], 'vomiting': ['उल्टी', 'vomit'], 'pain': ['दर्द', 'pain'], 'urine': ['पेशाब', 'urine'], 'bleeding': ['खून', 'bleed', 'blood'], 'previous_results': ['report', 'रिपोर्ट'], 'prior_workup': ['report', 'रिपोर्ट', 'जाँच'], 'rigors': ['ठंड', 'कँप', 'chills'], 'g6pd': ['g6pd'], 'access': ['खर्च', 'मदद', 'cost', 'support'], 'weight': ['वजन', 'weight', 'कपड़े'], 'node': ['गाँठ', 'गांठ', 'lump'], 'systemic': ['जोड़', 'rash', 'दाने'], 'baseline': ['पहले', 'usual', 'baseline'], 'sputum': ['बलगम', 'sputum'], 'smoking': ['धूम्रपान', 'बीड़ी', 'smok'], 'alternatives': ['छाती', 'chest'], 'stool': ['दस्त', 'मल', 'stool'], 'danger': ['चक्कर', 'खून', 'faint'], 'ORS': ['ors', 'ओआरएस'], 'other_drugs': ['और दवा', 'iron', 'aspirin'], 'alcohol': ['शराब', 'alcohol'], 'cough': ['खाँसी', 'cough'], 'mental': ['भ्रम', 'confus'], 'support': ['घर', 'मदद', 'support'], 'symptoms': ['symptom', 'लक्षण', 'दर्द', 'pain', 'खाँसी', 'cough'], 'report': ['report', 'रिपोर्ट', 'scan', 'biopsy', 'endoscopy'], 'treatment_history': ['treatment', 'इलाज', 'injection', 'tablet', 'medicine'], 'function': ['daily', 'काम', 'walk', 'चल'], 'tobacco': ['tobacco', 'gutka', 'paan', 'smoking', 'बीड़ी'], 'family': ['family', 'घर', 'children', 'बच्च'], 'nutrition': ['food', 'खाना', 'appetite', 'भूख', 'weight', 'वजन']} module-attribute

ROMAN = {'बुखार': ['bukhar', 'bukhaar', 'fever', 'temperature'], 'खाँसी': ['khansi', 'khaansi', 'khasi', 'cough'], 'दर्द': ['dard', 'pain'], 'साँस': ['saans', 'sans', 'breath'], 'उल्टी': ['ulti', 'vomit'], 'दस्त': ['dast', 'loose motion', 'diarrh'], 'पेशाब': ['peshab', 'urine'], 'पानी': ['pani', 'water'], 'दवा': ['dawa', 'dava', 'medicine'], 'दवाई': ['dawai', 'dawaai', 'medicine'], 'गोली': ['goli', 'tablet'], 'खून': ['khoon', 'khun', 'blood'], 'चक्कर': ['chakkar', 'dizz'], 'कब': ['kab'], 'दिन': ['din', 'days'], 'कितने': ['kitne'], 'वजन': ['vajan', 'wajan', 'weight'], 'वज़न': ['vazan', 'wazan', 'weight'], 'गाँठ': ['ganth', 'gaanth', 'lump'], 'बलगम': ['balgam', 'phlegm', 'sputum'], 'चिंता': ['chinta', 'worry'], 'डर': ['dar', 'afraid', 'scared'], 'घर': ['ghar', 'home'], 'काम': ['kaam', 'work'], 'यात्रा': ['yatra', 'travel'], 'पेट': ['pet', 'stomach', 'tummy'], 'खाना': ['khana', 'food'], 'भूख': ['bhookh', 'bhukh', 'appetite'], 'नींद': ['neend', 'sleep'], 'ठंड': ['thand', 'chills'], 'कमजोरी': ['kamzori', 'weakness'], 'कमज़ोरी': ['kamzori', 'weakness'], 'पहले': ['pehle', 'before'], 'एलर्जी': ['allergy'], 'रिपोर्ट': ['report'], 'इलाज': ['ilaj', 'ilaaj', 'treatment'], 'शुगर': ['sugar'], 'घाव': ['ghav', 'ghaav', 'wound']} module-attribute

ATTRIBUTE_NAME = re.compile('^[a-z][a-z0-9_]{1,40}$') module-attribute

case_hash(case)

expand_triggers(triggers)

compile_case(raw)

review_gate_enforced()

Off until faculty reviewers are onboarded; FACULTY_REVIEW_GATE=enforce blocks unreviewed cases.

pending_review(case)

Review items that block curricular use once the faculty gate is enforced.