Merge origin/rebuild into parity/T1-merge (WebApi)

- 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).
This commit is contained in:
2026-11-30 23:56:11 -06:00
12 changed files with 925 additions and 36 deletions
+13 -5
View File
@@ -14,6 +14,7 @@ from pydantic import BaseModel, Field, WithJsonSchema
from core import tea
from core.domains import Domain, InputSpec
from core.models import title
from persistance import bundle, cluster, inputs, registry
from persistance.cluster import Execution, Reference
from webapi.runs import dagster, execution_config, submit
@@ -31,10 +32,15 @@ class Version(BaseModel):
status: Literal["champion", "retired", "candidate"]
class Model(BaseModel):
name: str
title: str
@router.get("/{domain}")
def models(domain: Domain) -> list[str]:
def models(domain: Domain) -> list[Model]:
prefix = f"{domain.value}."
return [n.removeprefix(prefix) for n in registry.names(prefix)]
return [Model(name=n.removeprefix(prefix), title=title(n)) for n in registry.names(prefix)]
@router.get(
@@ -121,7 +127,8 @@ def read_report(domain: Domain, name: str, version: int, report: str) -> Respons
@router.post("/{domain}/{name}/versions/{version}/reports/clinical_validation")
def add_clinical_validation(domain: Domain, name: str, version: int, file: UploadFile) -> dict:
"""The clinical team's validation of a version: the third report promotion needs."""
"""The clinical team's validation of a version: the third report, which promotion needs
unless the site left it out of PROMOTION_REPORTS."""
registry.add_report(f"{domain.value}.{name}", version, "clinical_validation",
file.filename or "report", file.file.read()) # fmt: skip
return {"reports": sorted(registry.reports(f"{domain.value}.{name}", version))}
@@ -129,8 +136,9 @@ def add_clinical_validation(domain: Domain, name: str, version: int, file: Uploa
@router.post("/{domain}/{name}/versions/{version}/promote")
def promote(domain: Domain, name: str, version: int) -> dict:
"""The version risk batches come from from now on; refused (409) without its three
reports: technical validation, interpretability and clinical validation."""
"""The version risk batches come from from now on; refused (409) without the reports
the site requires (PROMOTION_REPORTS; default: technical validation, interpretability
and clinical validation)."""
try:
registry.promote(f"{domain.value}.{name}", version)
except registry.UnknownVersion as e: