ISSSTELEON WebApi
This commit is contained in:
+552
@@ -0,0 +1,552 @@
|
||||
import unicodedata
|
||||
from datetime import date, datetime
|
||||
from typing import Annotated, Any
|
||||
from dagster_graphql import DagsterGraphQLClient
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, Query, Request
|
||||
from fastapi.responses import Response
|
||||
from fhir.resources.R4B.bundle import Bundle
|
||||
from fhir.resources.R4B.capabilitystatement import CapabilityStatement
|
||||
from fhir.resources.R4B.operationoutcome import OperationOutcome
|
||||
from fhir.resources.R4B.resource import Resource
|
||||
from core import catalog
|
||||
from core import fhir as f
|
||||
from core import measures as m
|
||||
from core.domains import Domain, measures, part
|
||||
from core.follow_up import window_start
|
||||
from core.pipeline import ID_PATTERN
|
||||
from persistance import config_log, readers
|
||||
from persistance import fhir as reads
|
||||
from persistance import measures as measure_reads
|
||||
from webapi.ingest import submit
|
||||
from webapi.runs import dagster
|
||||
|
||||
FHIR_JSON = "application/fhir+json"
|
||||
PAGE, MAX_PAGE = (50, 200)
|
||||
REVINCLUDES = ("DiagnosticReport:subject", "RiskAssessment:subject", "Observation:subject")
|
||||
router = APIRouter(prefix="/{domain}/fhir", tags=["fhir"])
|
||||
_OK = {200: {"content": {FHIR_JSON: {"schema": {"type": "object"}}}, "description": "FHIR"}}
|
||||
|
||||
|
||||
def fhir(resource: Resource) -> Response:
|
||||
return Response(resource.model_dump_json(exclude_none=True), media_type=FHIR_JSON)
|
||||
|
||||
|
||||
def outcome(status: int, text: str) -> Response:
|
||||
issue = {
|
||||
"severity": "error",
|
||||
"code": "not-found" if status == 404 else "invalid",
|
||||
"diagnostics": text,
|
||||
}
|
||||
return Response(
|
||||
OperationOutcome(issue=[issue]).model_dump_json(exclude_none=True),
|
||||
status_code=status,
|
||||
media_type=FHIR_JSON,
|
||||
)
|
||||
|
||||
|
||||
def _clinical(domain: Domain):
|
||||
if (found := part(domain, "follow_up")) is None:
|
||||
raise HTTPException(404, f"no clinical resources for {domain.value} yet")
|
||||
return found
|
||||
|
||||
|
||||
def _cutoff(domain: Domain, asked: date | None) -> date:
|
||||
if asked is not None:
|
||||
return asked
|
||||
return reads.last_data_day(domain.value) or date.today()
|
||||
|
||||
|
||||
def _page(count: int | None, offset: int) -> tuple[int, int]:
|
||||
count = PAGE if count is None else count
|
||||
if not 0 <= count <= MAX_PAGE or offset < 0:
|
||||
raise HTTPException(422, f"_count goes from 0 to {MAX_PAGE}; _offset from 0")
|
||||
return (count, offset)
|
||||
|
||||
|
||||
def bundle(
|
||||
request: Request,
|
||||
matches: list[Resource],
|
||||
total: int,
|
||||
count: int,
|
||||
offset: int,
|
||||
included: list[Resource] = (),
|
||||
applied: dict | None = None,
|
||||
) -> Response:
|
||||
base = str(request.base_url).rstrip("/") + request.url.path.rsplit("/", 1)[0]
|
||||
|
||||
def link(relation: str, at: int) -> dict:
|
||||
url = request.url.include_query_params(**applied or {}, _offset=at, _count=count)
|
||||
return {"relation": relation, "url": str(url)}
|
||||
|
||||
links = [link("self", offset)]
|
||||
if offset + count < total:
|
||||
links.append(link("next", offset + count))
|
||||
if offset > 0:
|
||||
links.append(link("previous", max(offset - count, 0)))
|
||||
groups = (("match", matches), ("include", included))
|
||||
entries = [
|
||||
{
|
||||
"fullUrl": f"{base}/{r.get_resource_type()}/{r.id}",
|
||||
"resource": r,
|
||||
"search": {"mode": mode},
|
||||
}
|
||||
for mode, group in groups
|
||||
for r in group
|
||||
]
|
||||
found = Bundle(type="searchset", total=total, link=links, entry=entries or None)
|
||||
return fhir(found)
|
||||
|
||||
|
||||
def _sliced(found: list, count: int, offset: int) -> list:
|
||||
return found[offset : offset + count]
|
||||
|
||||
|
||||
@router.get("/Patient/{id}", responses=_OK, response_class=Response)
|
||||
def read_patient(domain: Domain, id: str) -> Response:
|
||||
fu = _clinical(domain)
|
||||
(row,) = reads.rows(domain.value, "person", id=id) or [None]
|
||||
if row is None:
|
||||
(link,) = reads.rows(domain.value, "replaced", id=id) or [None]
|
||||
if link is None:
|
||||
raise HTTPException(404, f"no Patient/{id}")
|
||||
return fhir(f.replaced_patient(id, link["replaced_by"]))
|
||||
status = fu.status(row, _cutoff(domain, None))
|
||||
(found,) = _with_identity(domain, [{**row, "status": status}])
|
||||
return fhir(f.patient(found, fu.STATUS_SYSTEM))
|
||||
|
||||
|
||||
def _with_identity(domain: Domain, rows: list[dict]) -> list[dict]:
|
||||
persons = [r["person_id"] for r in rows]
|
||||
names, ids, replaces = ({}, {}, {})
|
||||
for r in reads.rows(domain.value, "names", persons=persons):
|
||||
names.setdefault(r["person_id"], []).append(r["text"])
|
||||
for r in reads.rows(domain.value, "identifiers", persons=persons):
|
||||
ids.setdefault(r["person_id"], []).append((r["system"], r["value"]))
|
||||
for r in reads.rows(domain.value, "replaces", persons=persons):
|
||||
replaces.setdefault(r["replaced_by"], []).append(r["person_id"])
|
||||
return [
|
||||
{
|
||||
**r,
|
||||
"names": names.get(p, []),
|
||||
"identifiers": ids.get(p, []),
|
||||
"replaces": replaces.get(p, []),
|
||||
}
|
||||
for r in rows
|
||||
if (p := r["person_id"])
|
||||
]
|
||||
|
||||
|
||||
def _folded(text: str) -> str:
|
||||
return "".join(
|
||||
(c for c in unicodedata.normalize("NFKD", text.casefold()) if not unicodedata.combining(c))
|
||||
)
|
||||
|
||||
|
||||
def _matches(row: dict, name: str | None, identifier: str | None) -> bool:
|
||||
if name:
|
||||
words = _folded(name).split()
|
||||
if not any(
|
||||
(
|
||||
all((any((w.startswith(q) for w in _folded(n).split())) for q in words))
|
||||
for n in row["names"]
|
||||
)
|
||||
):
|
||||
return False
|
||||
if identifier:
|
||||
system, _, value = identifier.rpartition("|")
|
||||
if not any(
|
||||
(
|
||||
(not system or s == system) and v.casefold() == value.strip().casefold()
|
||||
for s, v in row["identifiers"]
|
||||
)
|
||||
):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
@router.get("/Patient", responses=_OK, response_class=Response)
|
||||
def search_patient(
|
||||
request: Request,
|
||||
domain: Domain,
|
||||
_id: str | None = Query(None, alias="_id"),
|
||||
window: int | None = Query(
|
||||
None,
|
||||
alias="follow-up-window",
|
||||
description="months: the domain's follow-up list over that window up to the cut-off",
|
||||
),
|
||||
cutoff: date | None = Query(
|
||||
None, alias="follow-up-cutoff", description="default: the last day with data"
|
||||
),
|
||||
status: str | None = Query(None, alias="follow-up-status"),
|
||||
name: str | None = Query(
|
||||
None, description="each word starts a word of her name (case and accents ignored)"
|
||||
),
|
||||
identifier: str | None = Query(
|
||||
None, description="[system|]value: a CURP or record number (case ignored)"
|
||||
),
|
||||
sort: str = Query("-recent", alias="_sort", description="-recent or -risk-<outcome>"),
|
||||
horizon: float | None = Query(None, alias="risk-horizon", description="years"),
|
||||
revinclude: list[str] = Query([], alias="_revinclude", description=f"any of {REVINCLUDES}"),
|
||||
include: list[str] = Query([], alias="_include:iterate", description="DiagnosticReport:result"),
|
||||
_count: int | None = Query(None),
|
||||
_offset: int = Query(0),
|
||||
) -> Response:
|
||||
fu = _clinical(domain)
|
||||
count, offset = _page(_count, _offset)
|
||||
at = _cutoff(domain, cutoff)
|
||||
horizon = fu.DEFAULT_HORIZON if horizon is None else horizon
|
||||
persons_rows = reads.rows(domain.value, "persons")
|
||||
if window is None:
|
||||
rows = [{**r, "status": fu.status(r, at)} for r in persons_rows]
|
||||
else:
|
||||
if window not in fu.WINDOWS:
|
||||
raise HTTPException(422, f"follow-up-window is one of {fu.WINDOWS}")
|
||||
if sort not in fu.SORTS:
|
||||
raise HTTPException(422, f"_sort is one of {fu.SORTS}")
|
||||
start = window_start(at, window)
|
||||
params = {"start": start.isoformat(), "cutoff": at.isoformat()}
|
||||
person = {r["person_id"]: r for r in persons_rows}
|
||||
rows = [
|
||||
{**person[r["person_id"]], **r}
|
||||
for r in fu.listed(reads.rows(domain.value, "follow_up", **params), start, at)
|
||||
]
|
||||
if _id:
|
||||
rows = [r for r in rows if r["person_id"] in _id.split(",")]
|
||||
if status:
|
||||
rows = [r for r in rows if r["status"] in status.split(",")]
|
||||
if name or identifier:
|
||||
found = {
|
||||
r["person_id"] for r in _with_identity(domain, rows) if _matches(r, name, identifier)
|
||||
}
|
||||
rows = [r for r in rows if r["person_id"] in found]
|
||||
persons = [r["person_id"] for r in rows]
|
||||
risks: dict[str, list[dict]] = {}
|
||||
if window is not None and sort != "-recent" or "RiskAssessment:subject" in revinclude:
|
||||
for r in reads.rows(domain.value, "risk", persons=persons):
|
||||
risks.setdefault(r["person_id"], []).append(r)
|
||||
if window is not None:
|
||||
rows = fu.ordered(rows, sort, risks, horizon)
|
||||
page = _sliced(rows, count, offset)
|
||||
mine = {r["person_id"] for r in page}
|
||||
included = _included(
|
||||
domain, revinclude, include, sorted(mine), at, {p: v for p, v in risks.items() if p in mine}
|
||||
)
|
||||
applied = {"follow-up-cutoff": at.isoformat()} if window is not None else None
|
||||
patients = [f.patient(r, fu.STATUS_SYSTEM) for r in _with_identity(domain, page)]
|
||||
return bundle(request, patients, len(rows), count, offset, included, applied)
|
||||
|
||||
|
||||
def _included(
|
||||
domain: Domain,
|
||||
revinclude: list[str],
|
||||
include: list[str],
|
||||
persons: list[str],
|
||||
at: date,
|
||||
risks: dict[str, list[dict]],
|
||||
) -> list[Resource]:
|
||||
unknown = set(revinclude) - set(REVINCLUDES) | set(include) - {"DiagnosticReport:result"}
|
||||
if unknown:
|
||||
raise HTTPException(422, f"cannot include {sorted(unknown)}")
|
||||
found: list[Resource] = []
|
||||
reports = "DiagnosticReport:subject" in revinclude
|
||||
observations = "Observation:subject" in revinclude or (
|
||||
reports and "DiagnosticReport:result" in include
|
||||
)
|
||||
if reports or observations:
|
||||
for r in _studies(domain, persons, at.isoformat()):
|
||||
kind = r.get_resource_type()
|
||||
if kind == "DiagnosticReport" and reports or (kind == "Observation" and observations):
|
||||
found.append(r)
|
||||
if "RiskAssessment:subject" in revinclude:
|
||||
found += _risk_assessments([r for p in persons for r in risks.get(p, [])])
|
||||
return found
|
||||
|
||||
|
||||
def _subjects(subject: str | None) -> list[str]:
|
||||
if not subject:
|
||||
raise HTTPException(422, "subject is required (Patient/<id>, comma-separated)")
|
||||
return [s.removeprefix("Patient/") for s in subject.split(",")]
|
||||
|
||||
|
||||
def _studies(domain: Domain, persons: list[str], at: str) -> list[Resource]:
|
||||
found: list[Resource] = []
|
||||
report_facts = _clinical(domain).REPORT_FACTS
|
||||
for study in catalog.of_domain(domain.value):
|
||||
spec = catalog.studies()[study]
|
||||
facts = {}
|
||||
if kind := report_facts.get(study):
|
||||
found_facts = reads.rows(domain.value, kind, persons=persons, cutoff=at)
|
||||
facts = {(r["person_id"], str(r["sample_date"])[:10]): r["days"] for r in found_facts}
|
||||
first = next((e.date for e in spec.events.values() if e.parent is None))
|
||||
for row in reads.instances(study, persons, at):
|
||||
days = facts.get((row["person_id"], str(row[first])[:10]))
|
||||
extra = [] if days is None else [f.ext("days-to-diagnosis", "integer", int(days))]
|
||||
found += f.instance(study, f.known(study, row, at), extra)
|
||||
return found
|
||||
|
||||
|
||||
def _risk_assessments(rows: list[dict]) -> list[Resource]:
|
||||
groups: dict[tuple, list[dict]] = {}
|
||||
for r in rows:
|
||||
groups.setdefault(
|
||||
(r["model"], r["version"], r["person_id"], str(r["index_date"])), []
|
||||
).append(r)
|
||||
return [f.risk_assessment(g[0], g) for g in groups.values()]
|
||||
|
||||
|
||||
def _clinical_search(kind: str, build, request, domain, subject, count, offset):
|
||||
fu = _clinical(domain)
|
||||
count, offset = _page(count, offset)
|
||||
params: dict = {"persons": _subjects(subject)}
|
||||
if kind != "risk":
|
||||
params["cutoff"] = _cutoff(domain, None).isoformat()
|
||||
if kind == "procedure":
|
||||
params["types"] = list(fu.PROCEDURES)
|
||||
found = build(reads.rows(domain.value, kind, **params))
|
||||
return bundle(request, _sliced(found, count, offset), len(found), count, offset)
|
||||
|
||||
|
||||
SUBJECT = "Patient/<id>, comma-separated"
|
||||
|
||||
|
||||
@router.get("/DiagnosticReport", responses=_OK, response_class=Response)
|
||||
def search_diagnostic_report(
|
||||
request: Request,
|
||||
domain: Domain,
|
||||
subject: str | None = Query(None, description=SUBJECT),
|
||||
_count: int | None = Query(None),
|
||||
_offset: int = Query(0),
|
||||
) -> Response:
|
||||
return _study_search("DiagnosticReport", request, domain, subject, _count, _offset)
|
||||
|
||||
|
||||
def _study_search(kind: str, request, domain, subject, count, offset) -> Response:
|
||||
_clinical(domain)
|
||||
count, offset = _page(count, offset)
|
||||
persons, at = (_subjects(subject), _cutoff(domain, None).isoformat())
|
||||
found = [r for r in _studies(domain, persons, at) if r.get_resource_type() == kind]
|
||||
return bundle(request, _sliced(found, count, offset), len(found), count, offset)
|
||||
|
||||
|
||||
@router.get("/Encounter", responses=_OK, response_class=Response)
|
||||
def search_encounter(
|
||||
request: Request,
|
||||
domain: Domain,
|
||||
subject: str | None = Query(None, description=SUBJECT),
|
||||
_count: int | None = Query(None),
|
||||
_offset: int = Query(0),
|
||||
) -> Response:
|
||||
return _study_search("Encounter", request, domain, subject, _count, _offset)
|
||||
|
||||
|
||||
@router.get("/Observation", responses=_OK, response_class=Response)
|
||||
def search_observation(
|
||||
request: Request,
|
||||
domain: Domain,
|
||||
subject: str | None = Query(None, description=SUBJECT),
|
||||
_count: int | None = Query(None),
|
||||
_offset: int = Query(0),
|
||||
) -> Response:
|
||||
return _study_search("Observation", request, domain, subject, _count, _offset)
|
||||
|
||||
|
||||
@router.get("/Condition", responses=_OK, response_class=Response)
|
||||
def search_condition(
|
||||
request: Request,
|
||||
domain: Domain,
|
||||
subject: str | None = Query(None, description=SUBJECT),
|
||||
_count: int | None = Query(None),
|
||||
_offset: int = Query(0),
|
||||
) -> Response:
|
||||
|
||||
def build(rows):
|
||||
return [f.condition(r) for r in rows]
|
||||
|
||||
return _clinical_search("condition", build, request, domain, subject, _count, _offset)
|
||||
|
||||
|
||||
@router.get("/Procedure", responses=_OK, response_class=Response)
|
||||
def search_procedure(
|
||||
request: Request,
|
||||
domain: Domain,
|
||||
subject: str | None = Query(None, description=SUBJECT),
|
||||
_count: int | None = Query(None),
|
||||
_offset: int = Query(0),
|
||||
) -> Response:
|
||||
|
||||
def build(rows):
|
||||
return [f.procedure(r, domain.value) for r in rows]
|
||||
|
||||
return _clinical_search("procedure", build, request, domain, subject, _count, _offset)
|
||||
|
||||
|
||||
@router.get("/RiskAssessment", responses=_OK, response_class=Response)
|
||||
def search_risk_assessment(
|
||||
request: Request,
|
||||
domain: Domain,
|
||||
subject: str | None = Query(None, description=SUBJECT),
|
||||
_count: int | None = Query(None),
|
||||
_offset: int = Query(0),
|
||||
) -> Response:
|
||||
return _clinical_search("risk", _risk_assessments, request, domain, subject, _count, _offset)
|
||||
|
||||
|
||||
def _measure(domain: Domain, key: str) -> m.Measure:
|
||||
found = measures(domain)
|
||||
for code, measure in found.items():
|
||||
if key in (code, f.measure_id(code), f.measure_url(code)):
|
||||
return measure
|
||||
raise HTTPException(404, f"no {domain.value} Measure {key}")
|
||||
|
||||
|
||||
@router.get("/Measure/{id}", responses=_OK, response_class=Response)
|
||||
def read_measure(domain: Domain, id: str) -> Response:
|
||||
return fhir(f.measure(_measure(domain, id), domain.value))
|
||||
|
||||
|
||||
@router.get("/Measure", responses=_OK, response_class=Response)
|
||||
def search_measure(
|
||||
request: Request, domain: Domain, _count: int | None = Query(None), _offset: int = Query(0)
|
||||
) -> Response:
|
||||
count, offset = _page(_count, _offset)
|
||||
found = [f.measure(x, domain.value) for x in measures(domain).values()]
|
||||
return bundle(request, _sliced(found, count, offset), len(found), count, offset)
|
||||
|
||||
|
||||
@router.get("/MeasureReport", responses=_OK, response_class=Response)
|
||||
def search_measure_report(
|
||||
request: Request,
|
||||
domain: Domain,
|
||||
measure: str = Query(alias="measure", description="the Measure's id or canonical URL"),
|
||||
periods: str = Query(
|
||||
alias="reporting-period",
|
||||
description="semesters (2025-S1) or months (2025-03), comma-separated",
|
||||
),
|
||||
as_of: datetime | None = Query(
|
||||
None, alias="as-of", description="count only what was known by then"
|
||||
),
|
||||
event_cutoff: date | None = Query(
|
||||
None, alias="event-cutoff", description="durations count to this day"
|
||||
),
|
||||
_count: int | None = Query(None),
|
||||
_offset: int = Query(0),
|
||||
) -> Response:
|
||||
found = _measure(domain, measure.split("|")[0])
|
||||
count, offset = _page(_count, _offset)
|
||||
try:
|
||||
asked = [(p.strip(), m.Period.parse(p.strip())) for p in periods.split(",") if p.strip()]
|
||||
except ValueError as e:
|
||||
raise HTTPException(422, f"reporting-period: {e}") from e
|
||||
rows = measure_reads.rows(domain.value, found.rows, **found.params)
|
||||
reports = []
|
||||
page = _sliced(asked, count, offset)
|
||||
results = m.evaluate_periods(found, rows, [p for _, p in page], as_of, event_cutoff)
|
||||
for (text, period), result in zip(page, results, strict=True):
|
||||
report = m.report(found, period, result, as_of)
|
||||
report.id = f"{f.measure_id(found.id)}-{text.lower()}"
|
||||
reports.append(report)
|
||||
return bundle(request, reports, len(asked), count, offset)
|
||||
|
||||
|
||||
@router.post("", responses=_OK, response_class=Response, status_code=202)
|
||||
def post_bundle(
|
||||
domain: Domain,
|
||||
bundle: Annotated[dict[str, Any], Body(description="a FHIR R4 batch or transaction Bundle")],
|
||||
sender: str = Query(
|
||||
pattern=ID_PATTERN,
|
||||
max_length=40,
|
||||
description="the sender's pipeline (its fhir nodes read this inbox)",
|
||||
),
|
||||
client: DagsterGraphQLClient = Depends(dagster),
|
||||
) -> Response:
|
||||
try:
|
||||
parsed = Bundle.model_validate(bundle)
|
||||
except ValueError as e:
|
||||
raise HTTPException(422, f"not a valid R4 Bundle: {e}") from e
|
||||
if parsed.type not in ("batch", "transaction", "collection"):
|
||||
raise HTTPException(422, "send a batch, transaction or collection Bundle")
|
||||
if not config_log.latest_version(sender):
|
||||
raise HTTPException(404, f"no pipeline {sender} to place what it sends")
|
||||
readers.receive(sender, bundle)
|
||||
run_id = submit(client, sender)
|
||||
entries = [
|
||||
{
|
||||
"response": {
|
||||
"status": "202 Accepted",
|
||||
"location": f"{e.resource.get_resource_type()}/{e.resource.id}",
|
||||
}
|
||||
}
|
||||
for e in parsed.entry or []
|
||||
if e.resource is not None
|
||||
]
|
||||
answer = Bundle(type="batch-response", entry=entries or None)
|
||||
found = fhir(answer)
|
||||
found.status_code = 202
|
||||
found.headers["Location"] = f"/runs/{run_id}"
|
||||
return found
|
||||
|
||||
|
||||
@router.get("/metadata", responses=_OK, response_class=Response)
|
||||
def metadata(request: Request, domain: Domain) -> Response:
|
||||
resources: dict[str, dict] = {}
|
||||
system: list[dict] = []
|
||||
clinical = part(domain, "follow_up") is not None
|
||||
for route in router.routes:
|
||||
path = route.path.removeprefix(router.prefix)
|
||||
if not path:
|
||||
if clinical:
|
||||
system = [{"code": "batch"}, {"code": "transaction"}]
|
||||
continue
|
||||
_, kind, *rest = path.split("/")
|
||||
if kind == "metadata" or (kind != "Measure" and kind != "MeasureReport" and (not clinical)):
|
||||
continue
|
||||
entry = resources.setdefault(kind, {"type": kind, "interaction": [], "searchParam": []})
|
||||
if kind == "Patient" and (not rest):
|
||||
entry |= {
|
||||
"searchInclude": ["DiagnosticReport:result"],
|
||||
"searchRevInclude": list(REVINCLUDES),
|
||||
}
|
||||
entry["interaction"].append({"code": "read" if rest else "search-type"})
|
||||
for param in route.dependant.query_params:
|
||||
name = param.alias
|
||||
if name.startswith("_") and name != "_id":
|
||||
continue
|
||||
declared = f.SEARCH_PARAMETERS.get(name)
|
||||
entry["searchParam"].append(
|
||||
{
|
||||
"name": name,
|
||||
"type": declared[1] if declared else _STANDARD[name],
|
||||
**({"definition": f"{f.BASE}/SearchParameter/{name}"} if declared else {}),
|
||||
}
|
||||
)
|
||||
statement = CapabilityStatement.model_validate(
|
||||
{
|
||||
"resourceType": "CapabilityStatement",
|
||||
"status": "active",
|
||||
"date": date.today().isoformat(),
|
||||
"kind": "instance",
|
||||
"fhirVersion": f.FHIR_VERSION,
|
||||
"format": ["json"],
|
||||
"implementation": {
|
||||
"description": f"ISSSTELEON {domain.value}",
|
||||
"url": str(request.base_url).rstrip("/") + f"/{domain.value}/fhir",
|
||||
},
|
||||
"rest": [
|
||||
{
|
||||
"mode": "server",
|
||||
"resource": [{k: v for k, v in r.items() if v} for r in resources.values()],
|
||||
**({"interaction": system} if system else {}),
|
||||
}
|
||||
],
|
||||
}
|
||||
)
|
||||
return fhir(statement)
|
||||
|
||||
|
||||
_STANDARD = {
|
||||
"_id": "token",
|
||||
"subject": "reference",
|
||||
"measure": "reference",
|
||||
"name": "string",
|
||||
"identifier": "token",
|
||||
}
|
||||
Reference in New Issue
Block a user