Estimates stored as batches of risks in the domain's database: models store and run --store; a kit file is read as dbt's only when its producer is dbt
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
"""Where the pipelines' data lives and how it's read and written: Parquet files (cohort builds and estimates), dbt's
|
||||
manifest, and a domain's Persistance repositories.
|
||||
manifest, a domain's Persistance repositories, and the batches of risks they store.
|
||||
|
||||
The kit's builds are `<root>/<domain>/<cohort>/<armado_id>.parquet`. The builds of dbt's rules go in a `dbt/` folder
|
||||
beside them, numbered in order, so a lookup of the kit's builds never picks one up. Persistance is imported only where a
|
||||
@@ -133,6 +133,13 @@ def read_queries(manifest: str | Path, url: str) -> CohortQueries:
|
||||
date.fromisoformat(meta["cutoff"]), json.loads(meta.get("parameters", "{}")))
|
||||
|
||||
|
||||
def store_risk_batch(domain: str, armado_id: int, provenance: dict, outcome: str, rows: list[tuple]) -> tuple[int, bool]:
|
||||
"""Writes a batch of risks for a kit build through the domain's `cohorte_repository`: its `lote_id` and whether it's
|
||||
new. The only write the pipelines make to the database; risks of anyone outside the build are refused."""
|
||||
cohorts = importlib.import_module(f"persistance.{domain}").cohorte_repository
|
||||
return cohorts.guardar_lote(armado_id, provenance, outcome, rows)
|
||||
|
||||
|
||||
def resolve_repository(domain: str, entity: str):
|
||||
"""`entity` is the repository's name in `persistance.<domain>` without
|
||||
the suffix, e.g. `"paciente"`, `"citologia_cervical"`."""
|
||||
|
||||
Reference in New Issue
Block a user