The follow-up list identifies each patient by the platform's pac_id, the key the risk route takes; TEA keeps its salted pseudonym

This commit is contained in:
Roberto Treviño Cervantes
2026-11-15 05:40:08 -06:00
parent 854a2e9c55
commit 9737b5a67f
5 changed files with 34 additions and 18 deletions
+7 -1
View File
@@ -10,6 +10,7 @@ Until the domain expert validates the reference ranges, every alteration stays h
the alteration filter, the abnormal/normal split, and the metric and electrode observations.
"""
import hashlib
import os
from dataclasses import dataclass
from datetime import date
@@ -17,7 +18,6 @@ from datetime import date
from sqlalchemy import column, select, table
from webapi.fhir.common import CODE_SYSTEM, STRUCTURE, concept, tagged
from webapi.follow_up.listing import seudonimo
STEPS = (("SOLO_MCHAT", "fecha_mchat", "M-CHAT"), ("PSICOLOGIA", "fecha_psicologia", "Evaluación psicológica"),
("NEUROPEDIATRIA", "fecha_neuropediatria", "Evaluación neuropediátrica"),
@@ -62,6 +62,12 @@ def salt() -> str:
return os.environ.get("SEGUIMIENTO_SAL", DEFAULT_SALT)
def seudonimo(pac_id: int, sal: str) -> str:
"""TEA's patient and episode ids: stable for a salt, without saying the `pac_id`. CaCu's follow-up list moved
to the platform's `pac_id`; TEA keeps the pseudonym until its patient resources get their own identity."""
return "P-" + hashlib.sha256(f"{sal}:{pac_id}".encode()).hexdigest()[:10].upper()
def _date(value) -> date | None:
if value is None or isinstance(value, date):
return value