sankar-raul/ICD-10-code-predictor-env
0
1"""Offline task set for the Medical Coding Assistant environment."""2 3from dataclasses import dataclass, field4 5 6@dataclass(frozen=True)7class TaskCase:8 """A deterministic coding task with gold answers and hints."""9 10 task_id: str11 difficulty: str12 objective: str13 encounter_text: str14 allowed_codes: tuple[str, ...]15 gold_primary: str16 gold_secondary: tuple[str, ...]17 should_review: bool18 accepted_primary_alternates: tuple[str, ...] = ()19 accepted_secondary_alternates: tuple[str, ...] = ()20 hints: tuple[str, ...] = ()21 notes: tuple[str, ...] = field(default_factory=tuple)22 23 24TASKS: dict[str, TaskCase] = {25 "easy_t2dm_followup": TaskCase(26 task_id="easy_t2dm_followup",27 difficulty="easy",28 objective="Assign the most specific primary diagnosis code and any supported status code.",29 encounter_text=(30 "Outpatient follow-up: 58-year-old with type 2 diabetes mellitus without "31 "documented complications. She takes metformin chronically. No insulin use. "32 "No hypertension documented at this visit."33 ),34 allowed_codes=("E11.9", "E11.65", "Z79.84", "I10", "R73.03"),35 gold_primary="E11.9",36 gold_secondary=("Z79.84",),37 should_review=False,38 accepted_primary_alternates=("E11",),39 hints=(40 "The note supports diabetes without complications, not prediabetes.",41 "Long-term oral hypoglycemic use can be coded separately when explicitly documented.",42 ),43 ),44 "medium_hypertensive_ckd": TaskCase(45 task_id="medium_hypertensive_ckd",46 difficulty="medium",47 objective="Use the combination diagnosis when hypertension and CKD are documented together.",48 encounter_text=(49 "Clinic visit: 71-year-old with longstanding hypertension and chronic kidney "50 "disease stage 3a. Provider documents blood-pressure management for hypertensive "51 "chronic kidney disease. No diabetes is documented."52 ),53 allowed_codes=("I12.9", "I10", "N18.30", "N18.9", "E11.22", "Z79.899"),54 gold_primary="I12.9",55 gold_secondary=("N18.30",),56 should_review=False,57 hints=(58 "Plain essential hypertension is not the best primary code when CKD is linked.",59 "The documented CKD stage should still be captured as an additional code.",60 ),61 ),62 "hard_chest_pain_review": TaskCase(63 task_id="hard_chest_pain_review",64 difficulty="hard",65 objective="Code the documented symptoms and flag the chart for human review when the final diagnosis remains uncertain.",66 encounter_text=(67 "Emergency department note: patient presents with acute chest pain and an "68 "abnormal ECG. Clinician documents 'rule out acute coronary syndrome' and "69 "requests cardiology review. Final diagnosis is not established in the note."70 ),71 allowed_codes=("R07.9", "R94.31", "I20.9", "I21.9", "Z03.89"),72 gold_primary="R07.9",73 gold_secondary=("R94.31",),74 should_review=True,75 hints=(76 "Do not code a definitive acute coronary diagnosis that is only being ruled out.",77 "The chart explicitly says a human specialist review is needed before a final diagnosis.",78 ),79 ),80}81 82TASK_SEQUENCE: tuple[str, ...] = (83 "easy_t2dm_followup",84 "medium_hypertensive_ckd",85 "hard_chest_pain_review",86)87 