28 Commits

Author SHA1 Message Date
Roberto Treviño Cervantes 5831fcd9d9 Cycle: skip the scenarios whose definition turns off batch_estimates 2026-11-23 00:14:14 -06:00
Roberto Treviño Cervantes 5738a9c302 Merge dev into the CaMa consolidation branch 2026-11-22 23:28:00 -06:00
edgar bf93a5fff9 Merge pull request 'CaCu follow-up: CASO status with CIS, per-status probabilities, and a cycle that estimates with every production scenario' (#19) from integration/cacu-197-conciliacion into dev
Reviewed-on: http://10.0.10.41:3000/ISSSTELEON/WebApi/pulls/19
2026-11-22 23:25:34 -06:00
ulises eb88cb7eb0 ADOS-2 scoring step in the indicators cycle, run after the document import commits; EEG analysis ordered before the relation steps 2026-11-22 22:01:50 -06:00
ulises 74303aa1b9 TEA: the cycle's relate_ados2 step between the EEG analysis and the load, and the ADOS-2 relation in FHIR 2026-11-22 21:47:16 -06:00
edgar 2fe4101982 Cycle: estimate with every scenario in production, one batch per model
The scenarios come from the registry instead of a fixed list, and a cohort can carry several estimators.
2026-11-22 20:34:38 -06:00
edgar e0967d0175 Follow-up status: a case is a carcinoma, invasive or in situ 2026-11-22 19:16:44 -06:00
edgar 7640486852 Follow-up status: CASO, a patient with a cancer biopsy
A biopsy reported with a grade of `cacu.seguimiento.caso.grados` (CARCINOMA, provisional) by the reference makes the
patient a case: the status wins over every other, and what is followed for her is survival. Only the follow-up list
reads this rule; the measures' stratum in dbt is unchanged.
2026-11-22 15:03:31 -06:00
Roberto Treviño Cervantes cc54c1dc86 Merge the CaMa recurrence follow-up imports and /cama/recurrencia into dev 2026-11-22 09:18:27 -06:00
ulises 9a62ddcdaf CaMa recurrence: import schemas for the follow-up and the new patient variables, silver mappings and /cama/recurrencia
The patient takes the menopausal state, molecular and clinical subtype, integrative cluster, cellularity, mutation load,
Ki-67 category and source of the record; a new import entity carries the recurrence and the last contact; hormone and
anti-HER2 therapy are treatments. The route serves each cohort's scenarios, a scenario's figure and a patient's scenarios
over the live cohort build, computing the models and the bootstrap in the background and caching them per build. Includes
the survival import work this builds on.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 08:46:42 -06:00
edgar a04ceb6301 Cycle: score with the models package's scored_frame, so a model's risk intervals reach the batch
The cycle read the run's horizons and called the model itself; `models.dags.estimation.scored_frame` does both, and
also reads whether the run gives each risk's interval.
2026-11-22 07:47:05 -06:00
rockdrigo d185aba364 Merge remote-tracking branch 'origin/dev' into dev-mvp 2026-11-21 13:53:57 -06:00
alberto 46473bb106 feat(tea): each EEG metric's age-norm curve and the age at the EEG in the patient summary 2026-11-21 11:17:48 -06:00
rockdrigo 2d71fe1103 Lesion size extracted from pathology reports; development record route; scenario catalog and background training jobs in governance 2026-11-21 03:28:13 -06:00
rockdrigo 6b011df0fd Merge the CaMa survival cohort support 2026-11-21 02:07:54 -06:00
rockdrigo e2ecaa027c CaMa: individual risk and population curves served, and the cycle estimates with any scenario in production
webapi/fhir/risk.py builds a patient's RiskAssessment for CaCu and CaMa; GET /cama/modelo/curvas serves the production
version's survival curves; the cycle's estimator is generic by scenario; silver persona carries the date of death for CaMa;
the import schema accepts it; the CaMa risk batches can be confirmed and voided.
2026-11-21 02:07:34 -06:00
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
rockdrigo 8130f86f3a Silver persona carries the date of death in CaCu and CaMa; tests for it and for CaMa's birth and death on the timeline 2026-11-20 18:46:40 -06:00
rockdrigo ca0f02aa0c A coded catalog result may name the code system of its values; the histological type comes out as its ICD-O-3 code 2026-11-20 17:03:38 -06:00
AlbertoPMDM d35e8bbae9 feat(tea): EEG analysis before the silver load, and its verdict, quality checks and baselines through silver and FHIR 2026-11-19 15:43:27 -06:00
Roberto Treviño Cervantes 854a2e9c55 The recomputation worker estimates with the models in production and wakes on the marker directory; the scanned test form carries a birth date 2026-11-15 05:37:50 -06:00
rockdrigo 73cbf0cfb8 The catalog step seeds each domain's mappings, and a mapping is written only if the function still holds
How: `catalog_rows` turns the TOML's study codes, captions and each value's code, label and aliases into the
`catalogo` system's rows; the `catalogs` step adds the system and the forms with no row yet
(`mapeos_nuevos`). `register` normalizes the form and adds the row through `SourceMappingRepository.add`
with `check_stored`, which runs `check_function` on the stored rows of the same form; captions aren't
checked, since one caption may introduce several results. `ctx.repos.silver.mappings` is the domain's
repository.

Implications: the database keeps every mapping across deploys; a person's change is never overwritten, and
a second code for a form in force is refused before it's written. Loads still read the TOML's aliases.
2026-11-13 15:31:21 -06:00
rockdrigo 64d3d721e3 Source forms as a partial, non-injective function into the catalog's codes, checked on the catalog
How: `reference.source_mapping` keys a mapping by source system, result, normalized form and validity;
`check_function` rejects a form that gives two codes while both mappings are in force, and `resolve` gives
the code in force on a date, or none when nothing or two disagreeing mappings match. The catalog's own
check of spellings (`_claves_de_extraccion`) now runs `check_function` on each result's codes, labels and
aliases.

Implications: the same rule serves the TOML today and any store of mappings with systems and dates; every
catalog passes it.
2026-11-13 15:29:52 -06:00
rockdrigo 113b792a7b The import's catalog matching and commit read the WebApi's catalog, silver batch and table maps; add_resultado moves here
How: `catalog_matching`, `catalog_commit_service` and the imports blueprint import `Catalogo`,
`catalogo_desde_toml`, `ruta_de_catalogo`, `CatalogoInvalido`, `LotePlata`, `valor_de_observacion` and
`tablas_de` from `webapi.orchestration`; the commit writes through `carga_repository.save_load` and
`catalog_repository.sync`. `add_resultado` and its tests come over unchanged from the indicator kit.

Implications: the import path no longer needs the indicator kit, which isn't a dependency.
2026-11-13 15:24:02 -06:00
rockdrigo 9775a22c57 CaMa's silver load reads results from the reports' text, mapped by the catalog
How: `silver.extracted.DesdeTexto` turns the catalog's `etiquetas_fuente` and each value's `alias` into
Extraction's field specs and into derived columns of a `DeStaging`. CaMa reads density and lesion size from the
mammography interpretation, histology, grade, receptors, HER2 and Ki-67 from the pathology PDF's text layer (no
OCR at load time), and the clinical stage from the note's texts. `resultados_extraibles` reads and checks the new
keys: captions are a non-empty list, aliases need captions, and no spelling names two values.

Implications: a code comes with the spelling it matched as `valor_fuente`; an unknown spelling is kept as
`valor_fuente` with no code, counted as out of catalog, and becomes a code on the next load once its alias is in
the catalog. Nothing is renamed in the stored data and no table or column changes. The synthetic CaMa staging
gains a mammography text, a pathology PDF and a note with a stage.
2026-11-13 15:14:46 -06:00
edgar e224b8b2aa TEA on its new staging: silver load, ten measures answered on request with the status at the period's end, several groups and column strata, and FHIR R4 endpoints for measures, follow-up and patient summary 2026-11-13 15:14:46 -06:00
edgar 4fc822d5c7 The kit's silver load, reference tables, table maps and follow-up list move into the WebApi; the kit is no longer a dependency 2026-11-13 15:14:29 -06:00
edgar 73b1db1121 English names: orchestration (cycle, context, runner, repositories), its steps, fields and CLI, recomputation, follow_up and reports 2026-11-13 15:13:52 -06:00