arpann09/med-reconciliation-hard
Medication Reconciliation — OpenEnv Environment
An OpenEnv environment where an AI agent acts as a clinical pharmacist, identifying dangerous discrepancies between a patient's home medications and their hospital discharge prescription.
Why This Matters
Medication reconciliation errors cause ~1.5 million patient injuries per year in the US. They most commonly occur during care transitions — when a patient leaves the hospital and nobody systematically compares the two medication lists. This is a real problem that costs lives and billions in preventable harm annually.
This environment trains and evaluates AI agents on exactly that task — giving the RL/agent community a medically grounded, high-stakes benchmark that doesn't exist anywhere else.
The Task
The agent receives two medication lists:
- Home medications — what the patient was taking before hospitalization
- Discharge medications — what the hospital prescribed on discharge
The agent must identify all discrepancies by issuing flag actions, then call submit when done. Rewards are given at every step — the agent gets signal on each flag, not just at the end.
Action Space
Observation Space
Tasks
Easy — Exact Duplicate (1 issue)
Patient on warfarin has it listed twice in discharge. Double dosing a blood thinner = fatal bleeding risk.
Medium — Brand/Generic Duplicate (1 issue)
Patient takes Ultram (brand) at home, hospital prescribes tramadol (generic) — same drug, double dose. Patient is also on sertraline (SSRI), making the duplicate life-threatening via serotonin syndrome.
Hard — Three Hidden Issues (3 issues)
- Coumadin + aspirin interaction (Coumadin = warfarin, major bleeding risk)
- Digoxin dose doubled 0.125mg → 0.25mg (narrow therapeutic index, fatal arrhythmia risk)
- Metoprolol missing from discharge (abrupt beta-blocker withdrawal = heart attack risk)
Reward Function
Setup
pip install openenv-core pydantic openai
docker build -t med-recon-env .
docker run -p 7860:7860 -e MED_RECON_TASK=easy med-recon-envRun Inference
export API_BASE_URL="https://router.huggingface.co/v1"
export MODEL_NAME="Qwen/Qwen2.5-72B-Instruct"
export HF_TOKEN="your_token"
export MED_RECON_TASK="all"
python inference.pyBaseline Scores
Scores normalized to [0.0, 1.0]. Success threshold is 0.5. The hard task has 3 planted issues — a perfect score requires identifying all 3.
