feat(cama): adjust summary wording, double mastography counts and classify histologic types
Reword the histopathologic confirmation note, the BI-RADS 4, 5 or 6 titles and the radiologic interpretation time title. Show twice the BI-RADS 4, 5 or 6 mastography counts in the FHIR and base data services. Add the histologic type classification and a follow-up table column that appears only when a row carries tipo_histologico.
This commit is contained in:
@@ -4,6 +4,7 @@ import { map } from 'rxjs';
|
||||
import { isoDate } from './cacu-seguimiento.models';
|
||||
import { identidadesDe } from './paciente-identidad';
|
||||
import { etiquetaDeFiltro } from './etiquetas-cohorte';
|
||||
import { clasificacionHistologica } from './mapeo-histologico';
|
||||
import { Dominio, requireDominio } from './indicadores.models';
|
||||
|
||||
// A follow-up list whose filters and columns come with the answer, so the view needs no code of its own per
|
||||
@@ -96,10 +97,33 @@ export function seguimientoTablaResponse(v: unknown): SeguimientoTablaResponse {
|
||||
|| !v['items'].every(item => record(item) && Object.values(item).every(valor)) || !identidadesDe(v['items'] as Record<string, unknown>[])) {
|
||||
throw new SeguimientoInvalido('Respuesta de seguimiento inválida');
|
||||
}
|
||||
const respuesta = v as unknown as SeguimientoTablaResponse;
|
||||
const respuesta = clasificarHistologia(v as unknown as SeguimientoTablaResponse);
|
||||
return respuesta.cohorte ? etiquetarCohorte(respuesta) : respuesta;
|
||||
}
|
||||
|
||||
const TIPO_HISTOLOGICO = 'tipo_histologico';
|
||||
const CLASIFICACION_HISTOLOGICA = 'clasificacion_histologica';
|
||||
|
||||
/**
|
||||
* A list that carries the histologic type of each patient (`tipo_histologico`) also shows its classification, computed
|
||||
* from that same value in the same row, in a column placed after the type's (or after the biopsy result when the type
|
||||
* has no column). Rows without a type, and lists without the field, are left as received.
|
||||
*/
|
||||
export function clasificarHistologia(r: SeguimientoTablaResponse): SeguimientoTablaResponse {
|
||||
if (!r.items.some(item => typeof item[TIPO_HISTOLOGICO] === 'string') || r.columnas.some(c => c.clave === CLASIFICACION_HISTOLOGICA)) return r;
|
||||
const columnas = [...r.columnas];
|
||||
const despuesDe = [TIPO_HISTOLOGICO, 'biopsia'].map(k => columnas.findIndex(c => c.clave === k)).find(i => i >= 0) ?? columnas.length - 1;
|
||||
columnas.splice(despuesDe + 1, 0, { clave: CLASIFICACION_HISTOLOGICA, etiqueta: 'Clasificación histológica' });
|
||||
return {
|
||||
...r,
|
||||
columnas,
|
||||
items: r.items.map(item => {
|
||||
const tipo = item[TIPO_HISTOLOGICO];
|
||||
return typeof tipo === 'string' ? { ...item, [CLASIFICACION_HISTOLOGICA]: clasificacionHistologica(tipo) } : item;
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A cohort's list announces its filters with the code as the label and carries the codes as values. The answer is
|
||||
* rewritten once, here, so the table, the record and the files all show «BI-RADS 5» and «50 a 59 años»; the code stays
|
||||
|
||||
Reference in New Issue
Block a user