{"openapi":"3.1.0","info":{"title":"Pathology Hub Chat MVP","version":"0.1.0"},"paths":{"/research/api/capture/{operation}":{"get":{"summary":"Forward","operationId":"forward_research_api_capture__operation__get","parameters":[{"name":"operation","in":"path","required":true,"schema":{"type":"string","title":"Operation"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Forward","operationId":"forward_research_api_capture__operation__get","parameters":[{"name":"operation","in":"path","required":true,"schema":{"type":"string","title":"Operation"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/":{"get":{"summary":"Index","description":"Serve index.html with a live content-hash cache-buster on the\napp.js/style.css URLs so a deploy is never masked by a stale browser\nor proxy cache (see _static_asset_version). The HTML itself is tiny and\nmarked no-cache so this substitution is always fresh.","operationId":"index__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/saved_manuals":{"get":{"summary":"Api Saved Manuals","description":"Read the saved manual library without invoking evidence services or models.","operationId":"api_saved_manuals_api_saved_manuals_get","parameters":[{"name":"query","in":"query","required":false,"schema":{"type":"string","default":"","title":"Query"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/topic_prebuild":{"get":{"summary":"Api Topic Prebuild","description":"Read-only lookup of a cached topic_page sidecar by tag, if one exists\n(local pilot/write-through cache, then GCS — see _lookup_prebuild_page).\n\nNever mutates the figure quality-flags sidecar or curriculum SQLite.\nReturns {\"ok\": False, \"found\": False} (HTTP 200, not an error) when\nnothing is cached yet for `tag`, so the client falls back to the live\nPOST /api/chat topic_page path unchanged.","operationId":"api_topic_prebuild_api_topic_prebuild_get","parameters":[{"name":"tag","in":"query","required":true,"schema":{"type":"string","title":"Tag"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/health":{"get":{"summary":"Api Health","operationId":"api_health_api_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/study":{"get":{"summary":"Study Information","operationId":"study_information_study_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/api/study/config":{"get":{"summary":"Api Study Config","operationId":"api_study_config_api_study_config_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/research/feedback":{"post":{"summary":"Research Unavailable","operationId":"research_unavailable_api_research_feedback_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/research/consent":{"post":{"summary":"Research Unavailable","operationId":"research_unavailable_api_research_consent_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/research/events":{"post":{"summary":"Research Unavailable","operationId":"research_unavailable_api_research_events_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/tutor/config":{"get":{"summary":"Api Tutor Config","operationId":"api_tutor_config_api_tutor_config_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/tutor":{"post":{"summary":"Api Tutor","operationId":"api_tutor_api_tutor_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TutorRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tutor/stream":{"post":{"summary":"Api Tutor Stream","description":"Send actual writing/reference stages while retaining the checked final answer.","operationId":"api_tutor_stream_api_tutor_stream_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TutorRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/search":{"post":{"summary":"Api Search","description":"Search-only: raw evidence, no OpenAI call.","operationId":"api_search_api_search_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/chat":{"post":{"summary":"Api Chat","operationId":"api_chat_api_chat_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/chat/stream":{"post":{"summary":"Api Chat Stream","description":"SSE stream of topic-page (or any mode) progress + final result.\n\nReal round-by-round progress for iterative topic retrieval:\n  event: progress  — plan / round / literature / synthesize status\n  event: result    — same JSON shape as POST /api/chat\n  event: error     — {ok:false, error:...}\n\nNon-topic modes still stream a short progress line then a single result\nso the client can use one code path.","operationId":"api_chat_stream_api_chat_stream_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/flag":{"post":{"summary":"Api Flag","description":"Retired unsafe local sink; neither comments nor query text are retained.","operationId":"api_flag_api_flag_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlagRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/topic_review":{"post":{"summary":"Api Topic Review","description":"Advisory 'fake pathologist' critique — does not rewrite the page.\n\nUsed for prebuild QA / optional live review. Verdict is not a publish gate.","operationId":"api_topic_review_api_topic_review_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TopicReviewRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/compare":{"post":{"summary":"Api Compare","description":"Compare 2–4 diagnoses: per-entity retrieval + one grounded synthesis.\n\nReported (2026-08-02): with the upstream pathology-hub-v04 backend down,\ncomparing 3-4 entities fanned out into enough sequential per-entity,\nmulti-query-variant retrieval calls (each up to DEFAULT_TIMEOUT_SECONDS)\nto exceed Cloud Run's own request timeout before this endpoint ever got\na chance to return its own error — Cloud Run's proxy layer then returned\na plain-text \"upstream request timeout\" body, which the frontend's\n`resp.json()` choked on (surfaced as a raw SyntaxError, not a real\nerror message). A single fast preflight health check fails this\nimmediately with a real JSON error instead of silently trying (and\neventually exceeding the outer timeout on) every entity.","operationId":"api_compare_api_compare_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompareRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/openai_ping":{"get":{"summary":"Api Openai Ping","operationId":"api_openai_ping_api_openai_ping_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/medical-renal/assets/{asset_id}":{"head":{"summary":"Renal Asset","operationId":"renal_asset_api_medical_renal_assets__asset_id__head","parameters":[{"name":"asset_id","in":"path","required":true,"schema":{"type":"string","title":"Asset Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"summary":"Renal Asset","operationId":"renal_asset_api_medical_renal_assets__asset_id__head","parameters":[{"name":"asset_id","in":"path","required":true,"schema":{"type":"string","title":"Asset Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/medical-renal/reader/{slug}/{book}":{"get":{"summary":"Renal Reader","operationId":"renal_reader_api_medical_renal_reader__slug___book__get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}},{"name":"book","in":"path","required":true,"schema":{"type":"string","title":"Book"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"ChatRequest":{"properties":{"query":{"type":"string","title":"Query"},"sources":{"items":{"type":"string"},"type":"array","title":"Sources"},"max_results":{"type":"integer","maximum":10.0,"minimum":1.0,"title":"Max Results","default":3},"include_figures":{"type":"boolean","title":"Include Figures","default":false},"max_figures":{"type":"integer","maximum":10.0,"minimum":0.0,"title":"Max Figures","default":0},"compact":{"type":"boolean","title":"Compact","default":true},"excerpt_char_limit":{"type":"integer","maximum":4000.0,"minimum":200.0,"title":"Excerpt Char Limit","default":900},"render_html":{"type":"boolean","title":"Render Html","default":false},"mode":{"type":"string","title":"Mode","default":"auto"},"category_context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Context"},"page_tag":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Tag"},"browse_root":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Browse Root"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"}},"type":"object","required":["query"],"title":"ChatRequest"},"CompareEntity":{"properties":{"tag":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tag"},"label":{"type":"string","title":"Label"},"query":{"type":"string","title":"Query"},"category_context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Context"}},"type":"object","required":["label","query"],"title":"CompareEntity"},"CompareRequest":{"properties":{"entities":{"items":{"$ref":"#/components/schemas/CompareEntity"},"type":"array","maxItems":4,"minItems":2,"title":"Entities"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"}},"type":"object","required":["entities"],"title":"CompareRequest"},"FlagRequest":{"properties":{"tag":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tag"},"label":{"type":"string","title":"Label","default":""},"query":{"type":"string","title":"Query","default":""},"comment":{"type":"string","title":"Comment","default":""},"page_kind":{"type":"string","title":"Page Kind","default":"topic_page"}},"type":"object","title":"FlagRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"SearchRequest":{"properties":{"query":{"type":"string","title":"Query"},"sources":{"items":{"type":"string"},"type":"array","title":"Sources"},"max_results":{"type":"integer","maximum":10.0,"minimum":1.0,"title":"Max Results","default":3},"include_figures":{"type":"boolean","title":"Include Figures","default":false},"max_figures":{"type":"integer","maximum":10.0,"minimum":0.0,"title":"Max Figures","default":0},"compact":{"type":"boolean","title":"Compact","default":true},"excerpt_char_limit":{"type":"integer","maximum":4000.0,"minimum":200.0,"title":"Excerpt Char Limit","default":900},"render_html":{"type":"boolean","title":"Render Html","default":false}},"type":"object","required":["query"],"title":"SearchRequest"},"TopicReviewRequest":{"properties":{"label":{"type":"string","title":"Label","default":""},"query":{"type":"string","title":"Query","default":""},"tag":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tag"},"answer_markdown":{"type":"string","title":"Answer Markdown"},"cards":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Cards"},"figures":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Figures"}},"type":"object","required":["answer_markdown"],"title":"TopicReviewRequest","description":"Advisory pathologist-style critique of an already-built topic page."},"TutorContext":{"properties":{"topic":{"type":"string","maxLength":500,"title":"Topic","default":""},"root":{"type":"string","maxLength":100,"title":"Root","default":""},"specimen":{"type":"string","maxLength":100,"title":"Specimen","default":""}},"additionalProperties":false,"type":"object","title":"TutorContext"},"TutorRequest":{"properties":{"query":{"type":"string","maxLength":2000,"title":"Query","default":""},"session_token":{"anyOf":[{"type":"string","maxLength":200000},{"type":"null"}],"title":"Session Token"},"mode":{"type":"string","enum":["auto","reference","differential","workup","teach","quiz","explain"],"title":"Mode","default":"auto"},"context":{"$ref":"#/components/schemas/TutorContext"},"reset":{"type":"boolean","title":"Reset","default":false},"evidence_scope":{"type":"string","enum":["saved","live"],"title":"Evidence Scope","default":"live"}},"additionalProperties":false,"type":"object","title":"TutorRequest"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}