Files
WebApi/webapi/main.py
Angel Capetillo Zavala 4934f99c1d CaCu exports: PDF and XLSX of the complete query and of the patient record
The PDF uses the institutional header, footer and tables with Roboto and the logo, five
stage nodes per row with a detail annex, and segmented risk scales. Excel keeps literal
text and a parameters sheet. Limits are 1000 rows for PDF and 5000 for Excel.
2026-11-27 18:42:48 -06:00

40 lines
1.2 KiB
Python

from fastapi import Depends, FastAPI, Request
from fastapi.exception_handlers import http_exception_handler
from starlette.exceptions import HTTPException
from core.domains import Domain
from webapi import eeg, exports, fhir, ingest, models, review, runs
from webapi.auth import caller
app = FastAPI(
title="ISSSTELEON",
version="0.0.0",
dependencies=[Depends(caller)], # every route; where authentication will go
generate_unique_id_function=lambda route: route.name, # clean names in the generated client
)
app.include_router(ingest.router)
app.include_router(review.router)
app.include_router(runs.router)
app.include_router(models.router)
app.include_router(eeg.router)
app.include_router(exports.router)
app.include_router(fhir.router)
@app.exception_handler(HTTPException)
async def errors(request: Request, error: HTTPException):
"""FHIR routes answer errors as an OperationOutcome."""
if "/fhir/" in request.url.path or request.url.path.endswith("/fhir"):
return fhir.outcome(error.status_code, str(error.detail))
return await http_exception_handler(request, error)
@app.get("/health")
def health() -> dict[str, str]:
return {"status": "ok"}
@app.get("/domains")
def domains() -> list[Domain]:
return list(Domain)