TEA's follow-up list by step, case and EEG result, with its filters and $eeg-summary; a list from a start day
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"""TEA's FHIR operations over its follow-up list: `$eeg-summary`, the EEGs of the children
|
||||
the list holds (with its filters; its whole history when no window or start is asked)."""
|
||||
|
||||
from datetime import date
|
||||
|
||||
from fastapi import APIRouter, Query, Request
|
||||
from fastapi.responses import Response
|
||||
|
||||
from core.domains import Domain
|
||||
from core.tea import fhir as tea_fhir
|
||||
from core.tea import follow_up
|
||||
from webapi.fhir import _OK, _cutoff, _listed, fhir
|
||||
|
||||
router = APIRouter(prefix="/tea/fhir/Patient", tags=["fhir"])
|
||||
|
||||
|
||||
@router.get("/$eeg-summary", responses=_OK, response_class=Response)
|
||||
def eeg_summary(
|
||||
request: Request,
|
||||
window: int | None = Query(None, alias="follow-up-window", description="months"),
|
||||
start: date | None = Query(None, alias="follow-up-start"),
|
||||
cutoff: date | None = Query(None, alias="follow-up-cutoff"),
|
||||
) -> Response:
|
||||
at = _cutoff(Domain.TEA, cutoff)
|
||||
rows, _ = _listed(request, Domain.TEA, at, window, start, at)
|
||||
return fhir(tea_fhir.eeg_summary(follow_up.summary(rows)))
|
||||
Reference in New Issue
Block a user