Abhishek-CS221006 commited on
Commit
e324909
Β·
verified Β·
1 Parent(s): ea29383

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +132 -6
README.md CHANGED
@@ -1,9 +1,135 @@
1
- # Clinical Trial Screening OpenEnv
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- This project implements a realistic reinforcement-learning environment for clinical trial patient screening with three tasks:
4
 
5
- - `easy`: eligibility determination against five binary protocol criteria
6
- - `medium`: ranking three candidates for an EGFR-mutated NSCLC trial
7
- - `hard`: detecting exclusions and protocol deviations from unstructured chart text
8
 
9
- Use `openenv validate` to validate the environment and `python inference.py` for a local scripted run.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Clinical Trial Patient Screening
3
+ emoji: πŸ§ͺ
4
+ colorFrom: green
5
+ colorTo: indigo
6
+ sdk: docker
7
+ pinned: false
8
+ app_port: 8000
9
+ tags:
10
+ - openenv
11
+ short_description: RL environment for clinical trial patient screening.
12
+ ---
13
+ # Clinical Trial Patient Screening Environment
14
 
15
+ OpenEnv environment for clinical trial patient screening with three deterministic healthcare tasks:
16
 
17
+ - `easy`: binary eligibility screening against 5 criteria
18
+ - `medium`: ranking 3 patients by protocol fit
19
+ - `hard`: protocol deviation and exclusion detection from unstructured clinical text
20
 
21
+ This environment is designed as a real-world screening workflow rather than a toy game. It uses typed Pydantic models, deterministic programmatic graders, incremental reward shaping for correct data extraction, and terminal rewards for correct screening outcomes.
22
+
23
+ ## Task Overview
24
+
25
+ ### Easy
26
+ EGFR-mutated metastatic NSCLC eligibility check using structured oncology data.
27
+
28
+ ### Medium
29
+ Rank 3 HER2-positive metastatic breast cancer candidates by fit for a trial.
30
+
31
+ ### Hard
32
+ Detect subtle exclusions from an AML screening note, including protocol deviations such as recent investigational treatment, active infection, QTc prolongation, and CYP3A4 inhibitor exposure.
33
+
34
+ ## Reward Design
35
+
36
+ - `+0.20` for each correct clinical data point or valid deviation extracted
37
+ - `+1.00` for a correct final screening decision
38
+ - `-0.50` for hallucinated fields, invalid deviation claims, or destructive actions
39
+
40
+ Each task also produces a deterministic grader score in `(0.0, 1.0)`.
41
+
42
+ ## Project Structure
43
+
44
+ ```text
45
+ clinical_trial_env/
46
+ β”œβ”€β”€ .env
47
+ β”œβ”€β”€ Dockerfile
48
+ β”œβ”€β”€ README.md
49
+ β”œβ”€β”€ __init__.py
50
+ β”œβ”€β”€ client.py
51
+ β”œβ”€β”€ env.py
52
+ β”œβ”€β”€ inference.py
53
+ β”œβ”€β”€ models.py
54
+ β”œβ”€β”€ openenv.yaml
55
+ β”œβ”€β”€ pyproject.toml
56
+ └── server/
57
+ β”œβ”€β”€ __init__.py
58
+ β”œβ”€β”€ app.py
59
+ └── clinical_trial_env_environment.py
60
+ ```
61
+
62
+ ## Build And Run
63
+
64
+ Build the container from the project root:
65
+
66
+ ```bash
67
+ docker build -t clinical-trial-env:latest .
68
+ ```
69
+
70
+ Run the server locally:
71
+
72
+ ```bash
73
+ docker run --rm -p 8000:8000 clinical-trial-env:latest
74
+ ```
75
+
76
+ Validate the environment:
77
+
78
+ ```bash
79
+ openenv validate .
80
+ ```
81
+
82
+ ## Inference
83
+
84
+ The root [inference.py](/Users/abhishekkanade/Desktop/Hackathon/OpenEnv/clinical_trial_env/inference.py) uses the OpenAI client and emits exactly:
85
+
86
+ - `[START]`
87
+ - `[STEP]`
88
+ - `[END]`
89
+
90
+ Required environment variables:
91
+
92
+ - `HF_TOKEN`
93
+ - `LOCAL_IMAGE_NAME` or `ENV_BASE_URL`
94
+ - `API_BASE_URL` optional, defaults to Hugging Face router
95
+ - `MODEL_NAME` optional
96
+ - `CLINICAL_TRIAL_TASK` with values `easy`, `medium`, or `hard`
97
+
98
+ Example:
99
+
100
+ ```bash
101
+ set -a
102
+ source .env
103
+ set +a
104
+ python3 inference.py
105
+ ```
106
+
107
+ ## Python Usage
108
+
109
+ ```python
110
+ import asyncio
111
+
112
+ from clinical_trial_env import ClinicalTrialAction, ClinicalTrialEnv
113
+
114
+
115
+ async def main() -> None:
116
+ env = await ClinicalTrialEnv.from_docker_image("clinical-trial-env:latest")
117
+ try:
118
+ result = await env.reset(task_id="easy")
119
+ result = await env.step(
120
+ ClinicalTrialAction(action_type="extract_data", field_name="age", value="56")
121
+ )
122
+ print(result.reward, result.observation.reward_details.grader_score)
123
+ finally:
124
+ await env.close()
125
+
126
+
127
+ asyncio.run(main())
128
+ ```
129
+
130
+ ## Audit Notes
131
+
132
+ - `reset()`, `step(action)`, and OpenEnv `state` access are implemented in [env.py](/Users/abhishekkanade/Desktop/Hackathon/OpenEnv/clinical_trial_env/env.py).
133
+ - Gold answers are not exposed through observation metadata.
134
+ - Graders are deterministic and bounded in `(0.0, 1.0)`.
135
+ - The hard task uses unstructured medical text and clinically realistic exclusion criteria.