scheduler / agent /state.py
umangchaudhry's picture
Upload 31 files
0d04b76 verified
Raw
History Blame Contribute Delete
1.64 kB
"""
LangGraph State Schema — defines the typed state that flows through the scheduling graph.
"""
from typing import TypedDict, Optional
class SchedulingState(TypedDict):
"""State object that passes through all nodes in the scheduling graph.
Fields populated by the dashboard (input):
- patient_id, visit_level, visit_address, preferred_dates, preferred_time_window
Fields populated by agent nodes (intermediate):
- available_providers, travel_times, ranked_matches
Fields requiring human-in-the-loop (interaction):
- user_selection
Fields populated at completion (output):
- booked_appointment, notifications_sent, error
"""
# --- Inputs from dashboard ---
patient_id: str
patient_name: str
patient_email: str
visit_level: int | str
visit_address: str
visit_lat: float
visit_lng: float
preferred_dates: list[str] # ["2026-03-20", "2026-03-21"]
preferred_time_window: dict # {"start": "09:00", "end": "12:00"}
# --- Intermediate results ---
available_providers: list[dict] # Providers passing availability check
travel_times: list[dict] # Provider dicts enriched with travel_time_minutes
ranked_matches: list[dict] # Final ranked list presented to user
# --- Human-in-the-loop ---
user_selection: Optional[dict] # The provider+time combo the user picked
# --- Outputs ---
booked_appointment: Optional[dict] # The created appointment record
notifications_sent: bool
error: Optional[str] # Error message if something went wrong