File size: 3,935 Bytes
27158b3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# MediRoute OpenEnv configuration
# Compatible with the OpenEnv specification

env_id: mediroute-openenv-v1
version: "1.0.0"
name: "MediRoute OpenEnv"
description: >
  A medical triage and hospital routing simulation environment where an AI agent
  analyses patient symptoms and lab results, determines severity, recommends the
  correct specialist, selects the best nearby hospital, books appointments, and
  escalates emergencies with ambulance dispatch.

author: "MediRoute Team"
license: MIT

# ── Environment entry-point ────────────────────────────────────────────────
entrypoint:
  module: environment
  class: MediRouteEnv

# ── Task definitions ───────────────────────────────────────────────────────
tasks:
  - id: easy
    difficulty: easy
    description: "Mild illness β€” fever and sore throat. Classify low severity, recommend GP, book appointment."
    max_steps: 6
    passing_score: 0.5

  - id: medium
    difficulty: medium
    description: "Cardiology case β€” chest pain, high BP, ECG abnormality. Recommend cardiologist, select cardiac hospital."
    max_steps: 8
    passing_score: 0.6

  - id: hard
    difficulty: hard
    description: "Life-threatening emergency β€” severe chest pain, SpOβ‚‚ crash, unresponsive. Dispatch ambulance immediately."
    max_steps: 6
    passing_score: 0.5

# ── Action space ───────────────────────────────────────────────────────────
action_space:
  type: discrete
  actions:
    - analyze_symptoms
    - request_more_info
    - recommend_specialist
    - select_hospital
    - book_appointment
    - call_ambulance
    - provide_temp_guidance

# ── Observation space ──────────────────────────────────────────────────────
observation_space:
  symptoms:
    type: string
    description: "Free-text patient complaints"
  lab_report_summary:
    type: object
    description: "Key lab / vital results"
  severity_score:
    type: float
    range: [0.0, 1.0]
    description: "Numeric severity score"
  location:
    type: string
    description: "Patient geographic area"
  nearby_hospitals:
    type: list[string]
    description: "Candidate hospitals sorted by proximity/quality"
  available_specialists:
    type: list[string]
    description: "On-call specialists"
  previous_actions:
    type: list[string]
    description: "Action history for this episode"

# ── Reward structure ───────────────────────────────────────────────────────
reward:
  range: [0.0, 1.0]
  components:
    correct_severity_classification: +0.30
    correct_specialist_recommendation: +0.30
    correct_hospital_selection: +0.20
    successful_appointment_booking: +0.20
    correct_emergency_escalation: +0.50
    wrong_department: -0.20
    duplicate_action: -0.30
    unnecessary_ambulance: -0.30
    ambulance_missed_in_emergency: -0.30

# ── Inference configuration ────────────────────────────────────────────────
inference:
  script: inference.py
  env_vars:
    - OPENAI_API_KEY
    - API_BASE_URL
    - MODEL_NAME
    - HF_TOKEN
  max_runtime_minutes: 20
  supports_hf_spaces: true

# ── Runtime constraints ────────────────────────────────────────────────────
runtime:
  cpu_only: true
  max_ram_gb: 8
  max_vcpu: 2