{"openapi":"3.1.0","info":{"title":"Clinical AI Command Center API","description":"\n## Clinical AI Command Center API & Agent Hub\n\nThis API serves as the clinician-facing product backend and orchestration layer for Clinical AI Kit, bridging the React/Vite frontend with Google ADK agent execution environments.\n\n### Core Architecture\n\n- **Agent Engine**: Managed via Google ADK (`google-adk`). Wires one root orchestrator with 21 specialist LLM agents (22 total).\n- **Multimodal Ingest**: Supports quality inspection, OCR, vision analysis, and clinical structuring.\n- **Persistent Audit Log**: SQLite-backed event records with immutable audit identifiers.\n- **Multi-Tenant Scoping**: Isolated deterministic showcase tenants in the public build; private deployments can configure live execution separately.\n\n### Versioned Operations\n\n1. **V1 API (`/api/v1`)**: Exposes core clinical entities (Patients, Sessions, Assets, Runs, Admin settings, Audit trail).\n2. **V2 API (`/api/v2`)**: Advanced services integration, exposing MCP server tool catalogs (`/api/v2/mcp/tools`), remote agent cards (`/api/v2/a2a/card`), and system diagnostics.\n\n### Documentation Surfaces\n\n- **Swagger UI (`/docs`)**: styled interactive API console for `/api/v1` and `/api/v2`.\n- **ReDoc (`/redoc`)**: readable OpenAPI reference for the same schema.\n- **OpenAPI JSON (`/openapi.json`)**: raw contract consumed by the in-app Developer Console.\n- **Frontend Diagram Atlas**: architecture SVG/PNG assets are served by the frontend bundle and documented in the Project Wiki; they are intentionally not modeled as API operations.\n\n### 3-Layer Security Callbacks\n- **Input Guardrails**: unicode normalization, prompt injection prevention.\n- **Tool Authorization**: parameter verification, rate limits, secret token sanitization.\n- **Output Redaction**: PII detection, security leaks blocking.\n","version":"0.3.0"},"paths":{"/health":{"get":{"tags":["Health"],"summary":"Healthz","description":"Report liveness.\n\n``/healthz`` remains a local compatibility alias, but Cloud Run\nreserves some paths ending in ``z`` at its edge. Deployments and\nexternal monitors must use ``/health``.","operationId":"healthz_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Healthz Health Get"}}}}}}},"/ready":{"get":{"tags":["Health"],"summary":"Ready","description":"Report readiness from real component checks.\n\nReturns 503 when the default-tenant database is unreachable so\norchestrators (Cloud Run, Kubernetes) hold traffic until storage is\nwritable; the frontend-bundle check is advisory and never fails\nreadiness so API-only deployments stay ready. ``/readyz`` is retained\nonly as a local compatibility alias; external monitors use ``/ready``.","operationId":"ready_ready_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Ready Ready Get"}}}}}}},"/api/v1/health":{"get":{"tags":["Health"],"summary":"Health V1","description":"Report liveness for V1 API.","operationId":"health_v1_api_v1_health_get","responses":{"200":{"description":"Report liveness for V1 API","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Health V1 Api V1 Health Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents":{"get":{"tags":["Agents"],"summary":"Agents","description":"Expose the real ADK pipeline catalog and tenant execution mode.","operationId":"agents_api_v1_agents_get","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Expose the real ADK pipeline catalog and tenant execution mode","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentCatalogResponse"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/notifications":{"get":{"tags":["Notifications"],"summary":"Notifications","description":"Return actionable notifications — seeded for demo, derived for real tenants.","operationId":"notifications_api_v1_notifications_get","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"List of unresolved notifications from agents","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/NotificationResponse"},"title":"Response Notifications Api V1 Notifications Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/system/health":{"get":{"tags":["Health"],"summary":"System Health","description":"Measure real component health: database, agent runtime, MCP, storage, model, bundle.","operationId":"system_health_api_v1_system_health_get","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Measured component health for the caller's tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SystemHealthResponse"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/monitoring":{"get":{"tags":["Agents"],"summary":"Agents Monitoring","description":"Return per-agent statistics — baseline+session for demo, run-derived for real tenants.\n\nReadable by every role: clinicians get the same read-only monitoring\nview admins see, and no mutation happens through this endpoint.","operationId":"agents_monitoring_api_v1_agents_monitoring_get","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Per-agent runtime statistics","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AgentMonitorRow"},"title":"Response Agents Monitoring Api V1 Agents Monitoring Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/permissions":{"get":{"tags":["Admin"],"summary":"Permissions","description":"Return the tenant's permission matrix.","operationId":"permissions_api_v1_permissions_get","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Role-permission matrix","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionsResponse"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"tags":["Admin"],"summary":"Save Permissions","description":"Persist an admin's permission matrix edit — durable for real tenants.","operationId":"save_permissions_api_v1_permissions_put","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionsUpdateRequest"}}}},"responses":{"200":{"description":"Persisted the edited permission matrix","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionsResponse"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/database/schema":{"get":{"tags":["Database"],"summary":"Database Schema","description":"Expose the real clinical schema the SQL pipeline queries against.","operationId":"database_schema_api_v1_database_schema_get","responses":{"200":{"description":"Clinical database tables parsed from the governed DDL","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/SchemaTable"},"type":"array","title":"Response Database Schema Api V1 Database Schema Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/summary":{"get":{"tags":["Dashboard"],"summary":"Summary","description":"Return live counts for navigation badges and the role landing page.","operationId":"summary_api_v1_summary_get","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Live workspace counts for navigation badges","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceSummaryResponse"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/patients/{patient_id}/evidence":{"get":{"tags":["Patients"],"summary":"Patient Evidence","description":"Return the patient's evidence sources with viewable asset links.","operationId":"patient_evidence_api_v1_patients__patient_id__evidence_get","parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Evidence sources for one patient","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EvidenceItemResponse"},"title":"Response Patient Evidence Api V1 Patients  Patient Id  Evidence Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/notifications/{notification_id}/read":{"post":{"tags":["Notifications"],"summary":"Read Notification","description":"Mark one notification read in the isolated demo session.","operationId":"read_notification_api_v1_notifications__notification_id__read_post","parameters":[{"name":"notification_id","in":"path","required":true,"schema":{"type":"string","title":"Notification Id"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Marked one notification as read","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationResponse"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/demo/session":{"post":{"tags":["Demo"],"summary":"Start Demo","description":"Create isolated demo state identifier.","operationId":"start_demo_api_v1_demo_session_post","responses":{"201":{"description":"Created an isolated deterministic demo session","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Start Demo Api V1 Demo Session Post"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/demo/reset":{"post":{"tags":["Demo"],"summary":"Reset","description":"Reset only caller demo session.","operationId":"reset_api_v1_demo_reset_post","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"204":{"description":"Reset the caller's deterministic demo session"},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/dashboard":{"get":{"tags":["Dashboard"],"summary":"Dashboard","description":"Return role-aware dashboard data.","operationId":"dashboard_api_v1_dashboard_get","parameters":[{"name":"role","in":"query","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"Role"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Retrieved global metrics and recent activity dashboard details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardResponse"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/patients":{"get":{"tags":["Patients"],"summary":"Patients","description":"Search patients by identifier, name, diagnosis, or risk.","operationId":"patients_api_v1_patients_get","parameters":[{"name":"query","in":"query","required":false,"schema":{"type":"string","default":"","title":"Query"}},{"name":"q","in":"query","required":false,"schema":{"type":"string","default":"","title":"Q"}},{"name":"risk","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Risk"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"List of matched patient profiles according to criteria","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PatientResponse"},"title":"Response Patients Api V1 Patients Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/patients/{patient_id}":{"get":{"tags":["Patients"],"summary":"Patient","description":"Return patient profile.","operationId":"patient_api_v1_patients__patient_id__get","parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Retrieved detailed patient profile and current risk metadata by ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientResponse"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/sessions":{"get":{"tags":["Sessions"],"summary":"Sessions","description":"List clinical sessions, optionally for one patient.","operationId":"sessions_api_v1_sessions_get","parameters":[{"name":"patient_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Id"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"List of recent clinical extraction sessions","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SessionResponse"},"title":"Response Sessions Api V1 Sessions Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/sessions/{session_id}":{"get":{"tags":["Sessions"],"summary":"Session","description":"Return one clinical session.","operationId":"session_api_v1_sessions__session_id__get","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Retrieved detailed session status and confidence scores","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionResponse"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/assets":{"post":{"tags":["Assets"],"summary":"Create Asset","description":"Store uploaded bytes inside caller demo session or process through live agent ETL.\n\nLive tenants may leave patient_id blank: the endpoint reads an id the\ndocument itself declares (local text for PDFs, one Gemini Vision pass\nfor images) and registers it through upload_patient_or_register, so\nevidence carrying its own patient number processes without retyping.","operationId":"create_asset_api_v1_assets_post","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_asset_api_v1_assets_post"}}}},"responses":{"201":{"description":"Asset uploaded and recorded successfully","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Create Asset Api V1 Assets Post"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/knowledge-base/assets":{"post":{"tags":["Assets"],"summary":"Create Knowledge Base Asset","description":"Store a patient-scoped document as searchable Q&A knowledge-base evidence.","operationId":"create_knowledge_base_asset_api_v1_knowledge_base_assets_post","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_knowledge_base_asset_api_v1_knowledge_base_assets_post"}}}},"responses":{"201":{"description":"Uploaded and indexed a patient-scoped knowledge-base document","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Create Knowledge Base Asset Api V1 Knowledge Base Assets Post"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"get":{"tags":["Assets"],"summary":"Knowledge Base Assets","description":"List knowledge-base uploads powering the Q&A retrieval catalog.\n\npreviewUrl is rewritten against the caller's session so seeded demo\ndocuments stay viewable, and dropped entirely when no bytes or disk\nfile exist to serve — the UI then falls back to the parsed text.","operationId":"knowledge_base_assets_api_v1_knowledge_base_assets_get","parameters":[{"name":"patient_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Id"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"List indexed knowledge-base documents, optionally scoped to one patient","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response Knowledge Base Assets Api V1 Knowledge Base Assets Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/import":{"post":{"tags":["Admin"],"summary":"Import Data","description":"Import PDF/image documents or seed database intelligence cohort.","operationId":"import_data_api_v1_import_post","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_import_data_api_v1_import_post"}}}},"responses":{"201":{"description":"Ingested and went through the ETL of a PDF, image, or database intelligence cohort","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Import Data Api V1 Import Post"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/extraction/sources":{"get":{"tags":["Assets"],"summary":"Extraction Sources","description":"Return generated extraction PDF packets with patient-level previews.","operationId":"extraction_sources_api_v1_extraction_sources_get","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"List generated extraction packet sources for demo picking","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response Extraction Sources Api V1 Extraction Sources Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/assets/{asset_id}":{"get":{"tags":["Assets"],"summary":"Asset","description":"Return uploaded asset bytes for evidence preview.","operationId":"asset_api_v1_assets__asset_id__get","parameters":[{"name":"asset_id","in":"path","required":true,"schema":{"type":"string","title":"Asset Id"}},{"name":"session","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Serve uploaded evidence bytes for authorized preview","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/runs/extraction":{"post":{"tags":["Extraction"],"summary":"Extraction","description":"Create extraction run — live agent execution or deterministic demo.","operationId":"extraction_api_v1_runs_extraction_post","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunRequest"}}}},"responses":{"201":{"description":"Began deterministic extraction pipeline on target report assets","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Extraction Api V1 Runs Extraction Post"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/runs/{run_id}":{"get":{"tags":["Runs"],"summary":"Run","description":"Poll persisted agent run.","operationId":"run_api_v1_runs__run_id__get","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Retrieved status, confidence scores, and current stage details of an active pipeline run","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Run Api V1 Runs  Run Id  Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/runs/{run_id}/events":{"get":{"tags":["Runs"],"summary":"Run Events","description":"Poll run steps.","operationId":"run_events_api_v1_runs__run_id__events_get","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Retrieved list of completed run step execution events","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response Run Events Api V1 Runs  Run Id  Events Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/runs/{run_id}/events/stream":{"get":{"tags":["Runs"],"summary":"Event Stream","description":"Stream run steps as server-sent events.","operationId":"event_stream_api_v1_runs__run_id__events_stream_get","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Server-Sent Events (SSE) stream of run progress","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/runs/{run_id}/review":{"post":{"tags":["Runs"],"summary":"Review","description":"Approve and persist extraction, or reject without persistence.","operationId":"review_api_v1_runs__run_id__review_post","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewRequest"}}}},"responses":{"200":{"description":"Recorded review decision to approve or reject structured extraction data","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Review Api V1 Runs  Run Id  Review Post"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/reviews":{"get":{"tags":["Runs"],"summary":"Reviews","description":"List extraction runs awaiting clinician review.","operationId":"reviews_api_v1_reviews_get","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"List extraction runs awaiting clinician review","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response Reviews Api V1 Reviews Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/runs":{"get":{"tags":["Runs"],"summary":"List Runs","description":"List the session's agent runs in creation order.\n\nWorkflow screens call this on mount so a clinician who navigates away\nand returns sees the same conversation thread the backend already\nholds — runs are the durable record of every QA, extraction, and\ndatabase exchange in this session.","operationId":"list_runs_api_v1_runs_get","parameters":[{"name":"workflow","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workflow"}},{"name":"patient_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Id"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"List this session's agent runs for conversation-history restore","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response List Runs Api V1 Runs Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/orchestrate":{"post":{"tags":["Orchestration"],"summary":"Orchestrate","description":"Classify a request and return an audited workflow execution plan.","operationId":"orchestrate_api_v1_orchestrate_post","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrchestrateRequest"}}}},"responses":{"201":{"description":"Classify user query and structure orchestrator execution route","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrchestrationPlan"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/runs/qa":{"post":{"tags":["QA"],"summary":"Question","description":"Execute evidence-grounded Q&A — live agent or deterministic demo.","operationId":"question_api_v1_runs_qa_post","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuestionRequest"}}}},"responses":{"201":{"description":"Began patient-grounded QA retrieval pipeline execution","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Question Api V1 Runs Qa Post"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/runs/database/preview":{"post":{"tags":["Database"],"summary":"Database Preview","description":"Generate read-only SQL preview — live agent or deterministic demo.","operationId":"database_preview_api_v1_runs_database_preview_post","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseRequest"}}}},"responses":{"201":{"description":"Began database cohort preview pipeline to classify intent and compile SQL query","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Database Preview Api V1 Runs Database Preview Post"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/runs/database/{run_id}/execute":{"post":{"tags":["Database"],"summary":"Database Execute","description":"Execute reviewed database preview with a server-side safety gate.","operationId":"database_execute_api_v1_runs_database__run_id__execute_post","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Executed approved SQL query and saved result table and charts","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Database Execute Api V1 Runs Database  Run Id  Execute Post"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/database/history":{"get":{"tags":["Database"],"summary":"History","description":"Return completed database runs.","operationId":"history_api_v1_database_history_get","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Retrieved database cohort run history","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response History Api V1 Database History Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/database/examples":{"get":{"tags":["Database"],"summary":"Database Examples","description":"Return example questions derived from the tenant's real data.\n\nDemo tenants surface their curated query-card questions, which the\ndeterministic preview matcher is guaranteed to answer. Live tenants\nprobe the governed database for what is actually present — the top\ncondition, critical lab flags, missed appointments, medication load —\nso every suggestion is answerable with real rows instead of being a\ngeneric template that returns nothing.","operationId":"database_examples_api_v1_database_examples_get","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Example population questions grounded in the tenant's actual database contents","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"},"title":"Response Database Examples Api V1 Database Examples Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/database/queries/{run_id}/csv":{"get":{"tags":["Database"],"summary":"Export Csv","description":"Export database run rows as CSV.","operationId":"export_csv_api_v1_database_queries__run_id__csv_get","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Retrieved query results exported as a CSV stream","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/storage":{"get":{"tags":["Storage"],"summary":"Storage","description":"Return uploaded assets, approved storage receipts, and derived pipeline records.","operationId":"storage_api_v1_storage_get","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Retrieved storage system metrics and totals","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorageResponse"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/users":{"get":{"tags":["Admin"],"summary":"Users","description":"Return the tenant's user directory — seeded fixtures for demo, persisted rows for real.","operationId":"users_api_v1_users_get","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Retrieved corporate user directory","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserResponse"},"title":"Response Users Api V1 Users Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agent-config":{"get":{"tags":["Admin"],"summary":"Agent Config","description":"Return current session-scoped agent configuration.\n\nReadable by every role so clinicians can inspect the thresholds that\ngovern their reviews; only the PUT endpoint is admin-gated.","operationId":"agent_config_api_v1_agent_config_get","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Retrieved current agent validation thresholds and concurrent limits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentConfigResponse"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"tags":["Admin"],"summary":"Save Agent Config","description":"Validate and save session-scoped agent configuration.","operationId":"save_agent_config_api_v1_agent_config_put","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Config"}}}},"responses":{"200":{"description":"Updated and persisted new agent thresholds configuration","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentConfigResponse"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/report-schedules":{"get":{"tags":["Reports"],"summary":"Report Schedules","description":"List every workspace report with its recurring generation schedule.","operationId":"report_schedules_api_v1_report_schedules_get","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"List every report with its recurring generation schedule","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ReportScheduleResponse"},"title":"Response Report Schedules Api V1 Report Schedules Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/report-schedules/{report_id}":{"put":{"tags":["Reports"],"summary":"Save Report Schedule","description":"Set how often a report is generated (off, daily, weekly, or monthly).\n\nThe schedule is session-scoped like the rest of the demo state; every\nchange is audit-logged so governance sees who altered report cadence.","operationId":"save_report_schedule_api_v1_report_schedules__report_id__put","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","title":"Report Id"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportScheduleUpdateRequest"}}}},"responses":{"200":{"description":"Updated the report's recurring generation frequency","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportScheduleResponse"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/visuals/{document_id}":{"get":{"tags":["Storage"],"summary":"Visual","description":"Serve an agent-generated visual recorded in the documents table.\n\nOnly image documents whose stored path resolves inside the tenant's\nuploads directory are served, so a forged document row cannot read\narbitrary files.","operationId":"visual_api_v1_visuals__document_id__get","parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Serve patient structured visual image binary data","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/audit":{"get":{"tags":["Admin"],"summary":"Audit","description":"Return camelCase-compatible audit trail.","operationId":"audit_api_v1_audit_get","parameters":[{"name":"patient_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Id"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Immutable compliance activity and security log history","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AuditEventResponse"},"title":"Response Audit Api V1 Audit Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/audit/{audit_id}":{"get":{"tags":["Admin"],"summary":"Audit Event","description":"Return one audit event enriched with the run and patient it references.","operationId":"audit_event_api_v1_audit__audit_id__get","parameters":[{"name":"audit_id","in":"path","required":true,"schema":{"type":"string","title":"Audit Id"}},{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Retrieved one audit event with its linked run and patient context","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditEventDetailResponse"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v2/health":{"get":{"tags":["System V2"],"summary":"V2 Health","description":"Report extended V2 health, including DB connectivity.","operationId":"v2_health_api_v2_health_get","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"responses":{"200":{"description":"Retrieve health diagnostic metrics including database connection check","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2HealthResponse"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v2/mcp/tools":{"get":{"tags":["MCP V2"],"summary":"List Mcp Tools","description":"Reject MCP discovery: public deployment has no callable MCP service.","operationId":"list_mcp_tools_api_v2_mcp_tools_get","responses":{"200":{"description":"Expose all database tools available over MCP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpToolsListResponse"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v2/mcp/execute":{"post":{"tags":["MCP V2"],"summary":"Execute Mcp Tool","description":"Reject MCP execution before any tool or agent module is imported.","operationId":"execute_mcp_tool_api_v2_mcp_execute_post","parameters":[{"name":"X-Demo-Session","in":"header","required":false,"schema":{"type":"string","default":"public-demo","title":"X-Demo-Session"}},{"name":"X-Clinical-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Clinical-Role"}},{"name":"X-Role","in":"header","required":false,"schema":{"anyOf":[{"enum":["clinician","admin"],"type":"string"},{"type":"null"}],"title":"X-Role"}},{"name":"X-User","in":"header","required":false,"schema":{"type":"string","default":"demo-user","title":"X-User"}},{"name":"X-Tenant","in":"header","required":false,"schema":{"type":"string","default":"local","title":"X-Tenant"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpExecuteRequest"}}}},"responses":{"200":{"description":"Gated dynamic execution of an MCP tool","content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpExecuteResponse"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v2/a2a/card":{"get":{"tags":["A2A V2"],"summary":"A2A Card","description":"Reject A2A discovery before the ADK root agent can be imported.","operationId":"a2a_card_api_v2_a2a_card_get","responses":{"200":{"description":"Expose the Agent Card metadata for Agent-to-Agent discovery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/A2aCardResponse"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v2/docs/list":{"get":{"tags":["System V2"],"summary":"Docs List","description":"Expose a list of categories and files for both the Obsidian wiki and Karpathy LLM Wiki.","operationId":"docs_list_api_v2_docs_list_get","responses":{"200":{"description":"Expose a list of categories and files for both the Obsidian wiki and Karpathy LLM Wiki","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Docs List Api V2 Docs List Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v2/docs/file":{"get":{"tags":["System V2"],"summary":"Docs File","description":"Retrieve content of an Obsidian or Karpathy wiki file.","operationId":"docs_file_api_v2_docs_file_get","parameters":[{"name":"type","in":"query","required":true,"schema":{"type":"string","title":"Type"}},{"name":"path","in":"query","required":true,"schema":{"type":"string","title":"Path"}}],"responses":{"200":{"description":"Retrieve content of an Obsidian or Karpathy wiki file","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Docs File Api V2 Docs File Get"}}}},"400":{"description":"Bad Request: Parameter verification or query syntax error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized: Session key invalid or authorization headers missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden: User role does not possess permissions to write/read the target resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found: The target patient, session, database run, or image asset does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity: Parameter validation constraints failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error: Persisted SQLite storage connection error or agent execution crash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"A2aCardResponse":{"properties":{"name":{"type":"string","title":"Name","description":"Orchestration root agent identifier"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Root orchestrator capabilities statement"},"instruction":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Instruction","description":"System prompt instructions summary excerpt"},"pipelines":{"items":{"type":"string"},"type":"array","title":"Pipelines","description":"Sub-agent sequential sequence pipelines names list"},"tools":{"items":{"type":"string"},"type":"array","title":"Tools","description":"Native and MCP tools registered directly on the orchestrator"}},"type":"object","required":["name"],"title":"A2aCardResponse","description":"Agent card payload for Agent-to-Agent discovery."},"AgentCatalogResponse":{"properties":{"executionMode":{"type":"string","title":"Executionmode","description":"Active execution engine mode: 'local' (deterministic demo), 'live' (Vertex AI)"},"orchestrator":{"type":"string","title":"Orchestrator","description":"Primary intent classification agent identifier"},"framework":{"type":"string","title":"Framework","description":"Agent orchestrator platform framework name"},"pipelines":{"items":{"$ref":"#/components/schemas/AgentPipelineInfo"},"type":"array","title":"Pipelines","description":"List of available multi-agent pipeline sequential sequence workflows"}},"type":"object","required":["executionMode","orchestrator","framework","pipelines"],"title":"AgentCatalogResponse","description":"Structured agent catalog response contract."},"AgentConfigResponse":{"properties":{"version":{"type":"integer","title":"Version","description":"Monotonically increasing configuration schema version"},"autoApprovalThreshold":{"type":"integer","title":"Autoapprovalthreshold","description":"Confidence threshold for automatic session approval (0 to 100)"},"reviewThreshold":{"type":"integer","title":"Reviewthreshold","description":"Confidence threshold prompting mandatory clinical review (0 to 100)"},"maxConcurrentRuns":{"type":"integer","title":"Maxconcurrentruns","description":"Maximum parallel agent runs rate limit"},"databaseEnabled":{"type":"boolean","title":"Databaseenabled","description":"Flag to enable execution of approved SELECT queries"}},"type":"object","required":["version","autoApprovalThreshold","reviewThreshold","maxConcurrentRuns","databaseEnabled"],"title":"AgentConfigResponse","description":"Structured agent config response contract."},"AgentMonitorRow":{"properties":{"agent":{"type":"string","title":"Agent","description":"Agent display name, e.g. 'Vision Agent'"},"pipeline":{"type":"string","title":"Pipeline","description":"Owning workflow: 'extraction', 'qa', 'database'"},"lastRun":{"type":"string","title":"Lastrun","description":"Timestamp or relative time of the agent's last observed step"},"status":{"type":"string","title":"Status","description":"Aggregated health: 'healthy' or 'degraded'"},"avgConfidence":{"type":"number","title":"Avgconfidence","description":"Mean confidence of runs the agent participated in (0.0 to 1.0)"},"failureRate":{"type":"number","title":"Failurerate","description":"Ratio of errored steps (0.0 to 1.0)"},"reviewRate":{"type":"number","title":"Reviewrate","description":"Ratio of steps that paused for human review (0.0 to 1.0)"},"avgDurationMs":{"type":"integer","title":"Avgdurationms","description":"Mean step duration in milliseconds; 0 when unmeasured"},"linkedPatients":{"type":"integer","title":"Linkedpatients","description":"Distinct patients the agent touched; 0 when unmeasured"}},"type":"object","required":["agent","pipeline","lastRun","status","avgConfidence","failureRate","reviewRate","avgDurationMs","linkedPatients"],"title":"AgentMonitorRow","description":"Per-agent runtime statistics row."},"AgentPipelineInfo":{"properties":{"id":{"type":"string","title":"Id","description":"Pipeline category: 'extraction', 'qa', 'database'"},"name":{"type":"string","title":"Name","description":"Descriptive pipeline title"},"route":{"type":"string","title":"Route","description":"Workspace workflow route URL"},"agents":{"items":{"type":"string"},"type":"array","title":"Agents","description":"List of specialist agent IDs deployed in the sequential sequence"}},"type":"object","required":["id","name","route","agents"],"title":"AgentPipelineInfo","description":"Structure describing an agent pipeline."},"AuditEventDetailResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Unique compliance log entry ID, e.g. AUD-001"},"timestamp":{"type":"string","title":"Timestamp","description":"Audited event creation timestamp"},"event":{"type":"string","title":"Event","description":"Audited clinical action code"},"actor":{"type":"string","title":"Actor","description":"User or agent ID performing the action"},"entity":{"type":"string","title":"Entity","description":"Target ID affected by the event"},"result":{"type":"string","title":"Result","description":"Verification result: 'recorded', 'blocked'"},"details":{"additionalProperties":true,"type":"object","title":"Details","description":"Raw structured audit payload recorded with the event"},"run":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Run","description":"Linked agent run summary when the event references a run"},"patient":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Patient","description":"Linked patient summary when the event is patient-scoped"}},"type":"object","required":["id","timestamp","event","actor","entity","result"],"title":"AuditEventDetailResponse","description":"Single audit event enriched with the run and patient it references."},"AuditEventResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Unique compliance log entry ID, e.g. AUD-001"},"timestamp":{"type":"string","title":"Timestamp","description":"Audited event creation timestamp"},"event":{"type":"string","title":"Event","description":"Audited clinical action code"},"actor":{"type":"string","title":"Actor","description":"User or agent ID performing the action"},"entity":{"type":"string","title":"Entity","description":"Target ID affected by the event"},"result":{"type":"string","title":"Result","description":"Verification result: 'recorded', 'blocked'"}},"type":"object","required":["id","timestamp","event","actor","entity","result"],"title":"AuditEventResponse","description":"Structured audit event response contract."},"Body_create_asset_api_v1_assets_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"patient_id":{"type":"string","title":"Patient Id","default":""}},"type":"object","required":["file"],"title":"Body_create_asset_api_v1_assets_post"},"Body_create_knowledge_base_asset_api_v1_knowledge_base_assets_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"patient_id":{"type":"string","title":"Patient Id"}},"type":"object","required":["file","patient_id"],"title":"Body_create_knowledge_base_asset_api_v1_knowledge_base_assets_post"},"Body_import_data_api_v1_import_post":{"properties":{"import_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Import Type"},"patient_id":{"type":"string","title":"Patient Id","default":""},"file":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"File"}},"type":"object","title":"Body_import_data_api_v1_import_post"},"ComponentHealth":{"properties":{"name":{"type":"string","title":"Name","description":"Human-readable component name, e.g. 'Clinical database'"},"status":{"type":"string","title":"Status","description":"Measured status: 'operational' or 'unavailable'"},"detail":{"type":"string","title":"Detail","description":"What the check actually observed, including failure reasons"},"latencyMs":{"type":"number","title":"Latencyms","description":"Measured check duration in milliseconds"}},"type":"object","required":["name","status","detail","latencyMs"],"title":"ComponentHealth","description":"One measured system component check."},"DashboardResponse":{"properties":{"metrics":{"additionalProperties":true,"type":"object","title":"Metrics","description":"Global operational metrics (patients, High Risk counts, stored assets, active run limits)"},"patients":{"items":{"$ref":"#/components/schemas/PatientResponse"},"type":"array","title":"Patients","description":"List of patients requiring immediate attention"},"sessions":{"items":{"$ref":"#/components/schemas/SessionResponse"},"type":"array","title":"Sessions","description":"List of recent image extraction sessions"},"activity":{"items":{"$ref":"#/components/schemas/AuditEventResponse"},"type":"array","title":"Activity","description":"Latest compliance audit trail logs"}},"type":"object","required":["metrics","patients","sessions","activity"],"title":"DashboardResponse","description":"Structured dashboard data response contract."},"DatabaseRequest":{"properties":{"question":{"type":"string","maxLength":1000,"minLength":3,"title":"Question","description":"Cohort-wide natural language query, e.g. 'Count patients grouped by risk'"}},"type":"object","required":["question"],"title":"DatabaseRequest","description":"Natural-language database intelligence request."},"ErrorResponse":{"properties":{"detail":{"type":"string","title":"Detail","description":"Explanation of the error message detailing the reason for failure"}},"type":"object","required":["detail"],"title":"ErrorResponse","description":"Standard error response structure returned by the API."},"EvidenceItemResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Evidence source identifier"},"kind":{"type":"string","title":"Kind","description":"Evidence kind: 'text', 'image', 'structured', 'document'"},"date":{"type":"string","title":"Date","description":"Evidence date in YYYY-MM-DD format"},"excerpt":{"type":"string","title":"Excerpt","description":"Evidence text excerpt"},"sourceUrl":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sourceurl","description":"Asset URL when the evidence has viewable bytes"}},"type":"object","required":["id","kind","date","excerpt"],"title":"EvidenceItemResponse","description":"One patient evidence source."},"McpExecuteRequest":{"properties":{"toolName":{"type":"string","title":"Toolname","description":"Programmatic tool identifier"},"arguments":{"additionalProperties":true,"type":"object","title":"Arguments","description":"Parameters matching tool inputSchema"}},"type":"object","required":["toolName"],"title":"McpExecuteRequest","description":"Request payload to execute an MCP tool."},"McpExecuteResponse":{"properties":{"status":{"type":"string","title":"Status","description":"Execution result status: 'success', 'failed'"},"result":{"title":"Result","description":"Raw structured result returned by the SQLite or document processor tool execution"},"duration_ms":{"type":"number","title":"Duration Ms","description":"Tool execution duration in milliseconds","default":0.0}},"type":"object","required":["status","result"],"title":"McpExecuteResponse","description":"Execution output from an MCP tool."},"McpToolInfo":{"properties":{"name":{"type":"string","title":"Name","description":"Unique programmatic tool identifier, e.g. 'get_patient_status'"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Detailed tool instruction guidelines and parameter references"},"inputSchema":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Inputschema","description":"JSON schema describing expected arguments"},"outputSchema":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Outputschema","description":"JSON schema describing tool output structure"}},"type":"object","required":["name"],"title":"McpToolInfo","description":"Model context protocol tool definition."},"McpToolsListResponse":{"properties":{"tools":{"items":{"$ref":"#/components/schemas/McpToolInfo"},"type":"array","title":"Tools","description":"List of dynamic database and search tools registered on the FastMCP server"},"total":{"type":"integer","title":"Total","description":"Total count of active FastMCP tools"}},"type":"object","required":["tools","total"],"title":"McpToolsListResponse","description":"Response containing a list of MCP tools."},"NotificationResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Unique notification ID"},"title":{"type":"string","title":"Title","description":"Descriptive notification title"},"detail":{"type":"string","title":"Detail","description":"Detailed event description"},"severity":{"type":"string","title":"Severity","description":"Severity flag: 'critical', 'warning', 'info'"},"agent":{"type":"string","title":"Agent","description":"Issuing agent identifier"},"read":{"type":"boolean","title":"Read","description":"Indicates if the notification has been marked read"},"route":{"type":"string","title":"Route","description":"Target workspace navigation route link"}},"type":"object","required":["id","title","detail","severity","agent","read","route"],"title":"NotificationResponse","description":"Structured notification response contract."},"OrchestrateRequest":{"properties":{"query":{"type":"string","maxLength":2000,"minLength":3,"title":"Query","description":"Natural language user request to route"},"patientId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patientid","description":"Optional Patient ID context"}},"type":"object","required":["query"],"title":"OrchestrateRequest","description":"Natural-language workflow routing request."},"OrchestrationPlan":{"properties":{"intent":{"type":"string","title":"Intent","description":"Classified user query intent category, e.g. 'query_clinical_population'"},"workflow":{"type":"string","title":"Workflow","description":"Routed agent sequence name: 'extraction', 'qa', 'database'"},"route":{"type":"string","title":"Route","description":"Workspace navigation view route link"},"agents":{"items":{"type":"string"},"type":"array","title":"Agents","description":"Deployed specialist sub-agents deployed for the task"},"dataSources":{"items":{"type":"string"},"type":"array","title":"Datasources","description":"Grounded persistent stores queried during execution"},"permissions":{"items":{"type":"string"},"type":"array","title":"Permissions","description":"Access security scopes validated before tool execution"},"expectedOutput":{"type":"string","title":"Expectedoutput","description":"Descriptive expected result statement"}},"type":"object","required":["intent","workflow","route","agents","expectedOutput"],"title":"OrchestrationPlan","description":"Workflow classification and orchestration plan."},"PatientResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Unique patient identifier matching repository, e.g. PT-8829"},"name":{"type":"string","title":"Name","description":"Patient's full legal name"},"mrn":{"type":"string","title":"Mrn","description":"Medical Record Number for compliance lookup"},"age":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Age","description":"Patient age in years"},"sex":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sex","description":"Biological sex"},"condition":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Condition","description":"Primary clinical diagnosis or oncological stage"},"risk":{"type":"string","title":"Risk","description":"Risk categorization level: 'high', 'medium', 'low'"},"aiStatus":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Aistatus","description":"Review verification status: 'needs_review', 'verified'"},"completeness":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Completeness","description":"Ratio of required evidence uploaded (0.0 to 1.0)"},"lastEncounter":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lastencounter","description":"Date of the last record update in ISO 8601 format"},"assignedClinician":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Assignedclinician","description":"Assigned primary care clinician"},"openIssues":{"type":"integer","title":"Openissues","description":"Number of unresolved clinical tasks or warnings","default":0},"dataSources":{"type":"integer","title":"Datasources","description":"Number of indexed evidence files associated with the patient","default":0},"lastAiReview":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lastaireview","description":"Timestamp of last agent structured evaluation"}},"type":"object","required":["id","name","mrn","risk"],"title":"PatientResponse","description":"Structured patient response contract."},"PermissionRow":{"properties":{"permission":{"type":"string","title":"Permission","description":"Permission label, e.g. 'Run clinical agents'"},"grants":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Grants","description":"Role name to granted flag"}},"type":"object","required":["permission","grants"],"title":"PermissionRow","description":"One permission with its per-role grants."},"PermissionsResponse":{"properties":{"roles":{"items":{"type":"string"},"type":"array","title":"Roles","description":"Ordered role column names"},"matrix":{"items":{"$ref":"#/components/schemas/PermissionRow"},"type":"array","title":"Matrix","description":"Permission rows with per-role grants"},"version":{"type":"integer","title":"Version","description":"Monotonically increasing matrix version"}},"type":"object","required":["roles","matrix","version"],"title":"PermissionsResponse","description":"Role-permission matrix for the tenant."},"PermissionsUpdateRequest":{"properties":{"matrix":{"items":{"$ref":"#/components/schemas/PermissionRow"},"type":"array","minItems":1,"title":"Matrix","description":"Full permission matrix to persist"}},"type":"object","required":["matrix"],"title":"PermissionsUpdateRequest","description":"Admin edit of the permission matrix."},"QuestionRequest":{"properties":{"patientId":{"type":"string","title":"Patientid","description":"Scoped Patient ID for context grounding"},"question":{"type":"string","maxLength":2000,"minLength":3,"title":"Question","description":"Natural language question, e.g. 'What is the PHQ-9 progress?'"},"source_types":{"items":{"type":"string","enum":["text","image","lab","document","pdf","json","knowledge_base"]},"type":"array","title":"Source Types","description":"Filter citations by source evidence categories"},"filters":{"additionalProperties":true,"type":"object","title":"Filters","description":"Custom criteria, e.g. dateRange: '30d'"}},"type":"object","required":["patientId","question"],"title":"QuestionRequest","description":"Patient-grounded clinical question."},"ReportScheduleResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Stable report identifier, e.g. 'cohort-risk'"},"name":{"type":"string","title":"Name","description":"Human-readable report title"},"frequency":{"type":"string","enum":["off","daily","weekly","monthly"],"title":"Frequency","description":"Recurring generation cadence; 'off' disables scheduling"},"nextRun":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Nextrun","description":"Next scheduled generation date (YYYY-MM-DD) or null when off"},"updatedAt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updatedat","description":"ISO 8601 timestamp of the last schedule change"}},"type":"object","required":["id","name","frequency"],"title":"ReportScheduleResponse","description":"One report's recurring generation schedule."},"ReportScheduleUpdateRequest":{"properties":{"frequency":{"type":"string","enum":["off","daily","weekly","monthly"],"title":"Frequency","description":"Recurring generation cadence to apply"}},"type":"object","required":["frequency"],"title":"ReportScheduleUpdateRequest","description":"Set how often a report is generated."},"ReviewRequest":{"properties":{"decision":{"type":"string","enum":["approved","rejected"],"title":"Decision","description":"Clinician's gate decision to either approve and persist or reject and discard"},"comment":{"type":"string","maxLength":1000,"title":"Comment","description":"Optional clinician notes or rejection reasons","default":""},"fields":{"additionalProperties":true,"type":"object","title":"Fields","description":"Modified clinical fields to override agent structuring output"}},"type":"object","required":["decision"],"title":"ReviewRequest","description":"Clinician decision on an extraction run."},"RunRequest":{"properties":{"patientId":{"type":"string","title":"Patientid","description":"Target Patient ID, e.g. PT-8829"},"uploadIds":{"items":{"type":"string"},"type":"array","title":"Uploadids","description":"List of source asset IDs to extract from"},"assetId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Assetid","description":"Single asset ID helper (compatibility)"}},"type":"object","required":["patientId"],"title":"RunRequest","description":"Request to start deterministic extraction for uploaded evidence."},"SchemaColumn":{"properties":{"name":{"type":"string","title":"Name","description":"Column name"},"type":{"type":"string","title":"Type","description":"Declared SQL type"}},"type":"object","required":["name","type"],"title":"SchemaColumn","description":"One column in a clinical database table."},"SchemaTable":{"properties":{"table":{"type":"string","title":"Table","description":"Table name, e.g. 'patients_core'"},"columns":{"items":{"$ref":"#/components/schemas/SchemaColumn"},"type":"array","title":"Columns","description":"Declared columns in DDL order"}},"type":"object","required":["table","columns"],"title":"SchemaTable","description":"One clinical database table with its columns."},"SessionResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Unique session ID, e.g. SES-8829-003"},"patientId":{"type":"string","title":"Patientid","description":"Associated Patient ID"},"title":{"type":"string","title":"Title","description":"Descriptive session title"},"occurredAt":{"type":"string","title":"Occurredat","description":"Session date in YYYY-MM-DD format"},"status":{"type":"string","title":"Status","description":"Gate status: 'pending', 'verified'"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary","description":"Brief extraction content summary"},"uploadedImageCount":{"type":"integer","title":"Uploadedimagecount","description":"Number of image files processed during ingestion","default":0},"extractionConfidence":{"type":"number","title":"Extractionconfidence","description":"Agent consensus model confidence score (0.0 to 1.0)","default":0.0},"extractedFields":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Extractedfields","description":"Persisted structured fields with per-field confidence"},"jsonSyncStatus":{"type":"string","title":"Jsonsyncstatus","description":"Object storage status: 'pending', 'synced', 'failed'","default":"synced"},"relationalSyncStatus":{"type":"string","title":"Relationalsyncstatus","description":"Relational database sync status","default":"synced"},"vectorSyncStatus":{"type":"string","title":"Vectorsyncstatus","description":"Vector index sync status","default":"synced"},"auditStatus":{"type":"string","title":"Auditstatus","description":"Compliance audit trail logging status","default":"recorded"}},"type":"object","required":["id","patientId","title","occurredAt","status"],"title":"SessionResponse","description":"Structured session response contract."},"StorageResponse":{"properties":{"assets":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Assets","description":"Metadata of all raw uploaded files"},"persistedExtractions":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Persistedextractions","description":"Persisted session structured receipts"},"records":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Records","description":"Derived storage pipeline records (uploads and per-target extraction receipts)"},"assetCount":{"type":"integer","title":"Assetcount","description":"Total uploaded assets"},"persistedCount":{"type":"integer","title":"Persistedcount","description":"Total approved and synced session extractions"},"cloudCount":{"type":"integer","title":"Cloudcount","description":"Cloud Storage object count"},"jsonCount":{"type":"integer","title":"Jsoncount","description":"JSON record document count"},"sqlCount":{"type":"integer","title":"Sqlcount","description":"Relational database row count"},"vectorCount":{"type":"integer","title":"Vectorcount","description":"Vector index embedding count"},"auditCount":{"type":"integer","title":"Auditcount","description":"Immutable compliance audit log count"}},"type":"object","required":["assets","persistedExtractions","assetCount","persistedCount","cloudCount","jsonCount","sqlCount","vectorCount","auditCount"],"title":"StorageResponse","description":"Structured storage metadata response contract."},"SystemHealthResponse":{"properties":{"components":{"items":{"$ref":"#/components/schemas/ComponentHealth"},"type":"array","title":"Components","description":"Measured checks for database, agent runtime, MCP, storage, model credentials, and frontend bundle"},"checkedAt":{"type":"string","title":"Checkedat","description":"ISO 8601 timestamp when the checks ran"}},"type":"object","required":["components","checkedAt"],"title":"SystemHealthResponse","description":"Real component health for the caller's tenant."},"UserResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Unique corporate user identifier, e.g. USR-001"},"name":{"type":"string","title":"Name","description":"User full legal name"},"email":{"type":"string","title":"Email","description":"Verified workspace email address"},"roles":{"items":{"type":"string"},"type":"array","title":"Roles","description":"Assigned role access groups: 'clinician', 'reviewer', 'admin'"},"scope":{"type":"string","title":"Scope","description":"Access permission scope boundaries"},"status":{"type":"string","title":"Status","description":"Account operational state: 'Active', 'Suspended'"}},"type":"object","required":["id","name","email","roles","scope","status"],"title":"UserResponse","description":"Structured user response contract."},"V2HealthResponse":{"properties":{"status":{"type":"string","title":"Status","description":"System liveness state, e.g. 'ok'"},"mode":{"type":"string","title":"Mode","description":"Active execution engine mode: 'local' (demo), 'live' (Vertex AI)"},"timestamp":{"type":"string","title":"Timestamp","description":"ISO 8601 current local server time"},"databaseConnected":{"type":"boolean","title":"Databaseconnected","description":"SQLite clinical database persistence liveness connection check"},"storageAccessible":{"type":"boolean","title":"Storageaccessible","description":"Local uploads storage read-write permission access check"}},"type":"object","required":["status","mode","timestamp","databaseConnected","storageAccessible"],"title":"V2HealthResponse","description":"Advanced system health information."},"WorkspaceSummaryResponse":{"properties":{"queueCount":{"type":"integer","title":"Queuecount","description":"Patients currently needing review"},"inboxCount":{"type":"integer","title":"Inboxcount","description":"Runs awaiting explicit clinician review"},"unreadNotifications":{"type":"integer","title":"Unreadnotifications","description":"Unread notification count"},"patients":{"type":"integer","title":"Patients","description":"Total patients visible to the tenant"},"runs":{"type":"integer","title":"Runs","description":"Agent runs recorded in this session"}},"type":"object","required":["queueCount","inboxCount","unreadNotifications","patients","runs"],"title":"WorkspaceSummaryResponse","description":"Live counts for navigation badges and the role landing page."}}}}