feat(cama): readable BI-RADS and age labels, the biopsy report date, and no export of a list that does not match its group
Contract review against WebApi 1d5f1e0 (webapi/cama_analysis.py, cama_cohort.py, docs/cama-cohort-api.md).
- The cohort's list is rewritten once on arrival so the table, the record and the PDF/XLSX show
"BI-RADS 5" and "50 a 59 años" (also "Menores de 40 años", "70 años o más", "Sin dato"); the codes
stay in `<clave>_codigo` and in the filter options, which are what the requests send. Only codes
whose meaning the API's own code confirms are labelled; biopsy grades are left as they arrive.
- The record calls the biopsy date what the list calls it ("Fecha de reporte"): in the cohort it is
the date of the biopsy report, which can be known while its result is not.
- With the same cohort revision, cut-off and filter the aggregate and the list are counted from the
same rows, so a different total breaks the contract: the list shows an alert and its PDF/XLSX
buttons are disabled.
- When no category is published the analysis says so and keeps "No publicado": the answer cannot
tell an empty cohort from categories under the threshold.
- Tests: the chosen cut-off reaches the aggregate, the list, the record and every page of the file.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -48,7 +48,7 @@ const mismosFiltros = (a: Record<string, string | undefined>, b: Record<string,
|
||||
<div class="title-row">
|
||||
<h2>Seguimiento de {{ domainLabel }}</h2>
|
||||
@if (data(); as respuesta) {
|
||||
<app-seguimiento-exportar [dominio]="dominio" [respuesta]="respuesta" [habilitado]="estado() === 'ready'" [seleccion]="etiquetaDatos()" />
|
||||
<app-seguimiento-exportar [dominio]="dominio" [respuesta]="respuesta" [habilitado]="estado() === 'ready' && !diferencia()" [seleccion]="etiquetaDatos()" />
|
||||
}
|
||||
</div>
|
||||
@if (seleccionMostrada(); as sel) {
|
||||
@@ -61,7 +61,7 @@ const mismosFiltros = (a: Record<string, string | undefined>, b: Record<string,
|
||||
<button type="button" class="volver" (click)="volverAlAnalisis.emit()">Volver al análisis</button>
|
||||
<button type="button" (click)="quitarSeleccion()">Quitar selección</button>
|
||||
</div>
|
||||
@if (diferencia(); as d) { <p class="diferencia" role="status">{{ d }}</p> }
|
||||
@if (diferencia(); as d) { <p class="diferencia" role="alert">{{ d }}</p> }
|
||||
}
|
||||
<form (ngSubmit)="aplicar()">
|
||||
<label>Fecha de corte <input name="corte" type="date" [(ngModel)]="draft.corte" /></label>
|
||||
@@ -185,11 +185,15 @@ export class IndicadoresSeguimientoTabla implements OnChanges {
|
||||
|
||||
/** «Toda la cohorte» is offered while the analysis' cohort is active (or the form still holds it), never as a plain window. */
|
||||
ventanas() { return this.contextoActivo || this.draft.meses === 0 ? MESES_VENTANA : MESES_VENTANA.filter(m => m !== 0); }
|
||||
/** What the list says when it does not hold as many patients as the analysis counted for the selection. */
|
||||
/**
|
||||
* What the list says when it does not hold as many patients as the analysis counted for the selection. With the same
|
||||
* cohort revision, cut-off and filter the server counts both from the same rows, so a difference breaks the contract:
|
||||
* the list stays visible, but it is not exported as if it were the group that was counted.
|
||||
*/
|
||||
diferencia() {
|
||||
const esperados = this.activa?.esperados, total = this.data()?.paginacion.total_items;
|
||||
if (!this.seleccionExacta() || this.estado() !== 'ready' || esperados == null || total === undefined || esperados === total) return undefined;
|
||||
return `El análisis cuenta ${esperados} pacientes en esta selección; la lista muestra ${total}.`;
|
||||
return `El análisis cuenta ${esperados} pacientes en esta selección y la lista muestra ${total}. No coinciden, por lo que este resultado no se puede exportar.`;
|
||||
}
|
||||
|
||||
constructor() {
|
||||
@@ -296,7 +300,7 @@ export class IndicadoresSeguimientoTabla implements OnChanges {
|
||||
// A click on the row opens the record unless it landed on another control; the id button always does.
|
||||
if (evento.currentTarget instanceof HTMLTableRowElement && origen?.closest('button, a, input, select, textarea')) return;
|
||||
const corte = this.data()?.corte;
|
||||
const resumen = corte ? toCamaPatientSummary(item, corte) : null;
|
||||
const resumen = corte ? toCamaPatientSummary(item, corte, this.data()?.columnas) : null;
|
||||
if (!resumen || this.estado() !== 'ready') return;
|
||||
evento.stopPropagation();
|
||||
this.controlFicha = evento.currentTarget instanceof HTMLElement ? evento.currentTarget : undefined;
|
||||
|
||||
Reference in New Issue
Block a user