| |
|
| | from typing import Dict, List, Literal, NotRequired, Optional, TypedDict |
| |
|
| |
|
| | class LabResult(TypedDict, total=False): |
| | """A single lab value with optional reference range and flag.""" |
| | name: str |
| | value: str |
| | unit: NotRequired[Optional[str]] |
| | reference_range: NotRequired[Optional[str]] |
| | flag: NotRequired[Optional[Literal["low", "normal", "high", "critical"]]] |
| |
|
| |
|
| | class MICDatum(TypedDict, total=False): |
| | """A single MIC measurement for one organism–antibiotic pair.""" |
| | organism: str |
| | antibiotic: str |
| | mic_value: str |
| | mic_unit: NotRequired[Optional[str]] |
| | interpretation: NotRequired[Optional[Literal["S", "I", "R"]]] |
| | breakpoint_source: NotRequired[Optional[str]] |
| | year: NotRequired[Optional[int]] |
| | site: NotRequired[Optional[str]] |
| |
|
| |
|
| | class Recommendation(TypedDict, total=False): |
| | """Final clinical recommendation assembled by Agent 4.""" |
| | primary_antibiotic: Optional[str] |
| | backup_antibiotic: NotRequired[Optional[str]] |
| | dose: Optional[str] |
| | route: Optional[str] |
| | frequency: Optional[str] |
| | duration: Optional[str] |
| | rationale: Optional[str] |
| | references: NotRequired[List[str]] |
| | safety_alerts: NotRequired[List[str]] |
| |
|
| |
|
| | class InfectionState(TypedDict, total=False): |
| | """ |
| | Shared state object passed between all agents in the pipeline. |
| | |
| | All keys are optional so each agent only needs to populate its own outputs. |
| | """ |
| |
|
| | |
| | patient_id: NotRequired[Optional[str]] |
| | age_years: NotRequired[Optional[float]] |
| | sex: NotRequired[Optional[Literal["male", "female", "other", "unknown"]]] |
| | weight_kg: NotRequired[Optional[float]] |
| | height_cm: NotRequired[Optional[float]] |
| |
|
| | |
| | suspected_source: NotRequired[Optional[str]] |
| | comorbidities: NotRequired[List[str]] |
| | medications: NotRequired[List[str]] |
| | allergies: NotRequired[List[str]] |
| | infection_site: NotRequired[Optional[str]] |
| | country_or_region: NotRequired[Optional[str]] |
| |
|
| | |
| | serum_creatinine_mg_dl: NotRequired[Optional[float]] |
| | creatinine_clearance_ml_min: NotRequired[Optional[float]] |
| | vitals: NotRequired[Dict[str, str]] |
| |
|
| | |
| | labs_raw_text: NotRequired[Optional[str]] |
| | labs_image_bytes: NotRequired[Optional[bytes]] |
| | labs_parsed: NotRequired[List[LabResult]] |
| | mic_data: NotRequired[List[MICDatum]] |
| | mic_trend_summary: NotRequired[Optional[str]] |
| |
|
| | |
| | stage: NotRequired[Literal["empirical", "targeted"]] |
| | route_to_vision: NotRequired[bool] |
| | route_to_trend_analyst: NotRequired[bool] |
| |
|
| | |
| | intake_notes: NotRequired[Optional[str]] |
| | vision_notes: NotRequired[Optional[str]] |
| | trend_notes: NotRequired[Optional[str]] |
| | pharmacology_notes: NotRequired[Optional[str]] |
| | recommendation: NotRequired[Optional[Recommendation]] |
| |
|
| | |
| | rag_context: NotRequired[Optional[str]] |
| | guideline_sources: NotRequired[List[str]] |
| | breakpoint_sources: NotRequired[List[str]] |
| | safety_warnings: NotRequired[List[str]] |
| |
|
| | |
| | errors: NotRequired[List[str]] |
| | debug_log: NotRequired[List[str]] |
| |
|
| |
|