Decir a qué citología corresponde la estimación y comparar el NCI en la misma

This commit is contained in:
2026-12-04 17:49:35 -06:00
parent 22edb0bf42
commit 4789282e17
4 changed files with 68 additions and 4 deletions
+24
View File
@@ -30,3 +30,27 @@ export function ineligibility(
}
return undefined;
}
/** Which cytology her estimates speak of, against her latest by the cut-off. After the first
* post-colposcopy visit nothing is evaluated; otherwise a later cytology is only said. */
export function currency(
estimates: { model: string; index: string }[],
cytologies: string[],
): { sample?: string; excluded?: string; note?: string } {
const sample = estimates.map((e) => e.index.slice(0, 10)).sort().at(-1);
if (!sample) return {};
const latest = cytologies.map((d) => d.slice(0, 10)).sort().at(-1);
if (!latest || latest <= sample) {
return { sample, note: `Estimación de la citología del ${sample}.` };
}
if (estimates.some((e) => e.model.includes('post_colposcopy'))) {
return {
sample,
excluded: `No disponible por: hay una citología posterior a la primera visita poscolposcopía (${latest}) y solo se evalúa esa primera visita.`,
};
}
return {
sample,
note: `Estimación de la citología del ${sample}. Hay una citología posterior, del ${latest}, que no se evalúa.`,
};
}