Use source patient identity for breast follow-up

This commit is contained in:
Angel Capetillo Zavala
2026-11-13 17:38:19 -06:00
parent 2ca86232c9
commit eeb55c4255
11 changed files with 73 additions and 110 deletions
+9 -12
View File
@@ -1,12 +1,9 @@
# Breast cohort: synthetic integration contract
This contract is opt-in and only for a synthetic source. Set
`CAMA_COHORT_SYNTHETIC=1`, `CAMA_COHORT_SECRET` and
`CAMA_COHORT_ACCESS_TOKEN` in the server environment. The pseudonym secret
must have at least 32 UTF-8 bytes; the token must be at least 32 ASCII
This contract is for a synthetic source. Set `CAMA_COHORT_ACCESS_TOKEN` in
the server environment. The token must be at least 32 ASCII
letters, digits, underscores or hyphens. The application reads the configured CaMa database
and checks the `X-Cama-Cohort-Token` request header on patient routes. Store
the pseudonym secret persistently: changing it changes every pseudonym. The
and checks the `X-Cama-Cohort-Token` request header on patient routes. The
header must be supplied by a trusted server-side access boundary, never
embedded in browser code. Without an enabled reader the aggregate returns
503; without authorized access the patient routes return 403. This is not a
@@ -24,7 +21,7 @@ No survival, recurrence, subgroup grid or other analysis endpoints are supplied.
One patient contributes once: choose the latest mammogram with a BI-RADS report
available by cutoff; then include it if BI-RADS is 4, 4A, 4B, 4C, 5 or 6.
`revision` is a digest of the materialized cohort, including its data and stable
pseudonyms. It is an integrity marker, not an authorization credential.
patient identifiers. It is an integrity marker, not an authorization credential.
For each patient request send `cohorte=cama_birads_v1`, `escenario=diagnostico`,
the exact `revision` and `corte` from the aggregate, `meses`, and any selected
@@ -35,7 +32,7 @@ GET /cama/seguimiento?cohorte=cama_birads_v1&escenario=diagnostico&revision=<rev
```
For the same selected population use the same query on
`/cama/seguimiento/exportacion` or `/cama/pacientes/<id_seudonimo>`; list
`/cama/seguimiento/exportacion` or `/cama/pacientes/<pac_id>`; list
accepts `page` and `page_size` (maximum 200). Export is limited to 5,000.
`meses=0` means the whole eligible cohort through cutoff. Its inclusive
`desde` is the earliest eligible mammography date before filtering; when the
@@ -72,13 +69,13 @@ materializes the full cohort in memory and has not been sized for production.
The local example `examples/serve_cama_cohort.py` accepts an existing synthetic
SQLite file in `CAMA_SYNTHETIC_SQLITE`, opens it read-only, binds to loopback,
and requires `CAMA_COHORT_SECRET` and `CAMA_COHORT_ACCESS_TOKEN` of at least
32 characters. Send the latter in `X-Cama-Cohort-Token` for patient requests.
and requires `CAMA_COHORT_ACCESS_TOKEN` of at least 32 characters. Send it in
`X-Cama-Cohort-Token` for patient requests.
Other domain database URLs are set to isolated in-memory SQLite by the example.
The Windows-only `fcntl` shim raises if locking is attempted: this example does
not validate file-locking functionality.
`examples/serve_cama_integration.py` runs normal application configuration
against an existing disposable SQLite copy, with a stable secret file and a
temporary token injected by its loopback-only test proxy. It is suitable only
against an existing disposable SQLite copy, with a temporary token injected by
its loopback-only test proxy. It is suitable only
for local synthetic integration and does not provide production authentication.