Skip to main content

Python client for the EDTriage OpenEnv RL environment

Project description

edtriage-client

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

Install

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

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

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

# 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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

edtriage_client-1.0.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

edtriage_client-1.0.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file edtriage_client-1.0.0.tar.gz.

File metadata

  • Download URL: edtriage_client-1.0.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for edtriage_client-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5d03f7cac8763b7b7c1c6fed915013fe906c9c4b4e1d1f339bb5aaea93ad3ff9
MD5 d2a2c66a8c944776deae7cc246cd3d75
BLAKE2b-256 b11272bb9e76b4db0a97cf27ea03365a010c69aef23529edaf8adf8daf0d243a

See more details on using hashes here.

File details

Details for the file edtriage_client-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for edtriage_client-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e414943e63df467acbf0f63f9406523a0ade1788a839ab6e7ed068c090c72ce4
MD5 6185a0a5ffd4445761f68fed8515617e
BLAKE2b-256 1a93eca670e6ed0483e46ca67c86f392fb09dd173719f0fe978f496410fa7788

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page