Files
WebApi/webapi/orchestration/project.py
T
edgar 7d06f9db9d The cycle builds the cohorts dbt defines; models' moved modules
The `cohorts` and `estimate` steps take the project's cohorts from dbt's manifest (`cohort_urls`) and build each one
with models' `build_of` over dbt's queries, instead of the Python-frame TOMLs in models/cohorts, which are gone; without
a manifest a project has no cohort steps. The recruitment window and cut-off are dbt's vars. The live estimator reads
cin2_logistic through `Scenario` and `KitBuild`, and governance imports `models.reports.experiment`, where models now
keeps it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HmQxVJVNR5FYkPAregGEQ7
2026-11-20 20:18:00 -06:00

20 lines
1.0 KiB
Python

"""What the cycle needs to know of a project's definitions, all from dbt's manifest: its period types and its cohorts."""
import json
from pathlib import Path
from models.io.storage import cohort_urls as _cohort_urls
def period_types(proyecto: str, manifest: Path) -> list[str]:
"""The period types the project's measures publish, from their `meta.tipos_periodo` in dbt's manifest."""
metrics = json.loads(manifest.read_text(encoding="utf-8"))["metrics"].values()
return sorted({t for m in metrics for t in m["config"].get("meta", {}).get("tipos_periodo", [])
if m["config"]["meta"].get("measure_url", "").startswith(f"{proyecto}/")})
def cohort_urls(proyecto: str, manifest: Path | None) -> list[str]:
"""The cohorts the cycle builds: those of the project in dbt's manifest (`Transformation/models/<project>/cohorts/`,
`meta.cohort` of their population query). dbt is their only definition. None without a manifest."""
return _cohort_urls(manifest, proyecto) if manifest else []