f26d32a010
- main.py: both routers sets (execution, preview from tea/parity; sources, users from
rebuild).
- runs.py: tea/parity's cancel, history and execution config; rebuild's /terminate is the
same action and is not kept twice.
- eeg.py: tea/parity's (the record reads per-child FHIR resources, not rebuild's EEG
detail with zones and relation).
- fhir.py: tea/parity's patient rows with TEA filters, plus rebuild's name/identifier
search applied to whatever rows the request selects.
- models.py: tea/parity's endpoints; /models/{domain} returns rebuild's name + title.
- tests: P7 deletions kept (test_cacu, test_cama, test_conectar, test_synthea*, test_tea);
test_webapp keeps tea/parity's runner, now with the first administrator (sign-in).
44 lines
1.5 KiB
Python
44 lines
1.5 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, execution, fhir, ingest, models, preview, review, runs, sources, users
|
|
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
|
|
lifespan=users.lifespan,
|
|
)
|
|
app.include_router(ingest.router)
|
|
app.include_router(sources.router)
|
|
app.include_router(review.router)
|
|
app.include_router(runs.router)
|
|
app.include_router(execution.router)
|
|
app.include_router(models.router)
|
|
app.include_router(eeg.router)
|
|
app.include_router(preview.router)
|
|
app.include_router(fhir.router)
|
|
app.include_router(users.router) # sign-in for the web app; no route requires it
|
|
|
|
|
|
@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)
|