Skip to content

Commit de19398

Browse files
AlexMikhalevclaude
andcommitted
feat: add 8 multi-specialty evaluation scenarios with 4 new patient profiles
Expand evaluation suite from 10 to 18 cases covering cardiology, neurology, psychiatry, pediatrics, nephrology, endocrinology, pulmonology, and general practice. Add 4 new patient profiles (epilepsy/HLA-A*31:01, pediatric ALL/TPMT, CKD/diabetes, elderly polypharmacy/CYP2D6 PM). All 18/18 cases pass mock evaluation with 94.4% KG grounding, 100% safety, 88.9% hygiene. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8083c09 commit de19398

File tree

7 files changed

+1629
-5
lines changed

7 files changed

+1629
-5
lines changed

crates/terraphim-demo/src/patients.rs

Lines changed: 297 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,267 @@ pub fn get_afib_patient() -> PatientProfile {
173173
}
174174
}
175175

176+
/// Epilepsy patient with HLA-A*31:01 -- carbamazepine SJS risk
177+
pub fn get_epilepsy_patient() -> PatientProfile {
178+
PatientProfile {
179+
id: "DEMO-EPILEPSY-001".to_string(),
180+
age: 34,
181+
sex: "Female".to_string(),
182+
weight_kg: 62.0,
183+
height_cm: 165,
184+
medical_history: vec![
185+
"Focal epilepsy (diagnosed age 22)".to_string(),
186+
"Migraine with aura".to_string(),
187+
],
188+
diagnoses: vec![
189+
"Drug-resistant focal epilepsy".to_string(),
190+
"HLA-A*31:01 positive".to_string(),
191+
],
192+
genomic_variants: vec![GenomicVariant {
193+
gene: "HLA-A".to_string(),
194+
variant: "*31:01".to_string(),
195+
significance: "Increased risk of carbamazepine-induced SJS/TEN and DRESS".to_string(),
196+
allele_frequency: None,
197+
}],
198+
pgx_profile: PGxProfile {
199+
cyp2d6: Some("*1/*1".to_string()),
200+
cyp2c19: Some("*1/*1".to_string()),
201+
cyp2c9: Some("*1/*1".to_string()),
202+
cyp3a4: Some("*1/*1".to_string()),
203+
cyp3a5: None,
204+
dpyvd: None,
205+
tpmt: None,
206+
},
207+
current_medications: vec![Medication {
208+
name: "Carbamazepine".to_string(),
209+
dose: "400mg".to_string(),
210+
frequency: "Twice daily".to_string(),
211+
start_date: Some("2024-06-01".to_string()),
212+
}],
213+
allergies: vec!["Penicillin (hives)".to_string()],
214+
ecog_performance_status: 0,
215+
prior_treatments: vec![PriorTreatment {
216+
treatment: "Levetiracetam 1500mg BID".to_string(),
217+
indication: "Focal epilepsy".to_string(),
218+
response: TreatmentResponse::PartialResponse,
219+
start_date: Some("2022-01-15".to_string()),
220+
end_date: Some("2024-05-01".to_string()),
221+
reason_for_stop: Some(
222+
"Inadequate seizure control, behavioral side effects".to_string(),
223+
),
224+
}],
225+
clinical_note: "34-year-old female with drug-resistant focal epilepsy, recently started \
226+
on carbamazepine 400mg BID. HLA-A*31:01 genotyping returned positive. \
227+
Assess risk of Stevens-Johnson syndrome and recommend alternative anticonvulsant."
228+
.to_string(),
229+
}
230+
}
231+
232+
/// Pediatric ALL patient with TPMT *1/*3A -- mercaptopurine dose adjustment
233+
pub fn get_pediatric_all_patient() -> PatientProfile {
234+
PatientProfile {
235+
id: "DEMO-PEDS-ALL-001".to_string(),
236+
age: 7,
237+
sex: "Male".to_string(),
238+
weight_kg: 23.0,
239+
height_cm: 122,
240+
medical_history: vec![
241+
"Acute lymphoblastic leukemia (B-cell precursor, standard risk)".to_string(),
242+
],
243+
diagnoses: vec![
244+
"B-cell precursor ALL, standard risk".to_string(),
245+
"TPMT *1/*3A (intermediate metabolizer)".to_string(),
246+
],
247+
genomic_variants: vec![GenomicVariant {
248+
gene: "TPMT".to_string(),
249+
variant: "*1/*3A".to_string(),
250+
significance: "Intermediate metabolizer -- reduced thiopurine metabolism".to_string(),
251+
allele_frequency: None,
252+
}],
253+
pgx_profile: PGxProfile {
254+
cyp2d6: None,
255+
cyp2c19: None,
256+
cyp2c9: None,
257+
cyp3a4: None,
258+
cyp3a5: None,
259+
dpyvd: None,
260+
tpmt: Some("*1/*3A".to_string()),
261+
},
262+
current_medications: vec![
263+
Medication {
264+
name: "Mercaptopurine".to_string(),
265+
dose: "50mg/m2".to_string(),
266+
frequency: "Once daily (maintenance phase)".to_string(),
267+
start_date: Some("2025-09-01".to_string()),
268+
},
269+
Medication {
270+
name: "Methotrexate".to_string(),
271+
dose: "20mg/m2".to_string(),
272+
frequency: "Weekly (maintenance phase)".to_string(),
273+
start_date: Some("2025-09-01".to_string()),
274+
},
275+
],
276+
allergies: vec![],
277+
ecog_performance_status: 0,
278+
prior_treatments: vec![PriorTreatment {
279+
treatment: "Induction chemotherapy (COG AALL0434)".to_string(),
280+
indication: "B-cell precursor ALL".to_string(),
281+
response: TreatmentResponse::CompleteResponse,
282+
start_date: Some("2025-03-01".to_string()),
283+
end_date: Some("2025-08-31".to_string()),
284+
reason_for_stop: Some("Completed induction, moved to maintenance".to_string()),
285+
}],
286+
clinical_note: "7-year-old male with standard-risk B-cell precursor ALL in maintenance \
287+
phase. TPMT genotyping shows *1/*3A (intermediate metabolizer). Currently on \
288+
standard-dose mercaptopurine 50mg/m2 daily. Assess need for dose reduction \
289+
to prevent myelosuppression."
290+
.to_string(),
291+
}
292+
}
293+
294+
/// CKD patient with diabetes -- renal dosing considerations
295+
pub fn get_ckd_patient() -> PatientProfile {
296+
PatientProfile {
297+
id: "DEMO-CKD-001".to_string(),
298+
age: 68,
299+
sex: "Male".to_string(),
300+
weight_kg: 88.0,
301+
height_cm: 178,
302+
medical_history: vec![
303+
"Type 2 diabetes mellitus (15 years)".to_string(),
304+
"Hypertension (20 years)".to_string(),
305+
"Chronic kidney disease stage 3b".to_string(),
306+
"Gout".to_string(),
307+
],
308+
diagnoses: vec![
309+
"CKD stage 3b (eGFR 38 mL/min/1.73m2)".to_string(),
310+
"Type 2 diabetes mellitus".to_string(),
311+
"Essential hypertension".to_string(),
312+
],
313+
genomic_variants: vec![GenomicVariant {
314+
gene: "CYP2C9".to_string(),
315+
variant: "*1/*3".to_string(),
316+
significance: "Reduced CYP2C9 function -- affects NSAID and sulfonylurea metabolism"
317+
.to_string(),
318+
allele_frequency: None,
319+
}],
320+
pgx_profile: PGxProfile {
321+
cyp2d6: Some("*1/*1".to_string()),
322+
cyp2c19: Some("*1/*1".to_string()),
323+
cyp2c9: Some("*1/*3".to_string()),
324+
cyp3a4: Some("*1/*1".to_string()),
325+
cyp3a5: None,
326+
dpyvd: None,
327+
tpmt: None,
328+
},
329+
current_medications: vec![
330+
Medication {
331+
name: "Metformin".to_string(),
332+
dose: "1000mg".to_string(),
333+
frequency: "Twice daily".to_string(),
334+
start_date: Some("2018-03-01".to_string()),
335+
},
336+
Medication {
337+
name: "Lisinopril".to_string(),
338+
dose: "20mg".to_string(),
339+
frequency: "Once daily".to_string(),
340+
start_date: Some("2015-01-10".to_string()),
341+
},
342+
Medication {
343+
name: "Glipizide".to_string(),
344+
dose: "10mg".to_string(),
345+
frequency: "Twice daily".to_string(),
346+
start_date: Some("2021-06-01".to_string()),
347+
},
348+
],
349+
allergies: vec!["Iodine contrast (anaphylaxis)".to_string()],
350+
ecog_performance_status: 1,
351+
prior_treatments: vec![],
352+
clinical_note: "68-year-old male with CKD stage 3b (eGFR 38), long-standing type 2 \
353+
diabetes and hypertension. Currently on metformin 1000mg BID, glipizide 10mg BID, \
354+
lisinopril 20mg daily. CYP2C9 *1/*3 genotype. Review medication safety given \
355+
declining renal function, assess need for NSAID avoidance and metformin adjustment."
356+
.to_string(),
357+
}
358+
}
359+
360+
/// Elderly polypharmacy patient -- CYP2D6 PM, depression + COPD + osteoporosis
361+
pub fn get_elderly_polypharmacy_patient() -> PatientProfile {
362+
PatientProfile {
363+
id: "DEMO-POLYPHARM-001".to_string(),
364+
age: 78,
365+
sex: "Female".to_string(),
366+
weight_kg: 55.0,
367+
height_cm: 158,
368+
medical_history: vec![
369+
"Major depressive disorder (recurrent)".to_string(),
370+
"COPD (GOLD stage II)".to_string(),
371+
"Osteoporosis (vertebral fracture 2024)".to_string(),
372+
"Hypertension".to_string(),
373+
"Fall with hip contusion (2025)".to_string(),
374+
],
375+
diagnoses: vec![
376+
"Major depressive disorder, recurrent".to_string(),
377+
"COPD GOLD stage II".to_string(),
378+
"Osteoporosis with pathological fracture".to_string(),
379+
"CYP2D6 poor metabolizer (*4/*4)".to_string(),
380+
],
381+
genomic_variants: vec![GenomicVariant {
382+
gene: "CYP2D6".to_string(),
383+
variant: "*4/*4".to_string(),
384+
significance: "Poor metabolizer -- reduced metabolism of many psychotropics"
385+
.to_string(),
386+
allele_frequency: None,
387+
}],
388+
pgx_profile: PGxProfile {
389+
cyp2d6: Some("*4/*4".to_string()),
390+
cyp2c19: Some("*1/*1".to_string()),
391+
cyp2c9: Some("*1/*1".to_string()),
392+
cyp3a4: Some("*1/*1".to_string()),
393+
cyp3a5: None,
394+
dpyvd: None,
395+
tpmt: None,
396+
},
397+
current_medications: vec![
398+
Medication {
399+
name: "Amlodipine".to_string(),
400+
dose: "5mg".to_string(),
401+
frequency: "Once daily".to_string(),
402+
start_date: Some("2020-01-15".to_string()),
403+
},
404+
Medication {
405+
name: "Alendronate".to_string(),
406+
dose: "70mg".to_string(),
407+
frequency: "Once weekly".to_string(),
408+
start_date: Some("2024-08-01".to_string()),
409+
},
410+
Medication {
411+
name: "Tiotropium".to_string(),
412+
dose: "18mcg".to_string(),
413+
frequency: "Once daily (inhaler)".to_string(),
414+
start_date: Some("2023-04-01".to_string()),
415+
},
416+
],
417+
allergies: vec!["Codeine (nausea/vomiting)".to_string()],
418+
ecog_performance_status: 2,
419+
prior_treatments: vec![PriorTreatment {
420+
treatment: "Paroxetine 20mg daily".to_string(),
421+
indication: "Major depressive disorder".to_string(),
422+
response: TreatmentResponse::PartialResponse,
423+
start_date: Some("2023-01-01".to_string()),
424+
end_date: Some("2025-06-01".to_string()),
425+
reason_for_stop: Some(
426+
"Excessive sedation, falls, anticholinergic side effects".to_string(),
427+
),
428+
}],
429+
clinical_note: "78-year-old female with recurrent MDD, COPD, osteoporosis. CYP2D6 *4/*4 \
430+
poor metabolizer. Prior paroxetine discontinued due to falls and anticholinergic \
431+
burden. Needs antidepressant selection considering CYP2D6 PM status, fall risk, \
432+
COPD, and polypharmacy. Apply Beers criteria and deprescribing principles."
433+
.to_string(),
434+
}
435+
}
436+
176437
#[cfg(test)]
177438
mod tests {
178439
use super::*;
@@ -194,4 +455,40 @@ mod tests {
194455
assert_eq!(patient.age, 72);
195456
assert!(patient.pgx_profile.cyp2c9.is_some());
196457
}
458+
459+
#[test]
460+
fn test_epilepsy_patient_creation() {
461+
let patient = get_epilepsy_patient();
462+
assert_eq!(patient.id, "DEMO-EPILEPSY-001");
463+
assert_eq!(patient.age, 34);
464+
assert_eq!(patient.sex, "Female");
465+
assert!(patient
466+
.genomic_variants
467+
.iter()
468+
.any(|v| v.gene == "HLA-A" && v.variant == "*31:01"));
469+
}
470+
471+
#[test]
472+
fn test_pediatric_all_patient_creation() {
473+
let patient = get_pediatric_all_patient();
474+
assert_eq!(patient.id, "DEMO-PEDS-ALL-001");
475+
assert_eq!(patient.age, 7);
476+
assert!(patient.pgx_profile.tpmt.is_some());
477+
}
478+
479+
#[test]
480+
fn test_ckd_patient_creation() {
481+
let patient = get_ckd_patient();
482+
assert_eq!(patient.id, "DEMO-CKD-001");
483+
assert_eq!(patient.age, 68);
484+
assert_eq!(patient.pgx_profile.cyp2c9.as_deref(), Some("*1/*3"));
485+
}
486+
487+
#[test]
488+
fn test_elderly_polypharmacy_patient_creation() {
489+
let patient = get_elderly_polypharmacy_patient();
490+
assert_eq!(patient.id, "DEMO-POLYPHARM-001");
491+
assert_eq!(patient.age, 78);
492+
assert_eq!(patient.pgx_profile.cyp2d6.as_deref(), Some("*4/*4"));
493+
}
197494
}

0 commit comments

Comments
 (0)