Spaces:
Sleeping
Sleeping
KevinIsInCoding Claude Sonnet 4.6 commited on
Commit ·
d2a29fe
1
Parent(s): bfda151
Add diagnosis_months to patient intake alongside onset_months
Browse filesDoctors noted that formal diagnosis date and symptom onset date often
differ and both are clinically relevant for trial eligibility. The intake
agent now asks for and collects both fields, and the patient profile
summary surfaces both to the research agent.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- app.py +1 -0
- clinical_trials_guru.py +9 -1
app.py
CHANGED
|
@@ -54,6 +54,7 @@ def _intake_turn(
|
|
| 54 |
disease=data["disease"],
|
| 55 |
age=data["age"],
|
| 56 |
onset_months=data["onset_months"],
|
|
|
|
| 57 |
benchmarks=data.get("benchmarks") or {},
|
| 58 |
zip_code=data["zip_code"],
|
| 59 |
country_code=data.get("country_code", "US"),
|
|
|
|
| 54 |
disease=data["disease"],
|
| 55 |
age=data["age"],
|
| 56 |
onset_months=data["onset_months"],
|
| 57 |
+
diagnosis_months=data.get("diagnosis_months", 0),
|
| 58 |
benchmarks=data.get("benchmarks") or {},
|
| 59 |
zip_code=data["zip_code"],
|
| 60 |
country_code=data.get("country_code", "US"),
|
clinical_trials_guru.py
CHANGED
|
@@ -41,6 +41,10 @@ SUBMIT_PROFILE_TOOL: anthropic.types.ToolParam = {
|
|
| 41 |
"type": "integer",
|
| 42 |
"description": "Months since first symptom onset",
|
| 43 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
"benchmarks": {
|
| 45 |
"type": "object",
|
| 46 |
"description": "Disease-specific scores, e.g. {\"ALSFRS-R\": \"38\"}",
|
|
@@ -61,7 +65,7 @@ SUBMIT_PROFILE_TOOL: anthropic.types.ToolParam = {
|
|
| 61 |
"description": "Desired trial phases. Empty = all phases.",
|
| 62 |
},
|
| 63 |
},
|
| 64 |
-
"required": ["disease", "age", "onset_months", "zip_code"],
|
| 65 |
},
|
| 66 |
}
|
| 67 |
|
|
@@ -104,6 +108,7 @@ REQUIRED:
|
|
| 104 |
• Disease/condition (standardize: "Lou Gehrig's" → "Amyotrophic Lateral Sclerosis")
|
| 105 |
• Patient age
|
| 106 |
• Months since first symptom onset (convert dates/years as needed)
|
|
|
|
| 107 |
• ZIP/postal code and country for geographic search
|
| 108 |
|
| 109 |
OPTIONAL (ask based on disease):
|
|
@@ -152,6 +157,7 @@ class PatientProfile:
|
|
| 152 |
disease: str
|
| 153 |
age: int
|
| 154 |
onset_months: int
|
|
|
|
| 155 |
benchmarks: dict[str, str] = field(default_factory=dict)
|
| 156 |
zip_code: str = ""
|
| 157 |
country_code: str = "US"
|
|
@@ -165,6 +171,7 @@ class PatientProfile:
|
|
| 165 |
f"Disease: {self.disease}",
|
| 166 |
f"Age: {self.age}",
|
| 167 |
f"Symptom onset: {self.onset_months} months ago",
|
|
|
|
| 168 |
]
|
| 169 |
if self.benchmarks:
|
| 170 |
lines.append("Benchmarks: " + ", ".join(f"{k}={v}" for k, v in self.benchmarks.items()))
|
|
@@ -326,6 +333,7 @@ def run_intake_agent(client: anthropic.Anthropic) -> PatientProfile:
|
|
| 326 |
disease=data["disease"],
|
| 327 |
age=data["age"],
|
| 328 |
onset_months=data["onset_months"],
|
|
|
|
| 329 |
benchmarks=data.get("benchmarks") or {},
|
| 330 |
zip_code=data["zip_code"],
|
| 331 |
country_code=data.get("country_code", "US"),
|
|
|
|
| 41 |
"type": "integer",
|
| 42 |
"description": "Months since first symptom onset",
|
| 43 |
},
|
| 44 |
+
"diagnosis_months": {
|
| 45 |
+
"type": "integer",
|
| 46 |
+
"description": "Months since formal/official diagnosis",
|
| 47 |
+
},
|
| 48 |
"benchmarks": {
|
| 49 |
"type": "object",
|
| 50 |
"description": "Disease-specific scores, e.g. {\"ALSFRS-R\": \"38\"}",
|
|
|
|
| 65 |
"description": "Desired trial phases. Empty = all phases.",
|
| 66 |
},
|
| 67 |
},
|
| 68 |
+
"required": ["disease", "age", "onset_months", "diagnosis_months", "zip_code"],
|
| 69 |
},
|
| 70 |
}
|
| 71 |
|
|
|
|
| 108 |
• Disease/condition (standardize: "Lou Gehrig's" → "Amyotrophic Lateral Sclerosis")
|
| 109 |
• Patient age
|
| 110 |
• Months since first symptom onset (convert dates/years as needed)
|
| 111 |
+
• Months since formal/official diagnosis (convert dates/years as needed; may differ from onset)
|
| 112 |
• ZIP/postal code and country for geographic search
|
| 113 |
|
| 114 |
OPTIONAL (ask based on disease):
|
|
|
|
| 157 |
disease: str
|
| 158 |
age: int
|
| 159 |
onset_months: int
|
| 160 |
+
diagnosis_months: int = 0
|
| 161 |
benchmarks: dict[str, str] = field(default_factory=dict)
|
| 162 |
zip_code: str = ""
|
| 163 |
country_code: str = "US"
|
|
|
|
| 171 |
f"Disease: {self.disease}",
|
| 172 |
f"Age: {self.age}",
|
| 173 |
f"Symptom onset: {self.onset_months} months ago",
|
| 174 |
+
f"Formal diagnosis: {self.diagnosis_months} months ago",
|
| 175 |
]
|
| 176 |
if self.benchmarks:
|
| 177 |
lines.append("Benchmarks: " + ", ".join(f"{k}={v}" for k, v in self.benchmarks.items()))
|
|
|
|
| 333 |
disease=data["disease"],
|
| 334 |
age=data["age"],
|
| 335 |
onset_months=data["onset_months"],
|
| 336 |
+
diagnosis_months=data.get("diagnosis_months", 0),
|
| 337 |
benchmarks=data.get("benchmarks") or {},
|
| 338 |
zip_code=data["zip_code"],
|
| 339 |
country_code=data.get("country_code", "US"),
|