๐Ÿฅ MedDiagnosticEnv

Sequential Clinical Diagnostic Environment for OpenEnv Competition

What is this?

An AI agent plays physician, gathering patient information sequentially via tool calls, forming diagnoses, reviewing clinical notes for errors, and planning treatment. This environment tests real-world diagnostic reasoning, not just medical knowledge recall.

Interactive Diagnostic Walkthrough

Case Information

Select a task and run demo to begin
Episode Workflow
๐Ÿ“‹

Phase 1

DIAGNOSTIC

Gather patient info via tools

โ†’
โœ๏ธ

Phase 2

NOTE_REVIEW

Review SOAP note for errors

โ†’
๐Ÿ“…

Phase 3

PLANNING

Finalize care plan

Test Environment

1. Start Episode

2. Take Action

3. Check State

View current episode state including case progress, scores, and phase information.

๐Ÿ“‹ Phase 1: DIAGNOSTIC (Gather Data & Diagnose)

Workflow: Gather patient info โ†’ form differential โ†’ confirm diagnosis

Available tools: chart.history, chart.vitals, chart.labs, chart.imaging, calculate, ddx.add, ddx.remove

Transition to Phase 2: Call ddx.confirm with {"diagnosis": "..."}

โœ๏ธ Phase 2: NOTE_REVIEW (Correct Errors)

Workflow: Review SOAP note โ†’ identify error โ†’ correct it

Available tools: note.review, note.correct

Step 1: Call note.review with {} to see the note

Step 2: Call note.correct with {"sentence_id": "N", "correction": "..."}

Transition to Phase 3: Call note.flag_none with {}

๐Ÿ“… Phase 3: PLANNING (Finalize Care)

Workflow: Finalize care plan โ†’ end episode

Only tool: plan.finalize

Call: plan.finalize with {"plan": "..."} or {}

Result: Episode ends, episode reward calculated

Available Tools Reference

๐Ÿ“Š Patient Data (Phase 1)

  • chart.history โ€” Patient HPI, PMH, meds
  • chart.vitals โ€” Vital signs (BP, HR, temp)
  • chart.labs โ€” Lab panels (BMP, CBC, ABG)
  • chart.imaging โ€” Imaging reports (CXR, CT)

๐Ÿ”ฌ Clinical Analysis (Phase 1)

  • calculate โ€” Run formulas (anion_gap, qsofa, Wells, etc)
  • ddx.add โ€” Add diagnosis to differential
  • ddx.remove โ€” Remove diagnosis
  • ddx.confirm โ€” Confirm final diagnosis โ†’ Phase 2

๐Ÿ“ Documentation & Planning (Phase 2-3)

  • note.review โ€” View SOAP note (Phase 2)
  • note.correct โ€” Fix error in note (Phase 2)
  • note.flag_none โ€” Mark complete โ†’ Phase 3
  • plan.finalize โ€” Finalize care plan (Phase 3)
Reward Structure (Per Episode)

Phase 1 - Diagnosis (40%): Accuracy of ddx.confirm diagnosis (0.0-1.0 scale)

Phase 2 - Note Correction (25%): Identifying & fixing SOAP note error (0.0-1.0 scale)

Phase 3 - Calculations (20%): Accuracy of medical formulas used (ยฑ5% tolerance = 1.0)

Efficiency (15%): Avoiding unnecessary test calls (1.0 - redundant_tests ร— 0.02)

Final Reward: Sum of (Phase 1 ร— 0.40 + Phase 2 ร— 0.25 + Phase 3 ร— 0.20 + Efficiency ร— 0.15) = 0.0 to 1.0

API Reference

Base URL: https://pratinavseth-meddiagnostic-env.hf.space

POST /reset: Start new episode with task name

POST /step: Execute action and get reward + observation

GET /state: Get current episode state

See inference.py for complete agent integration example.

Quick Reference
What is this?

An AI agent plays physician, gathering patient information sequentially via tool calls, forming diagnoses, reviewing clinical notes for errors, and planning treatment. This environment tests real-world diagnostic reasoning.

Documentation

README: Complete overview at root README.md

Demo Guide: Interactive demo examples in docs/DEMO.md

Evaluator Guide: API integration patterns in docs/EVALUATOR_GUIDE.md

Design Rationale: Technical design decisions in docs/DESIGN_RATIONALE.md