Metadata-Version: 2.4
Name: edtriage-client
Version: 1.0.0
Summary: Python client for the EDTriage OpenEnv RL environment
Author-email: Nakul Singh <nakul.singh@example.com>
Project-URL: Homepage, https://huggingface.co/spaces/NakulSinghCR7/edtriage-env
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.27.0

# edtriage-client

Python client library for the **EDTriage-Env** OpenEnv RL environment.

## Install

```bash
pip install httpx
# then copy edtriage_client/ into your project
# or install directly:
pip install git+https://huggingface.co/spaces/NakulSinghCR7/edtriage-env
```

## Quick Start

```python
from edtriage_client import EDTriageEnv

env = EDTriageEnv(base_url="https://nakulsinghcr7-edtriage-env.hf.space")
obs = env.reset(task_id="task_1_routine_shift", seed=42)

while not env.done:
    pending = obs.get("pending_actions", [])
    if pending:
        result = env.triage(pending[0], esi_level=3)
    else:
        result = env.wait()
    obs = result["observation"]

score = env.grade()
print(f"Score: {score['score']:.4f}")
print(f"Breakdown: {score['breakdown']}")
```

## Tasks

| Task ID | Name | Difficulty |
|---------|------|------------|
| `task_1_routine_shift` | Routine ER Shift | 🟢 Easy |
| `task_2_capacity_crunch` | Capacity Crunch | 🟡 Medium |
| `task_3_mass_casualty` | Mass Casualty Surge | 🔴 Hard |

## API Reference

```python
env = EDTriageEnv(base_url="...", timeout=30.0)

obs  = env.reset(task_id, seed)          # Start new episode
res  = env.step(action_dict)             # Execute action
res  = env.triage(patient_id, esi_level) # Shorthand
res  = env.assign_bed(patient_id, zone)  # Shorthand
res  = env.discharge(patient_id)         # Shorthand
res  = env.activate_surge()              # Shorthand
res  = env.wait()                        # Shorthand
info = env.state()                       # Full state
info = env.dashboard()                   # Dashboard state
info = env.grade()                       # Grade episode
info = env.tasks()                       # List tasks
info = env.health()                      # Health check
```

## Action Space

```python
# Triage a patient
env.step({"action_type": "triage", "patient_id": "PT-001", "esi_level": 2})

# Assign bed
env.step({"action_type": "assign_bed", "patient_id": "PT-001", "zone": "critical"})

# Order diagnostic
env.step({"action_type": "order_diagnostic", "patient_id": "PT-001", "diagnostic": "ecg"})

# Discharge
env.step({"action_type": "discharge", "patient_id": "PT-001"})

# Activate mass casualty surge
env.step({"action_type": "activate_surge"})

# Wait (do nothing)
env.step({"action_type": "wait"})
```

## Context Manager

```python
with EDTriageEnv() as env:
    obs = env.reset("task_2_capacity_crunch", seed=7)
    # ... run episode ...
    print(env.grade())
```
