CoolFace
Apppublic

prashant-9457/my-openenv-task

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
README.md121 linesDownload Raw Back to root
1---2title: ICU Resource Allocation OpenEnv3emoji: ๐Ÿฅ4colorFrom: red5colorTo: yellow6sdk: docker7pinned: false8---9 10# ๐Ÿฅ ICU Resource Allocation โ€” OpenEnv11 12A **real-world OpenEnv environment** modelling a 20-bed ICU in a 500-bed Indian tertiary-care hospital. An AI agent acts as the **ICU charge coordinator**, making resource allocation decisions every 30 minutes over a 24-hour duty cycle.13 14---15 16## ๐ŸŒ Real-World Grounding17 18This environment is not a simulation of a game โ€” it models actual clinical practice:19 20| Element | Real-World Source |21|---------|-------------------|22| SOFA scoring (0โ€“24) | Vincent et al., *JAMA* 1996 โ€” gold-standard ICU triage |23| SOFA โ†’ mortality | Ferreira et al., *JAMA* 2001 |24| Nurse:patient ratio | NABH ICU Standard (India) โ€” max 1:2 |25| Bed turnover times | Agnihotri et al., *Indian J Crit Care Med* 2019 |26| Arrival patterns | Arias-Verdรบ et al., *Critical Care Medicine* 2017 |27| Cost calibration | CGHS ICU package rates 2023 (Central Govt Health Scheme) |28 29---30 31## ๐ŸŽฎ Action Space (7 discrete actions)32 33| # | Action | Effect | Cost |34|---|--------|--------|------|35| 0 | **HOLD** | Observe, no change | โ‚น0 |36| 1 | **ADMIT_CRITICAL** | Admit highest-SOFA patient | โ€” |37| 2 | **ADMIT_FIFO** | Admit longest-waiting patient | โ€” |38| 3 | **TRANSFER_OUT** | Move stable patient to step-down | โ€” |39| 4 | **CALL_EXTRA_NURSE** | +1 nurse, improves ratio | โ‚น1,200 |40| 5 | **SPECIALIST_CONSULT** | โˆ’15% mortality risk on sickest patient | โ‚น3,500 |41| 6 | **EXPEDITE_BED** | Faster bed turnover | โ‚น600 |42 43---44 45## ๐Ÿ‘๏ธ Observation Space (27 fields)46 47Rich, clinically meaningful state:48- **Bed status**: occupied / available / in turnover49- **Queue**: total waiting, broken down by SOFA severity (critical/severe/moderate), longest wait50- **Patient acuity**: avg SOFA score, avg mortality risk of current ICU patients51- **Equipment**: ventilators & dialysis machines available/in-use52- **Staff**: nurses on duty, nurse:patient ratio, doctors53- **Time**: hour, shift (Day/Evening/Night), step54- **Budget**: remaining INR, utilisation %55- **Outcomes**: admissions, transfers, deaths in queue, adverse events, wait violations56 57---58 59## ๐Ÿ“‹ Tasks60 61### ๐ŸŸข Easy โ€” Prevent Preventable Deaths62Zero queue deaths + nurse:patient ratio โ‰ค 2.0 in โ‰ฅ90% of steps.63 64### ๐ŸŸก Medium โ€” NABH-Compliant Critical Care65All Easy criteria + all critical patients (SOFA โ‰ฅ 11) admitted within **2 hours** of arrival. Maps to NABH Grade-B ICU standard.66 67### ๐Ÿ”ด Hard โ€” JCI-Grade ICU Excellence68All Medium criteria + zero adverse events + budget โ‰ค 85% + average SOFA non-increasing. Maps to JCI / NABH Grade-A accreditation benchmarks.69 70---71 72## ๐Ÿ”Œ API73 74```bash75# Reset76curl -X POST http://localhost:7860/reset -H "Content-Type: application/json" -d '{"seed": 42}'77 78# Step (action 1 = ADMIT_CRITICAL)79curl -X POST http://localhost:7860/step -H "Content-Type: application/json" -d '{"action": 1}'80 81# State82curl http://localhost:7860/state83```84 85---86 87## ๐Ÿš€ Local Setup88 89```bash90pip install -r requirements.txt91 92# Run server93python app.py94 95# Run graders (validates all scores in [0,1])96python graders/task_graders.py97 98# Run LLM inference (needs env vars)99export API_BASE_URL=...100export MODEL_NAME=...101export HF_TOKEN=...102python inference.py103```104 105---106 107## ๐Ÿ“ Structure108 109```110hospital_env/111โ”œโ”€โ”€ env.py                 # ICU environment (SOFA, NABH, Poisson arrivals)112โ”œโ”€โ”€ app.py                 # FastAPI: /reset /step /state113โ”œโ”€โ”€ inference.py           # LLM agent via OpenAI client114โ”œโ”€โ”€ openenv.yaml           # OpenEnv spec115โ”œโ”€โ”€ requirements.txt116โ”œโ”€โ”€ Dockerfile117โ”œโ”€โ”€ README.md118โ””โ”€โ”€ graders/119    โ””โ”€โ”€ task_graders.py    # Easy / Medium / Hard graders โ†’ scores [0,1]120```121