{"openapi":"3.1.0","info":{"title":"AlphaGrid Backend (dev)","version":"0.1.0"},"paths":{"/auth/login":{"post":{"tags":["auth"],"summary":"Login","description":"Authenticate a user and return an access token plus profile.","operationId":"login_auth_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/logout":{"post":{"tags":["auth"],"summary":"Logout","description":"Logout current user by invalidating their active session.","operationId":"logout_auth_logout_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Logout Auth Logout Post"}}}}},"security":[{"HTTPBearer":[]}]}},"/auth/me":{"get":{"tags":["auth"],"summary":"Get Me","description":"Return the profile of the authenticated user.","operationId":"get_me_auth_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserOut"}}}}},"security":[{"HTTPBearer":[]}]}},"/organizations":{"get":{"tags":["organizations"],"summary":"List Organizations","description":"List all organizations (admin only shows user's org, super admin sees all).","operationId":"list_organizations_organizations_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/OrganizationOut"},"type":"array","title":"Response List Organizations Organizations Get"}}}}},"security":[{"HTTPBearer":[]}]},"post":{"tags":["organizations"],"summary":"Create Organization","description":"Create a new organization (super admin only).","operationId":"create_organization_organizations_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationCreate"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/organizations/{org_id}":{"get":{"tags":["organizations"],"summary":"Get Organization","description":"Get organization by ID.","operationId":"get_organization_organizations__org_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"integer","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["organizations"],"summary":"Update Organization","description":"Update organization details.","operationId":"update_organization_organizations__org_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"integer","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/organizations/{org_id}/branches":{"get":{"tags":["organizations"],"summary":"List Branches","description":"List all branches for an organization.","operationId":"list_branches_organizations__org_id__branches_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"integer","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BranchOut"},"title":"Response List Branches Organizations  Org Id  Branches Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["organizations"],"summary":"Create Branch","description":"Create a new branch in an organization.","operationId":"create_branch_organizations__org_id__branches_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"integer","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/organizations/branches/{branch_id}":{"put":{"tags":["organizations"],"summary":"Update Branch","description":"Update branch details.","operationId":"update_branch_organizations_branches__branch_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"branch_id","in":"path","required":true,"schema":{"type":"integer","title":"Branch Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/organizations/access/me":{"get":{"tags":["organizations"],"summary":"Get My Branch Access","description":"Get current user's branch access list.","operationId":"get_my_branch_access_organizations_access_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/UserBranchAccessOut"},"type":"array","title":"Response Get My Branch Access Organizations Access Me Get"}}}}},"security":[{"HTTPBearer":[]}]}},"/organizations/access/{user_id}":{"get":{"tags":["organizations"],"summary":"Get User Branch Access","description":"Get branch access for a specific user (admin only).","operationId":"get_user_branch_access_organizations_access__user_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"integer","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserBranchAccessOut"},"title":"Response Get User Branch Access Organizations Access  User Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/organizations/access/{user_id}/grant":{"post":{"tags":["organizations"],"summary":"Grant Branch Access","description":"Grant a user access to a branch.","operationId":"grant_branch_access_organizations_access__user_id__grant_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"integer","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchAccessGrant"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserBranchAccessOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/organizations/access/{user_id}/{branch_id}":{"delete":{"tags":["organizations"],"summary":"Revoke Branch Access","description":"Revoke a user's access to a branch.","operationId":"revoke_branch_access_organizations_access__user_id___branch_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"integer","title":"User Id"}},{"name":"branch_id","in":"path","required":true,"schema":{"type":"integer","title":"Branch Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/patients":{"get":{"tags":["patients"],"summary":"List Patients","description":"List patients across accessible branches.","operationId":"list_patients_patients_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"branch_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Branch Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PatientOut"},"title":"Response List Patients Patients Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["patients"],"summary":"Create Patient","description":"Create a new patient in user's home branch.","operationId":"create_patient_patients_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/patients/{patient_id}":{"get":{"tags":["patients"],"summary":"Get Patient","description":"Get patient details with modalities.","operationId":"get_patient_patients__patient_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientDetailOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["patients"],"summary":"Update Patient","description":"Update patient details.","operationId":"update_patient_patients__patient_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["patients"],"summary":"Delete Patient","description":"Soft delete a patient.","operationId":"delete_patient_patients__patient_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/patients/{patient_id}/transfer":{"post":{"tags":["patients"],"summary":"Transfer Patient","description":"Transfer patient to another branch within the same organization.","operationId":"transfer_patient_patients__patient_id__transfer_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientTransfer"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/patients/{patient_id}/trends":{"get":{"tags":["patients"],"summary":"Get Patient Trends","description":"Get tumor and lab trends for charting.","operationId":"get_patient_trends_patients__patient_id__trends_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientTrendsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/patients/{patient_id}/labs":{"post":{"tags":["patients"],"summary":"Create Lab Panel","description":"Store CBC/RFT/LFT lab panel results and attach to a modality report.","operationId":"create_lab_panel_patients__patient_id__labs_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LabPanelCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BiomarkerOut"},"title":"Response Create Lab Panel Patients  Patient Id  Labs Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/visits/patient/{patient_id}":{"get":{"tags":["visits"],"summary":"List Patient Visits","description":"Get all visits for a patient.","operationId":"list_patient_visits_visits_patient__patient_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PatientVisitOut"},"title":"Response List Patient Visits Visits Patient  Patient Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/visits/{visit_id}":{"get":{"tags":["visits"],"summary":"Get Visit","description":"Get a single visit by ID.","operationId":"get_visit_visits__visit_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"visit_id","in":"path","required":true,"schema":{"type":"integer","title":"Visit Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientVisitOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["visits"],"summary":"Update Visit","description":"Update a visit.","operationId":"update_visit_visits__visit_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"visit_id","in":"path","required":true,"schema":{"type":"integer","title":"Visit Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientVisitUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientVisitOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["visits"],"summary":"Delete Visit","description":"Delete a visit.","operationId":"delete_visit_visits__visit_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"visit_id","in":"path","required":true,"schema":{"type":"integer","title":"Visit Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/visits":{"post":{"tags":["visits"],"summary":"Create Visit","description":"Create a new visit for a patient.","operationId":"create_visit_visits_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientVisitCreate"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientVisitOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/visits/{visit_id}/context":{"get":{"tags":["visits"],"summary":"Get Clinical Context","description":"Get clinical context for a visit.","operationId":"get_clinical_context_visits__visit_id__context_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"visit_id","in":"path","required":true,"schema":{"type":"integer","title":"Visit Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicalContextOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["visits"],"summary":"Upsert Clinical Context","description":"Create or update clinical context for a visit.","operationId":"upsert_clinical_context_visits__visit_id__context_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"visit_id","in":"path","required":true,"schema":{"type":"integer","title":"Visit Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicalContextCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicalContextOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/modalities/patient/{patient_id}":{"get":{"tags":["modalities"],"summary":"Get Patient Modalities","description":"Get all modalities for a patient, optionally filtered by type.\nTypes: Imaging, Histopathology, Genomics, Blood Markers, Clinical Notes","operationId":"get_patient_modalities_modalities_patient__patient_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}},{"name":"type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ModalityOut"},"title":"Response Get Patient Modalities Modalities Patient  Patient Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/modalities/{modality_id}":{"get":{"tags":["modalities"],"summary":"Get Modality","description":"Get a single modality by ID.","operationId":"get_modality_modalities__modality_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"modality_id","in":"path","required":true,"schema":{"type":"integer","title":"Modality Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModalityOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/modalities":{"post":{"tags":["modalities"],"summary":"Create Modality","description":"Create a new modality for a patient.","operationId":"create_modality_modalities_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModalityCreate"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModalityOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/modalities/summarize":{"post":{"tags":["modalities"],"summary":"Summarize Modality","description":"Generate AI summary for a modality.\nReturns either immediate result (200) or job ID for async processing (202).","operationId":"summarize_modality_modalities_summarize_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SummarizeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SummarizeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/modalities/upload":{"post":{"tags":["modalities"],"summary":"Upload Modality","description":"Handle local uploads for modality assets.","operationId":"upload_modality_modalities_upload_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_modality_modalities_upload_post"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModalityOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/tumors/patient/{patient_id}":{"get":{"tags":["tumors"],"summary":"List Patient Tumors","description":"Get all tumors for a patient.","operationId":"list_patient_tumors_tumors_patient__patient_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}},{"name":"include_deleted","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Deleted"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TumorOut"},"title":"Response List Patient Tumors Tumors Patient  Patient Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tumors":{"post":{"tags":["tumors"],"summary":"Create Tumor","description":"Create a new canonical tumor for a patient.","operationId":"create_tumor_tumors_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TumorCreate"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TumorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/tumors/{tumor_id}":{"put":{"tags":["tumors"],"summary":"Update Tumor","description":"Update a tumor.","operationId":"update_tumor_tumors__tumor_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tumor_id","in":"path","required":true,"schema":{"type":"integer","title":"Tumor Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TumorCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TumorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["tumors"],"summary":"Delete Tumor","description":"Soft delete a tumor.","operationId":"delete_tumor_tumors__tumor_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tumor_id","in":"path","required":true,"schema":{"type":"integer","title":"Tumor Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tumors/measurements/patient/{patient_id}":{"get":{"tags":["tumors"],"summary":"List Patient Measurements","description":"Get all tumor measurements for a patient.","operationId":"list_patient_measurements_tumors_measurements_patient__patient_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TumorMeasurementOut"},"title":"Response List Patient Measurements Tumors Measurements Patient  Patient Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tumors/measurements/{tumor_id}":{"get":{"tags":["tumors"],"summary":"List Tumor Measurements","description":"Get all measurements for a specific tumor.","operationId":"list_tumor_measurements_tumors_measurements__tumor_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tumor_id","in":"path","required":true,"schema":{"type":"integer","title":"Tumor Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TumorMeasurementOut"},"title":"Response List Tumor Measurements Tumors Measurements  Tumor Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tumors/measurements":{"post":{"tags":["tumors"],"summary":"Create Measurement","description":"Create a new tumor measurement.","operationId":"create_measurement_tumors_measurements_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TumorMeasurementCreate"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TumorMeasurementOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/tumors/measurements/{measurement_id}/canonical":{"put":{"tags":["tumors"],"summary":"Mark Measurement Canonical","description":"Mark a measurement as canonical (and unmark others for the same tumor).","operationId":"mark_measurement_canonical_tumors_measurements__measurement_id__canonical_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"measurement_id","in":"path","required":true,"schema":{"type":"integer","title":"Measurement Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/biomarkers/patient/{patient_id}":{"get":{"tags":["biomarkers"],"summary":"List Patient Biomarkers","description":"Get all biomarkers for a patient, optionally filtered by marker name.","operationId":"list_patient_biomarkers_biomarkers_patient__patient_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}},{"name":"marker_name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Marker Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BiomarkerOut"},"title":"Response List Patient Biomarkers Biomarkers Patient  Patient Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/biomarkers/patient/{patient_id}/latest/{marker_name}":{"get":{"tags":["biomarkers"],"summary":"Get Latest Biomarker","description":"Get the most recent value for a specific biomarker.","operationId":"get_latest_biomarker_biomarkers_patient__patient_id__latest__marker_name__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}},{"name":"marker_name","in":"path","required":true,"schema":{"type":"string","title":"Marker Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BiomarkerOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/biomarkers/patient/{patient_id}/summary":{"get":{"tags":["biomarkers"],"summary":"Get Biomarker Summary","description":"Get a summary of all biomarkers for a patient (latest values by marker name).","operationId":"get_biomarker_summary_biomarkers_patient__patient_id__summary_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/biomarkers/{biomarker_id}":{"get":{"tags":["biomarkers"],"summary":"Get Biomarker","description":"Get a single biomarker by ID.","operationId":"get_biomarker_biomarkers__biomarker_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"biomarker_id","in":"path","required":true,"schema":{"type":"integer","title":"Biomarker Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BiomarkerOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["biomarkers"],"summary":"Delete Biomarker","description":"Delete a biomarker record.","operationId":"delete_biomarker_biomarkers__biomarker_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"biomarker_id","in":"path","required":true,"schema":{"type":"integer","title":"Biomarker Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/biomarkers":{"post":{"tags":["biomarkers"],"summary":"Create Biomarker","description":"Create a new biomarker record.","operationId":"create_biomarker_biomarkers_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BiomarkerCreate"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BiomarkerOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/genomics/patient/{patient_id}":{"get":{"tags":["genomics"],"summary":"List Patient Genomics","description":"Get all genomics reports for a patient.","operationId":"list_patient_genomics_genomics_patient__patient_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/GenomicsReportOut"},"title":"Response List Patient Genomics Genomics Patient  Patient Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/genomics/patient/{patient_id}/latest":{"get":{"tags":["genomics"],"summary":"Get Latest Genomics","description":"Get the most recent genomics report for a patient.","operationId":"get_latest_genomics_genomics_patient__patient_id__latest_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenomicsReportOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/genomics/patient/{patient_id}/actionable":{"get":{"tags":["genomics"],"summary":"Get Actionable Variants","description":"Get summary of actionable variants across all genomics reports.","operationId":"get_actionable_variants_genomics_patient__patient_id__actionable_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/genomics":{"post":{"tags":["genomics"],"summary":"Create Genomics Report","description":"Create a new genomics report.","operationId":"create_genomics_report_genomics_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenomicsReportCreate"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenomicsReportOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/genomics/{report_id}":{"put":{"tags":["genomics"],"summary":"Update Genomics Report","description":"Update a genomics report.","operationId":"update_genomics_report_genomics__report_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"integer","title":"Report Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenomicsReportCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenomicsReportOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["genomics"],"summary":"Delete Genomics Report","description":"Delete a genomics report.","operationId":"delete_genomics_report_genomics__report_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"integer","title":"Report Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/patients/{patient_id}/reports":{"get":{"tags":["reports"],"summary":"Get Patient Reports","description":"Get all reports for a patient.","operationId":"get_patient_reports_patients__patient_id__reports_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ReportOut"},"title":"Response Get Patient Reports Patients  Patient Id  Reports Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/patients/{patient_id}/reports/latest":{"get":{"tags":["reports"],"summary":"Get Latest Patient Report","description":"Get the latest report for a patient.","operationId":"get_latest_patient_report_patients__patient_id__reports_latest_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/reports/{report_id}":{"get":{"tags":["reports"],"summary":"Get Report","description":"Get a specific report by ID.","operationId":"get_report_reports__report_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"integer","title":"Report Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/patients/{patient_id}/reports/generate":{"post":{"tags":["reports"],"summary":"Generate Urs Report","description":"Initiate URS report generation for a patient.\nReturns job ID for polling progress.","operationId":"generate_urs_report_patients__patient_id__reports_generate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateURSResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/reports/{report_id}/summaries":{"post":{"tags":["reports"],"summary":"Create Report Summary","description":"Upload a PDF report and generate a Med-Gemma summary.","operationId":"create_report_summary_reports__report_id__summaries_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"integer","title":"Report Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_report_summary_reports__report_id__summaries_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportSummaryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/reports/{report_id}/expert-findings":{"post":{"tags":["reports"],"summary":"Add Expert Finding","description":"Add an expert finding to a report.","operationId":"add_expert_finding_reports__report_id__expert_findings_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"integer","title":"Report Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpertFindingCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpertFindingOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/reports/{report_id}/finalize":{"put":{"tags":["reports"],"summary":"Finalize Report","description":"Finalize a report (mark as Final).\nRequires password verification for security.","operationId":"finalize_report_reports__report_id__finalize_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"integer","title":"Report Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FinalizeReportRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FinalizeReportResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/jobs/{job_id}/status":{"get":{"tags":["ai-jobs"],"summary":"Get Job Status","description":"Get the status of an AI job.\nJob ID can be in format: 'sum_{modality_id}_{timestamp}' or 'urs_{patient_id}_{job_id}'\n\nThis simulates async processing for development.\nIn production, this would check actual job status from queue/database.","operationId":"get_job_status_jobs__job_id__status_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AIJobStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/jobs/ai/{job_id}":{"get":{"tags":["ai-jobs"],"summary":"Get Ai Processing Job","description":"Get status of an AI document processing job.\n\nThis is for the new Gemini Vision + Claude processing pipeline.\nJob ID is a UUID from the ai_jobs table.","operationId":"get_ai_processing_job_jobs_ai__job_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Ai Processing Job Jobs Ai  Job Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/jobs/patient/{patient_id}/ai-jobs":{"get":{"tags":["ai-jobs"],"summary":"List Patient Ai Jobs","description":"List AI processing jobs for a patient.","operationId":"list_patient_ai_jobs_jobs_patient__patient_id__ai_jobs_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response List Patient Ai Jobs Jobs Patient  Patient Id  Ai Jobs Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/predict":{"post":{"tags":["inference"],"summary":"Predict","operationId":"predict_api_predict_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_predict_api_predict_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PredictionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/explain":{"post":{"tags":["inference"],"summary":"Explain","operationId":"explain_api_explain_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_explain_api_explain_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExplainResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/dashboard/stats":{"get":{"tags":["dashboard"],"summary":"Get Dashboard Stats","description":"Get dashboard statistics for the user's accessible branches.","operationId":"get_dashboard_stats_dashboard_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardStats"}}}}},"security":[{"HTTPBearer":[]}]}},"/dashboard/activity":{"get":{"tags":["dashboard"],"summary":"Get Recent Activity","description":"Get recent activity for the user's accessible branches.","operationId":"get_recent_activity_dashboard_activity_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/RecentActivity"},"type":"array","title":"Response Get Recent Activity Dashboard Activity Get"}}}}},"security":[{"HTTPBearer":[]}]}},"/dashboard/modality-breakdown":{"get":{"tags":["dashboard"],"summary":"Get Modality Breakdown","description":"Get modality type breakdown for the user's accessible branches.","operationId":"get_modality_breakdown_dashboard_modality_breakdown_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ModalityBreakdown"},"type":"array","title":"Response Get Modality Breakdown Dashboard Modality Breakdown Get"}}}}},"security":[{"HTTPBearer":[]}]}},"/admin/users":{"get":{"tags":["admin"],"summary":"List Users","operationId":"list_users_admin_users_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/UserOut"},"type":"array","title":"Response List Users Admin Users Get"}}}}},"security":[{"HTTPBearer":[]}]},"post":{"tags":["admin"],"summary":"Create User","operationId":"create_user_admin_users_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserCreate"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/admin/users/{user_id}":{"delete":{"tags":["admin"],"summary":"Delete User","operationId":"delete_user_admin_users__user_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"integer","title":"User Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agent/chat-status":{"get":{"tags":["agent"],"summary":"Get Chat Agent Status","description":"Check if chat agent and Claude are configured and available","operationId":"get_chat_agent_status_agent_chat_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/agent/rag-search":{"post":{"tags":["agent"],"summary":"Search Knowledge Base","description":"Search the clinical knowledge base for relevant information via RAG","operationId":"search_knowledge_base_agent_rag_search_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsetSearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/AgentsetSearchResult"},"type":"array","title":"Response Search Knowledge Base Agent Rag Search Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/agent/chat":{"post":{"tags":["agent"],"summary":"Chat With Agent","description":"Chat endpoint using ReAct agent for autonomous source selection.\n\nThe agent autonomously selects appropriate tools (PubMed, Scopus, clinical trials, etc.)\nbased on the user's query and patient context. No manual connector selection.\n\nSupports per-session conversation memory:\n- If session_id provided, loads prior conversation history\n- Saves user message and agent response after invocation\n- Returns session_id for frontend to continue conversation\n\nReturns:\n    AgentsetChatResponse with agent's response, evidence sources, and session_id.","operationId":"chat_with_agent_agent_chat_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsetChatRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsetChatResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/agent/rag-ingest":{"post":{"tags":["agent"],"summary":"Ingest Data","description":"Ingest patient data or clinical content into RAG knowledge base","operationId":"ingest_data_agent_rag_ingest_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsetIngestionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsetIngestionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/openai/v1/chat/completions":{"post":{"tags":["openai"],"summary":"Chat Completions","description":"Proxy OpenAI chat completions to keep API key server-side","operationId":"chat_completions_openai_v1_chat_completions_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpenAIChatRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/gemini/status":{"get":{"tags":["gemini-chat"],"summary":"Get Gemini Status","description":"Check if Gemini is configured and available","operationId":"get_gemini_status_gemini_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/gemini/chat":{"post":{"tags":["gemini-chat"],"summary":"Chat With Gemini","description":"Send a chat message with patient context to Gemini","operationId":"chat_with_gemini_gemini_chat_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeminiChatRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeminiChatResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/clinical-ai/treatment-recommendations":{"post":{"tags":["Clinical AI"],"summary":"Get Treatment Recommendations","description":"Get AI-powered treatment recommendations for a patient.\n\nGathers evidence from:\n- Patient medical history and context\n- PubMed literature\n- ClinicalTrials.gov\n- Open Targets gene-disease associations\n\nReturns evidence-based treatment suggestions with citations.","operationId":"get_treatment_recommendations_clinical_ai_treatment_recommendations_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TreatmentRecommendationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicalAIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/clinical-ai/cohort-analysis":{"post":{"tags":["Clinical AI"],"summary":"Get Cohort Analysis","description":"Compare patient to similar cohorts for prognostic insights.\n\nAnalyzes how the patient compares to published cohort studies\nbased on diagnosis, stage, biomarkers, and other characteristics.","operationId":"get_cohort_analysis_clinical_ai_cohort_analysis_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CohortAnalysisRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicalAIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/clinical-ai/report-summary":{"post":{"tags":["Clinical AI"],"summary":"Get Report Summary","description":"Get AI-generated summary of a specific modality report.\n\nSummarizes key findings, measurements, and recommendations\nfrom imaging, pathology, or other medical reports.","operationId":"get_report_summary_clinical_ai_report_summary_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportSummaryRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicalAIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/clinical-ai/chat":{"post":{"tags":["Clinical AI"],"summary":"Clinical Chat","description":"Interactive clinical Q&A with patient context.\n\nSupports multi-turn conversation about a patient's case,\nwith full access to patient history and clinical evidence.","operationId":"clinical_chat_clinical_ai_chat_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicalChatRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicalAIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/clinical-ai/health":{"get":{"tags":["Clinical AI"],"summary":"Health Check","description":"Check if Clinical AI service is configured and ready.","operationId":"health_check_clinical_ai_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/voice/transcribe":{"post":{"tags":["Voice Input"],"summary":"Transcribe Audio","description":"Transcribe audio to text using Sarvam AI.\n\nSupports multiple Indian languages and English:\n- hi-IN: Hindi\n- en-IN: English (Indian)\n- ta-IN: Tamil\n- te-IN: Telugu\n- kn-IN: Kannada\n- ml-IN: Malayalam\n- mr-IN: Marathi\n- gu-IN: Gujarati\n- bn-IN: Bengali\n- pa-IN: Punjabi\n- or-IN: Odia\n- unknown: Auto-detect\n\nSupported audio formats: WAV, MP3, AAC, OGG, OPUS, FLAC, MP4/M4A, WebM","operationId":"transcribe_audio_voice_transcribe_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_transcribe_audio_voice_transcribe_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/voice/supported-languages":{"get":{"tags":["Voice Input"],"summary":"Get Supported Languages","description":"Get list of supported languages for speech-to-text.","operationId":"get_supported_languages_voice_supported_languages_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/voice/health":{"get":{"tags":["Voice Input"],"summary":"Voice Health Check","description":"Check if voice transcription service is available.","operationId":"voice_health_check_voice_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/agent/run":{"post":{"tags":["Clinical Agent"],"summary":"Run Clinical Agent","description":"Trigger the clinical agent workflow for a patient.\n\nRuns the 9-node LangGraph pipeline:\n1. Case Ingestion\n2. Imaging Perception\n3. Cancer Confirmation\n4. Staging\n5. Trajectory Analysis\n6. Risk Stratification\n7. Agentic RAG (evidence synthesis)\n8. Report Generation\n9. Feedback Loop\n\nReturns a trace_id for tracking the workflow.","operationId":"run_clinical_agent_agent_run_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/agent/status/{trace_id}":{"get":{"tags":["Clinical Agent"],"summary":"Get Workflow Status","description":"Get the status of a clinical agent workflow.\n\nReturns current stage, completed stages, and any errors.\nUses a single optimized query to get progress from all node records.","operationId":"get_workflow_status_agent_status__trace_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"trace_id","in":"path","required":true,"schema":{"type":"string","title":"Trace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agent/result/{trace_id}":{"get":{"tags":["Clinical Agent"],"summary":"Get Workflow Result","description":"Get the full results of a completed workflow.\n\nReturns the tumor board report, treatment recommendations,\nstaging, risk assessment, and gathered evidence.","operationId":"get_workflow_result_agent_result__trace_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"trace_id","in":"path","required":true,"schema":{"type":"string","title":"Trace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentResultResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agent/feedback/{trace_id}":{"post":{"tags":["Clinical Agent"],"summary":"Submit Feedback","description":"Submit clinician feedback on workflow recommendations.\n\nFeedback is stored for model improvement and learning.","operationId":"submit_feedback_agent_feedback__trace_id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"trace_id","in":"path","required":true,"schema":{"type":"string","title":"Trace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentFeedbackRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agent/history/{patient_id}":{"get":{"tags":["Clinical Agent"],"summary":"Get Patient Workflow History","description":"Get workflow history for a patient.\n\nReturns list of past workflow executions with their status.","operationId":"get_patient_workflow_history_agent_history__patient_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"integer","title":"Patient Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agent/health":{"get":{"tags":["Clinical Agent"],"summary":"Agent Health Check","description":"Check if agent service is configured and ready.","operationId":"agent_health_check_agent_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/agent/external-analysis":{"post":{"tags":["Clinical Agent"],"summary":"External Analysis With Agent","description":"Endpoint to analyze comprehensive clinical data (context, transcription, patient data)\nusing the agent's tools to formulate treatment, medication, and prescription plans.","operationId":"external_analysis_with_agent_agent_external_analysis_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalAnalysisRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/":{"get":{"summary":"Root","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"AIJobStatusResponse":{"properties":{"status":{"type":"string","title":"Status"},"progress":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Progress"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"trace_references":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Trace References"},"report_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Report Id"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["status"],"title":"AIJobStatusResponse"},"AgentFeedbackRequest":{"properties":{"action":{"type":"string","title":"Action","description":"Feedback action: accepted, modified, rejected, data_correction"},"selected_treatment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Selected Treatment","description":"Treatment chosen by clinician"},"rationale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rationale","description":"Clinical reasoning for the decision"},"modifications":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Modifications","description":"Any modifications to AI recommendations"}},"type":"object","required":["action"],"title":"AgentFeedbackRequest","description":"Request to submit clinician feedback."},"AgentResultResponse":{"properties":{"trace_id":{"type":"string","title":"Trace Id"},"patient_id":{"type":"integer","title":"Patient Id"},"status":{"type":"string","title":"Status"},"report":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Report"},"treatment_recommendations":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Treatment Recommendations"},"staging":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Staging"},"risk_assessment":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Risk Assessment"},"clinical_trials":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Clinical Trials","default":[]},"literature_evidence":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Literature Evidence","default":[]},"errors":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Errors","default":[]}},"type":"object","required":["trace_id","patient_id","status"],"title":"AgentResultResponse","description":"Response with workflow results."},"AgentRunRequest":{"properties":{"patient_id":{"type":"integer","title":"Patient Id","description":"Patient ID to analyze"},"run_async":{"type":"boolean","title":"Run Async","description":"Run asynchronously (recommended for production)","default":true},"include_rag":{"type":"boolean","title":"Include Rag","description":"Include evidence gathering from external sources","default":true},"skip_nodes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Skip Nodes","description":"Nodes to skip (e.g., ['imaging_perception'] if no imaging)"}},"type":"object","required":["patient_id"],"title":"AgentRunRequest","description":"Request to trigger clinical agent workflow.","example":{"include_rag":true,"patient_id":123,"run_async":true}},"AgentRunResponse":{"properties":{"trace_id":{"type":"string","title":"Trace Id"},"patient_id":{"type":"integer","title":"Patient Id"},"status":{"type":"string","title":"Status"},"message":{"type":"string","title":"Message"},"started_at":{"type":"string","title":"Started At"}},"type":"object","required":["trace_id","patient_id","status","message","started_at"],"title":"AgentRunResponse","description":"Response from agent run endpoint."},"AgentStatusResponse":{"properties":{"trace_id":{"type":"string","title":"Trace Id"},"patient_id":{"type":"integer","title":"Patient Id"},"status":{"type":"string","title":"Status"},"current_stage":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Stage"},"completed_stages":{"items":{"type":"string"},"type":"array","title":"Completed Stages","default":[]},"errors":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Errors","default":[]},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Completed At"}},"type":"object","required":["trace_id","patient_id","status"],"title":"AgentStatusResponse","description":"Response with workflow status."},"AgentStep":{"properties":{"step_num":{"type":"integer","title":"Step Num","description":"Sequential step number (1-indexed)"},"action_type":{"type":"string","enum":["thinking","tool_call","result"],"title":"Action Type","description":"Type of action: thinking (inference), tool_call (execution), or result (outcome)"},"tool_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tool Name","description":"Name of tool used (only for tool_call and result types)"},"tool_query":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tool Query","description":"Tool arguments/parameters as JSON string (only for tool_call type)"},"result_summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Result Summary","description":"Summary of tool result, truncated to ~200 chars (only for result type)"},"thinking_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thinking Text","description":"Inferred thinking or reasoning (only for thinking type)"},"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timestamp","description":"ISO 8601 timestamp for when step was executed"},"duration_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Duration Ms","description":"Duration of this step in milliseconds (time until next step)"}},"type":"object","required":["step_num","action_type"],"title":"AgentStep","description":"Represents a single step in the agent's reasoning process.\n\nCan be one of three types:\n1. thinking: Agent's inferred reasoning about what to do\n2. tool_call: Agent calling a specific tool with arguments\n3. result: Result returned from a tool execution\n\nExample:\n    Step 1 (thinking): \"Searching medical literature for relevant research...\"\n    Step 2 (tool_call): pubmed_search with query \"NSCLC treatment\"\n    Step 3 (result): \"Found 15 papers on NSCLC immunotherapy\"","example":{"action_type":"thinking","step_num":1,"thinking_text":"Searching medical literature for treatment options..."}},"AgentsetChatRequest":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/AgentsetMessage"},"type":"array","title":"Messages"},"patient_context":{"anyOf":[{},{"type":"null"}],"title":"Patient Context"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"patient_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Patient Id"},"custom_system_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom System Prompt"}},"type":"object","required":["messages"],"title":"AgentsetChatRequest","description":"Chat request model for /chat endpoint.\n\nThe agent autonomously selects sources and tools.\nManual connector selection is removed.\nSupports per-session conversation memory."},"AgentsetChatResponse":{"properties":{"content":{"type":"string","title":"Content","description":"The agent's response to the user"},"agent_steps":{"anyOf":[{"items":{"$ref":"#/components/schemas/AgentStep"},"type":"array"},{"type":"null"}],"title":"Agent Steps","description":"Sequential steps in agent's reasoning process for transparency"},"sources":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Sources","description":"Search result sources"},"evidence_sources":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Evidence Sources","description":"Evidence sources extracted from tool calls"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id","description":"Session ID for continuing conversation"},"status":{"type":"string","title":"Status","description":"Response status: success, error, etc.","default":"success"},"usage_info":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Usage Info","description":"Token usage and cost information for this request"}},"type":"object","required":["content"],"title":"AgentsetChatResponse","description":"Response from the /chat endpoint with agent transparency.\n\nIncludes:\n- content: Final response text from agent\n- agent_steps: Sequential steps showing agent's reasoning process\n- evidence_sources: Sources/evidence used by agent\n- session_id: For continuing conversation\n- status: Response status","example":{"agent_steps":[{"action_type":"thinking","step_num":1,"thinking_text":"Searching medical literature for treatment options..."},{"action_type":"tool_call","step_num":2,"tool_name":"pubmed_search","tool_query":"{\"query\": \"NSCLC immunotherapy\"}"},{"action_type":"result","result_summary":"Found 15 papers on combination immunotherapy for NSCLC","step_num":3,"tool_name":"pubmed_search"}],"content":"Based on the literature, checkpoint inhibitor combinations are effective...","session_id":"session-uuid-123","status":"success"}},"AgentsetIngestionRequest":{"properties":{"name":{"type":"string","title":"Name"},"text":{"type":"string","title":"Text"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["name","text"],"title":"AgentsetIngestionRequest"},"AgentsetIngestionResponse":{"properties":{"job_id":{"type":"string","title":"Job Id"},"status":{"type":"string","title":"Status","default":"processing"}},"type":"object","required":["job_id"],"title":"AgentsetIngestionResponse"},"AgentsetMessage":{"properties":{"role":{"type":"string","title":"Role"},"content":{"type":"string","title":"Content"}},"type":"object","required":["role","content"],"title":"AgentsetMessage"},"AgentsetSearchRequest":{"properties":{"query":{"type":"string","title":"Query"},"topK":{"type":"integer","title":"Topk","default":10},"rerank":{"type":"boolean","title":"Rerank","default":true}},"type":"object","required":["query"],"title":"AgentsetSearchRequest"},"AgentsetSearchResult":{"properties":{"id":{"type":"string","title":"Id"},"text":{"type":"string","title":"Text"},"score":{"type":"number","title":"Score"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["id","text","score"],"title":"AgentsetSearchResult"},"BiomarkerCreate":{"properties":{"biomarker_name":{"type":"string","minLength":1,"title":"Biomarker Name"},"value_numeric":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Value Numeric"},"value_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value Text"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unit"},"assay_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Assay Method"},"threshold_positive":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Threshold Positive"},"measured_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Measured At"},"patient_id":{"type":"integer","title":"Patient Id"},"modality_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Modality Id"}},"type":"object","required":["biomarker_name","patient_id"],"title":"BiomarkerCreate"},"BiomarkerOut":{"properties":{"biomarker_name":{"type":"string","minLength":1,"title":"Biomarker Name"},"value_numeric":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Value Numeric"},"value_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value Text"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unit"},"assay_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Assay Method"},"threshold_positive":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Threshold Positive"},"measured_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Measured At"},"id":{"type":"integer","title":"Id"},"patient_id":{"type":"integer","title":"Patient Id"},"modality_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Modality Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["biomarker_name","id","patient_id","created_at"],"title":"BiomarkerOut"},"Body_create_report_summary_reports__report_id__summaries_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["file"],"title":"Body_create_report_summary_reports__report_id__summaries_post"},"Body_explain_api_explain_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["file"],"title":"Body_explain_api_explain_post"},"Body_predict_api_predict_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["file"],"title":"Body_predict_api_predict_post"},"Body_transcribe_audio_voice_transcribe_post":{"properties":{"file":{"type":"string","format":"binary","title":"File","description":"Audio file to transcribe"},"language_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Language Code","description":"Language code (e.g., 'hi-IN', 'en-IN', 'unknown' for auto-detect)","default":"unknown"},"purpose":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Purpose","description":"Purpose: 'clinical_notes', 'chatbot', or 'general'","default":"general"}},"type":"object","required":["file"],"title":"Body_transcribe_audio_voice_transcribe_post"},"Body_upload_modality_modalities_upload_post":{"properties":{"patient_id":{"type":"integer","title":"Patient Id","description":"Patient identifier"},"modality_type":{"type":"string","title":"Modality Type","description":"Modality category"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"recorded_on":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Recorded On"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"priority":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Priority"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"sample_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sample Url"},"files":{"anyOf":[{"items":{"type":"string","format":"binary"},"type":"array"},{"type":"null"}],"title":"Files"}},"type":"object","required":["patient_id","modality_type"],"title":"Body_upload_modality_modalities_upload_post"},"BranchAccessGrant":{"properties":{"branch_id":{"type":"integer","title":"Branch Id"}},"type":"object","required":["branch_id"],"title":"BranchAccessGrant"},"BranchCreate":{"properties":{"name":{"type":"string","minLength":1,"title":"Name"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City"},"state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"State"},"country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"contact_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Email"},"contact_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Phone"},"settings":{"additionalProperties":true,"type":"object","title":"Settings"},"organization_id":{"type":"integer","title":"Organization Id"}},"type":"object","required":["name","organization_id"],"title":"BranchCreate"},"BranchOut":{"properties":{"name":{"type":"string","minLength":1,"title":"Name"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City"},"state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"State"},"country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"contact_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Email"},"contact_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Phone"},"settings":{"additionalProperties":true,"type":"object","title":"Settings"},"id":{"type":"integer","title":"Id"},"organization_id":{"type":"integer","title":"Organization Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["name","id","organization_id","created_at","updated_at"],"title":"BranchOut"},"ChemoEvent":{"properties":{"date":{"type":"string","title":"Date"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"}},"type":"object","required":["date"],"title":"ChemoEvent"},"ClinicalAIResponse":{"properties":{"patient_id":{"type":"integer","title":"Patient Id"},"analysis_type":{"type":"string","title":"Analysis Type"},"response":{"type":"string","title":"Response"},"citations":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Citations","default":[]},"recommendations":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Recommendations","default":[]},"clinical_trials":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Clinical Trials","default":[]},"confidence_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Confidence Notes"},"generated_at":{"type":"string","title":"Generated At"},"model":{"type":"string","title":"Model","default":"claude-sonnet-4-20250514"}},"type":"object","required":["patient_id","analysis_type","response","generated_at"],"title":"ClinicalAIResponse","description":"Standard response from clinical AI endpoints."},"ClinicalChatRequest":{"properties":{"patient_id":{"type":"integer","title":"Patient Id","description":"Patient ID for context"},"message":{"type":"string","title":"Message","description":"User question or message"},"conversation_history":{"anyOf":[{"items":{"additionalProperties":{"type":"string"},"type":"object"},"type":"array"},{"type":"null"}],"title":"Conversation History","description":"Previous messages in conversation"}},"type":"object","required":["patient_id","message"],"title":"ClinicalChatRequest","description":"Request for clinical Q&A chat."},"ClinicalContextCreate":{"properties":{"ecog_ps":{"anyOf":[{"type":"integer","maximum":5.0,"minimum":0.0},{"type":"null"}],"title":"Ecog Ps"},"weight_kg":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Weight Kg"},"height_cm":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Height Cm"},"chief_complaint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chief Complaint"},"vitals":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Vitals"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"}},"type":"object","title":"ClinicalContextCreate"},"ClinicalContextOut":{"properties":{"ecog_ps":{"anyOf":[{"type":"integer","maximum":5.0,"minimum":0.0},{"type":"null"}],"title":"Ecog Ps"},"weight_kg":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Weight Kg"},"height_cm":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Height Cm"},"chief_complaint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chief Complaint"},"vitals":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Vitals"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"id":{"type":"integer","title":"Id"},"visit_id":{"type":"integer","title":"Visit Id"},"updated_by":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Updated By"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","visit_id","created_at","updated_at"],"title":"ClinicalContextOut"},"CohortAnalysisRequest":{"properties":{"patient_id":{"type":"integer","title":"Patient Id","description":"Patient ID"},"comparison_criteria":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Comparison Criteria","description":"Specific criteria to compare (e.g., ['stage', 'biomarkers', 'treatment_response'])"}},"type":"object","required":["patient_id"],"title":"CohortAnalysisRequest","description":"Request for cohort analysis."},"DashboardStats":{"properties":{"totalPatients":{"type":"integer","title":"Totalpatients"},"totalModalities":{"type":"integer","title":"Totalmodalities"},"ursReportsGenerated":{"type":"integer","title":"Ursreportsgenerated"},"pendingActions":{"type":"integer","title":"Pendingactions"}},"type":"object","required":["totalPatients","totalModalities","ursReportsGenerated","pendingActions"],"title":"DashboardStats"},"ExpertFindingCreate":{"properties":{"title":{"type":"string","title":"Title"},"content":{"type":"string","title":"Content"}},"type":"object","required":["title","content"],"title":"ExpertFindingCreate"},"ExpertFindingOut":{"properties":{"id":{"type":"integer","title":"Id"},"author_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Author Name"},"title":{"type":"string","title":"Title"},"content":{"type":"string","title":"Content"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","title","content","created_at","updated_at"],"title":"ExpertFindingOut"},"ExplainImageSize":{"properties":{"width":{"type":"integer","title":"Width"},"height":{"type":"integer","title":"Height"}},"type":"object","required":["width","height"],"title":"ExplainImageSize"},"ExplainResponse":{"properties":{"heatmap":{"type":"string","title":"Heatmap"},"mime_type":{"type":"string","title":"Mime Type"},"prediction":{"$ref":"#/components/schemas/PredictionItem"},"probabilities":{"additionalProperties":{"type":"number"},"type":"object","title":"Probabilities"},"image":{"$ref":"#/components/schemas/ExplainImageSize"},"is_dicom":{"type":"boolean","title":"Is Dicom"}},"type":"object","required":["heatmap","mime_type","prediction","probabilities","image","is_dicom"],"title":"ExplainResponse"},"ExternalAnalysisRequest":{"properties":{"session_id":{"type":"string","title":"Session Id","description":"Session identifier for memory","default":"external_analysis"},"system_prompt":{"type":"string","title":"System Prompt","description":"System prompt dictating the exact format and goals of the analysis.","default":"You are an expert clinical AI. Analyze the provided data and return actionable treatment recommendations, medication, and prescriptions."},"patient_data":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Patient Data","description":"Structured patient demographic and medical data"},"clinical_context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Clinical Context","description":"Additional background clinical context"},"consultation_transcription":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Consultation Transcription","description":"Transcription of the doctor-patient consultation"}},"type":"object","title":"ExternalAnalysisRequest"},"FinalizeReportRequest":{"properties":{"password":{"type":"string","title":"Password"}},"type":"object","required":["password"],"title":"FinalizeReportRequest"},"FinalizeReportResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"status":{"type":"string","title":"Status"}},"type":"object","required":["success","status"],"title":"FinalizeReportResponse"},"GeminiChatRequest":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/GeminiMessage"},"type":"array","title":"Messages"},"patient_context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Context"},"temperature":{"type":"number","title":"Temperature","default":0.7},"max_tokens":{"type":"integer","title":"Max Tokens","default":2000}},"type":"object","required":["messages"],"title":"GeminiChatRequest"},"GeminiChatResponse":{"properties":{"content":{"type":"string","title":"Content"},"status":{"type":"string","title":"Status","default":"success"}},"type":"object","required":["content"],"title":"GeminiChatResponse"},"GeminiMessage":{"properties":{"role":{"type":"string","title":"Role"},"content":{"type":"string","title":"Content"}},"type":"object","required":["role","content"],"title":"GeminiMessage"},"GenerateURSResponse":{"properties":{"status":{"type":"integer","title":"Status"},"job_id":{"type":"string","title":"Job Id"},"estimated_time":{"type":"integer","title":"Estimated Time"}},"type":"object","required":["status","job_id","estimated_time"],"title":"GenerateURSResponse"},"GenomicsReportCreate":{"properties":{"panel_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Panel Name"},"status":{"type":"string","pattern":"^(pending|in_progress|completed|failed|insufficient_tissue)$","title":"Status","default":"pending"},"actionable_variants":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Actionable Variants"},"tmb":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tmb"},"msi_status":{"anyOf":[{"type":"string","pattern":"^(msi_h|mss|msi_l|unknown)$"},{"type":"null"}],"title":"Msi Status","default":"unknown"},"report_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Report Date"},"patient_id":{"type":"integer","title":"Patient Id"},"modality_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Modality Id"}},"type":"object","required":["patient_id"],"title":"GenomicsReportCreate"},"GenomicsReportOut":{"properties":{"panel_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Panel Name"},"status":{"type":"string","pattern":"^(pending|in_progress|completed|failed|insufficient_tissue)$","title":"Status","default":"pending"},"actionable_variants":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Actionable Variants"},"tmb":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tmb"},"msi_status":{"anyOf":[{"type":"string","pattern":"^(msi_h|mss|msi_l|unknown)$"},{"type":"null"}],"title":"Msi Status","default":"unknown"},"report_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Report Date"},"id":{"type":"integer","title":"Id"},"patient_id":{"type":"integer","title":"Patient Id"},"modality_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Modality Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","patient_id","created_at","updated_at"],"title":"GenomicsReportOut"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"LabPanelCreate":{"properties":{"panel_type":{"type":"string","pattern":"^(cbc|rft|lft)$","title":"Panel Type"},"measured_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Measured At"},"items":{"items":{"$ref":"#/components/schemas/LabPanelItem"},"type":"array","title":"Items"}},"type":"object","required":["panel_type","items"],"title":"LabPanelCreate"},"LabPanelItem":{"properties":{"name":{"type":"string","minLength":1,"title":"Name"},"value_numeric":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Value Numeric"},"value_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value Text"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unit"}},"type":"object","required":["name"],"title":"LabPanelItem"},"LoginRequest":{"properties":{"email":{"type":"string","title":"Email"},"password":{"type":"string","title":"Password"}},"type":"object","required":["email","password"],"title":"LoginRequest"},"LoginResponse":{"properties":{"token":{"type":"string","title":"Token"},"user":{"$ref":"#/components/schemas/UserOut"}},"type":"object","required":["token","user"],"title":"LoginResponse"},"ModalityAssetOut":{"properties":{"id":{"type":"integer","title":"Id"},"file_url":{"type":"string","title":"File Url"},"file_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Name"},"file_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Type"},"file_size":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"File Size"},"checksum":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum"},"storage_provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Storage Provider"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","file_url","file_name","file_type","file_size","checksum","storage_provider","created_at"],"title":"ModalityAssetOut"},"ModalityBreakdown":{"properties":{"name":{"type":"string","title":"Name"},"value":{"type":"integer","title":"Value"}},"type":"object","required":["name","value"],"title":"ModalityBreakdown"},"ModalityCreate":{"properties":{"patient_id":{"type":"integer","title":"Patient Id"},"patient_visit_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Patient Visit Id"},"type":{"type":"string","title":"Type"},"title":{"type":"string","title":"Title"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"report_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Report Text"},"details":{"additionalProperties":true,"type":"object","title":"Details"},"recorded_on":{"type":"string","title":"Recorded On"},"document_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Document Date"}},"type":"object","required":["patient_id","type","title","recorded_on"],"title":"ModalityCreate"},"ModalityOut":{"properties":{"id":{"type":"integer","title":"Id"},"organization_id":{"type":"integer","title":"Organization Id"},"branch_id":{"type":"integer","title":"Branch Id"},"patient_id":{"type":"integer","title":"Patient Id"},"patient_visit_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Patient Visit Id"},"type":{"type":"string","title":"Type"},"title":{"type":"string","title":"Title"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"report_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Report Text"},"details":{"additionalProperties":true,"type":"object","title":"Details"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"file_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Url"},"assets":{"items":{"$ref":"#/components/schemas/ModalityAssetOut"},"type":"array","title":"Assets"},"status":{"type":"string","title":"Status"},"document_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Document Date"},"recorded_on":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Recorded On"},"extraction_confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Extraction Confidence"},"is_final":{"type":"boolean","title":"Is Final","default":false},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"}},"type":"object","required":["id","organization_id","branch_id","patient_id","type","title","status"],"title":"ModalityOut"},"OpenAIChatRequest":{"properties":{"model":{"type":"string","title":"Model","default":"gpt-3.5-turbo"},"messages":{"items":{"$ref":"#/components/schemas/OpenAIMessage"},"type":"array","title":"Messages"},"temperature":{"type":"number","title":"Temperature","default":0.7},"max_tokens":{"type":"integer","title":"Max Tokens","default":2000}},"type":"object","required":["messages"],"title":"OpenAIChatRequest"},"OpenAIMessage":{"properties":{"role":{"type":"string","title":"Role"},"content":{"type":"string","title":"Content"}},"type":"object","required":["role","content"],"title":"OpenAIMessage"},"OrganizationCreate":{"properties":{"name":{"type":"string","minLength":1,"title":"Name"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country"},"settings":{"additionalProperties":true,"type":"object","title":"Settings"}},"type":"object","required":["name"],"title":"OrganizationCreate"},"OrganizationOut":{"properties":{"name":{"type":"string","minLength":1,"title":"Name"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country"},"settings":{"additionalProperties":true,"type":"object","title":"Settings"},"id":{"type":"integer","title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["name","id","created_at","updated_at"],"title":"OrganizationOut"},"PatientClinicalContextOut":{"properties":{"primary_diagnosis_snomed":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Primary Diagnosis Snomed"},"stage":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stage"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"id":{"type":"integer","title":"Id"},"patient_id":{"type":"integer","title":"Patient Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","patient_id","created_at","updated_at"],"title":"PatientClinicalContextOut"},"PatientCreate":{"properties":{"name":{"type":"string","minLength":1,"title":"Name"},"patient_identifier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Identifier"},"patient_identifier_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Identifier Type","default":"mrn"},"date_of_birth":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Date Of Birth"},"age_years":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Age Years"},"sex":{"anyOf":[{"type":"string","pattern":"^(M|F|Other)$"},{"type":"null"}],"title":"Sex"},"mobile":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mobile"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"diagnosis":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Diagnosis"},"primary_physician":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Primary Physician"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"branch_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Branch Id"}},"type":"object","required":["name"],"title":"PatientCreate"},"PatientDetailOut":{"properties":{"name":{"type":"string","minLength":1,"title":"Name"},"patient_identifier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Identifier"},"patient_identifier_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Identifier Type","default":"mrn"},"date_of_birth":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Date Of Birth"},"age_years":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Age Years"},"sex":{"anyOf":[{"type":"string","pattern":"^(M|F|Other)$"},{"type":"null"}],"title":"Sex"},"mobile":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mobile"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"diagnosis":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Diagnosis"},"primary_physician":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Primary Physician"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"id":{"type":"integer","title":"Id"},"organization_id":{"type":"integer","title":"Organization Id"},"branch_id":{"type":"integer","title":"Branch Id"},"last_visit_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Visit At"},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At"},"severity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Severity","description":"critical|high|normal|unknown"},"severity_rank":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Severity Rank"},"severity_score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Severity Score"},"modalities":{"additionalProperties":{"items":{"$ref":"#/components/schemas/ModalityOut"},"type":"array"},"type":"object","title":"Modalities"},"visits":{"items":{"$ref":"#/components/schemas/PatientVisitOut"},"type":"array","title":"Visits"},"clinical_context":{"anyOf":[{"$ref":"#/components/schemas/PatientClinicalContextOut"},{"type":"null"}]}},"type":"object","required":["name","id","organization_id","branch_id"],"title":"PatientDetailOut"},"PatientOut":{"properties":{"name":{"type":"string","minLength":1,"title":"Name"},"patient_identifier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Identifier"},"patient_identifier_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Identifier Type","default":"mrn"},"date_of_birth":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Date Of Birth"},"age_years":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Age Years"},"sex":{"anyOf":[{"type":"string","pattern":"^(M|F|Other)$"},{"type":"null"}],"title":"Sex"},"mobile":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mobile"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"diagnosis":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Diagnosis"},"primary_physician":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Primary Physician"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"id":{"type":"integer","title":"Id"},"organization_id":{"type":"integer","title":"Organization Id"},"branch_id":{"type":"integer","title":"Branch Id"},"last_visit_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Visit At"},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At"},"severity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Severity","description":"critical|high|normal|unknown"},"severity_rank":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Severity Rank"},"severity_score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Severity Score"}},"type":"object","required":["name","id","organization_id","branch_id"],"title":"PatientOut"},"PatientTransfer":{"properties":{"new_branch_id":{"type":"integer","title":"New Branch Id"}},"type":"object","required":["new_branch_id"],"title":"PatientTransfer"},"PatientTrendsResponse":{"properties":{"tumor_size":{"items":{"$ref":"#/components/schemas/TrendPoint"},"type":"array","title":"Tumor Size"},"cbc":{"items":{"$ref":"#/components/schemas/TrendSeries"},"type":"array","title":"Cbc"},"rft":{"items":{"$ref":"#/components/schemas/TrendSeries"},"type":"array","title":"Rft"},"lft":{"items":{"$ref":"#/components/schemas/TrendSeries"},"type":"array","title":"Lft"},"chemo_events":{"items":{"$ref":"#/components/schemas/ChemoEvent"},"type":"array","title":"Chemo Events"}},"type":"object","required":["tumor_size","cbc","rft","lft","chemo_events"],"title":"PatientTrendsResponse"},"PatientVisitCreate":{"properties":{"visit_date":{"type":"string","format":"date","title":"Visit Date"},"visit_type":{"type":"string","pattern":"^(initial_dx|followup|review|treatment|mdt)$","title":"Visit Type"},"clinical_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Clinical Notes"},"ecog_score":{"anyOf":[{"type":"integer","maximum":5.0,"minimum":0.0},{"type":"null"}],"title":"Ecog Score"},"weight_kg":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Weight Kg"},"height_cm":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Height Cm"},"comorbidities":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Comorbidities"},"patient_id":{"type":"integer","title":"Patient Id"},"clinician_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Clinician Id"}},"type":"object","required":["visit_date","visit_type","patient_id"],"title":"PatientVisitCreate"},"PatientVisitOut":{"properties":{"visit_date":{"type":"string","format":"date","title":"Visit Date"},"visit_type":{"type":"string","pattern":"^(initial_dx|followup|review|treatment|mdt)$","title":"Visit Type"},"clinical_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Clinical Notes"},"ecog_score":{"anyOf":[{"type":"integer","maximum":5.0,"minimum":0.0},{"type":"null"}],"title":"Ecog Score"},"weight_kg":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Weight Kg"},"height_cm":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Height Cm"},"comorbidities":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Comorbidities"},"id":{"type":"integer","title":"Id"},"patient_id":{"type":"integer","title":"Patient Id"},"clinician_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Clinician Id"},"clinician_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Clinician Name"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["visit_date","visit_type","id","patient_id","created_at","updated_at"],"title":"PatientVisitOut"},"PatientVisitUpdate":{"properties":{"visit_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Visit Date"},"visit_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Visit Type"},"clinical_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Clinical Notes"},"ecog_score":{"anyOf":[{"type":"integer","maximum":5.0,"minimum":0.0},{"type":"null"}],"title":"Ecog Score"},"weight_kg":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Weight Kg"},"height_cm":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Height Cm"},"comorbidities":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Comorbidities"}},"type":"object","title":"PatientVisitUpdate"},"PredictionItem":{"properties":{"index":{"type":"integer","title":"Index"},"label":{"type":"string","title":"Label"},"probability":{"type":"number","title":"Probability"}},"type":"object","required":["index","label","probability"],"title":"PredictionItem"},"PredictionResponse":{"properties":{"predictions":{"items":{"$ref":"#/components/schemas/PredictionItem"},"type":"array","title":"Predictions"},"probabilities":{"additionalProperties":{"type":"number"},"type":"object","title":"Probabilities"}},"type":"object","required":["predictions","probabilities"],"title":"PredictionResponse"},"RecentActivity":{"properties":{"id":{"type":"integer","title":"Id"},"type":{"type":"string","title":"Type"},"patient":{"type":"string","title":"Patient"},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"}},"type":"object","required":["id","type","patient","timestamp"],"title":"RecentActivity"},"ReportOut":{"properties":{"id":{"type":"integer","title":"Id"},"organization_id":{"type":"integer","title":"Organization Id"},"patient_id":{"type":"integer","title":"Patient Id"},"version":{"type":"integer","title":"Version"},"status":{"type":"string","title":"Status"},"content":{"additionalProperties":true,"type":"object","title":"Content"},"markdown":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Markdown"},"trace_references":{"additionalProperties":true,"type":"object","title":"Trace References"},"trace_metadata":{"additionalProperties":true,"type":"object","title":"Trace Metadata"},"summary":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Summary"},"conflicts":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Conflicts"},"layout":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Layout"},"sections":{"anyOf":[{"items":{"$ref":"#/components/schemas/ReportSectionOut"},"type":"array"},{"type":"null"}],"title":"Sections","default":[]},"expert_findings":{"anyOf":[{"items":{"$ref":"#/components/schemas/ExpertFindingOut"},"type":"array"},{"type":"null"}],"title":"Expert Findings","default":[]},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"published_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Published At"}},"type":"object","required":["id","organization_id","patient_id","version","status","content","trace_references","trace_metadata","conflicts","created_at","updated_at"],"title":"ReportOut"},"ReportSectionOut":{"properties":{"id":{"type":"integer","title":"Id"},"section_key":{"type":"string","title":"Section Key"},"title":{"type":"string","title":"Title"},"body":{"additionalProperties":true,"type":"object","title":"Body"},"order_index":{"type":"integer","title":"Order Index"}},"type":"object","required":["id","section_key","title","body","order_index"],"title":"ReportSectionOut"},"ReportSummaryRequest":{"properties":{"modality_id":{"type":"integer","title":"Modality Id","description":"Modality ID to summarize"},"summary_focus":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary Focus","description":"Focus area for summary (e.g., 'actionable findings', 'tumor progression')"}},"type":"object","required":["modality_id"],"title":"ReportSummaryRequest","description":"Request for AI report summary."},"ReportSummaryResponse":{"properties":{"text":{"type":"string","title":"Text"},"highlights":{"items":{"type":"string"},"type":"array","title":"Highlights"},"model":{"type":"string","title":"Model"},"generated_at":{"type":"string","format":"date-time","title":"Generated At"},"word_count":{"type":"integer","title":"Word Count"},"source":{"type":"string","title":"Source"},"reference":{"additionalProperties":true,"type":"object","title":"Reference"}},"type":"object","required":["text","highlights","model","generated_at","word_count","source","reference"],"title":"ReportSummaryResponse"},"SummarizeRequest":{"properties":{"modality_id":{"type":"integer","title":"Modality Id"}},"type":"object","required":["modality_id"],"title":"SummarizeRequest"},"SummarizeResponse":{"properties":{"status":{"type":"integer","title":"Status"},"job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Id"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"modality_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Modality Id"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"trace_references":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Trace References"}},"type":"object","required":["status"],"title":"SummarizeResponse"},"TreatmentRecommendationRequest":{"properties":{"patient_id":{"type":"integer","title":"Patient Id","description":"Patient ID"},"specific_question":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Specific Question","description":"Specific question to focus on (optional)"},"include_trials":{"type":"boolean","title":"Include Trials","description":"Include clinical trial matches","default":true},"include_literature":{"type":"boolean","title":"Include Literature","description":"Include PubMed literature","default":true}},"type":"object","required":["patient_id"],"title":"TreatmentRecommendationRequest","description":"Request for treatment recommendations.","example":{"include_literature":true,"include_trials":true,"patient_id":123,"specific_question":"What targeted therapies are available for this patient's KRAS G12C mutation?"}},"TrendPoint":{"properties":{"date":{"type":"string","title":"Date"},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Value"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"}},"type":"object","required":["date"],"title":"TrendPoint"},"TrendSeries":{"properties":{"name":{"type":"string","title":"Name"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unit"},"points":{"items":{"$ref":"#/components/schemas/TrendPoint"},"type":"array","title":"Points"}},"type":"object","required":["name","points"],"title":"TrendSeries"},"TumorCreate":{"properties":{"organ":{"type":"string","minLength":1,"title":"Organ"},"location_description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location Description"},"radiology_size_mm":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Radiology Size Mm"},"pathologic_size_mm":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Pathologic Size Mm"},"current_size_mm":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Current Size Mm"},"ajcc_t_category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ajcc T Category"},"growth_rate_mm_per_month":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Growth Rate Mm Per Month"},"doubling_time_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Doubling Time Days"},"is_active":{"type":"boolean","title":"Is Active","default":true},"patient_id":{"type":"integer","title":"Patient Id"}},"type":"object","required":["organ","patient_id"],"title":"TumorCreate"},"TumorMeasurementCreate":{"properties":{"organ":{"type":"string","title":"Organ"},"location_description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location Description"},"measurement_mm":{"type":"number","title":"Measurement Mm"},"measurement_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Measurement Method"},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Confidence"},"observer_type":{"anyOf":[{"type":"string","pattern":"^(radiologist|pathologist|ai_inference|manual_entry)$"},{"type":"null"}],"title":"Observer Type"},"measured_at":{"type":"string","format":"date-time","title":"Measured At"},"is_canonical":{"type":"boolean","title":"Is Canonical","default":false},"conflict_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conflict Notes"},"patient_id":{"type":"integer","title":"Patient Id"},"canonical_tumor_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Canonical Tumor Id"},"modality_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Modality Id"}},"type":"object","required":["organ","measurement_mm","measured_at","patient_id"],"title":"TumorMeasurementCreate"},"TumorMeasurementOut":{"properties":{"organ":{"type":"string","title":"Organ"},"location_description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location Description"},"measurement_mm":{"type":"number","title":"Measurement Mm"},"measurement_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Measurement Method"},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Confidence"},"observer_type":{"anyOf":[{"type":"string","pattern":"^(radiologist|pathologist|ai_inference|manual_entry)$"},{"type":"null"}],"title":"Observer Type"},"measured_at":{"type":"string","format":"date-time","title":"Measured At"},"is_canonical":{"type":"boolean","title":"Is Canonical","default":false},"conflict_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conflict Notes"},"id":{"type":"integer","title":"Id"},"patient_id":{"type":"integer","title":"Patient Id"},"canonical_tumor_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Canonical Tumor Id"},"modality_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Modality Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["organ","measurement_mm","measured_at","id","patient_id","created_at"],"title":"TumorMeasurementOut"},"TumorOut":{"properties":{"organ":{"type":"string","minLength":1,"title":"Organ"},"location_description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location Description"},"radiology_size_mm":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Radiology Size Mm"},"pathologic_size_mm":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Pathologic Size Mm"},"current_size_mm":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Current Size Mm"},"ajcc_t_category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ajcc T Category"},"growth_rate_mm_per_month":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Growth Rate Mm Per Month"},"doubling_time_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Doubling Time Days"},"is_active":{"type":"boolean","title":"Is Active","default":true},"id":{"type":"integer","title":"Id"},"patient_id":{"type":"integer","title":"Patient Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["organ","id","patient_id","created_at","updated_at"],"title":"TumorOut"},"UserBranchAccessOut":{"properties":{"id":{"type":"integer","title":"Id"},"user_id":{"type":"integer","title":"User Id"},"branch_id":{"type":"integer","title":"Branch Id"},"branch_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Branch Name"},"granted_at":{"type":"string","format":"date-time","title":"Granted At"}},"type":"object","required":["id","user_id","branch_id","granted_at"],"title":"UserBranchAccessOut"},"UserCreate":{"properties":{"full_name":{"type":"string","title":"Full Name"},"email":{"type":"string","title":"Email"},"role":{"type":"string","title":"Role"},"branch_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Branch Id"},"specialty":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Specialty"},"nmc_registration":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Nmc Registration"}},"type":"object","required":["full_name","email","role"],"title":"UserCreate"},"UserOut":{"properties":{"id":{"type":"integer","title":"Id"},"organization_id":{"type":"integer","title":"Organization Id"},"branch_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Branch Id"},"full_name":{"type":"string","title":"Full Name"},"email":{"type":"string","title":"Email"},"role":{"type":"string","title":"Role"},"specialty":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Specialty"},"nmc_registration":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Nmc Registration"},"is_active":{"type":"boolean","title":"Is Active"},"mfa_enabled":{"type":"boolean","title":"Mfa Enabled"},"last_login_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Login At"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","organization_id","full_name","email","role","is_active","mfa_enabled","created_at"],"title":"UserOut"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}}}