Identify follow-up patients by pac_id
Rows name their patient with pac_id (a decimal string) or the legacy id_seudonimo. pac_id wins; an invalid pac_id is never replaced by the legacy field, and a page that repeats a patient or mixes both fields is not drawn or exported. The table, patient record, PDF and spreadsheet follow the announced identifier column and label. CaCu requests risk only with a pac_id.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { concatWith, defer, from, map, mergeMap, Observable, of, startWith, switchMap, tap } from 'rxjs';
|
||||
import { Dominio } from '../indicadores.models';
|
||||
import { identidadesDe } from '../paciente-identidad';
|
||||
import { consultaAplicada, contextoDe, PAGE_SIZE_MAX, SeguimientoTablaQuery, SeguimientoTablaResponse, SeguimientoTablaService } from '../seguimiento-tabla.service';
|
||||
import { ExportInconsistent, ExportLimitExceeded, TrackingExportEvent, TrackingRow } from './tracking-export.models';
|
||||
|
||||
@@ -50,8 +51,8 @@ export function fetchAllTracking(service: SeguimientoTablaService, dominio: Domi
|
||||
startWith<TrackingExportEvent>({ kind: 'progress', fetched: first.items.length, total }),
|
||||
concatWith(defer(() => {
|
||||
const items = [...collected.entries()].sort(([a], [b]) => a - b).flatMap(([, rows]) => rows);
|
||||
const ids = new Set(items.map(item => item['id_seudonimo']));
|
||||
if (items.length !== total || ids.size !== total) throw new ExportInconsistent('The pages do not add up to the announced total');
|
||||
// Every row has the identity the table shows, and no patient (or episode) appears on two pages.
|
||||
if (items.length !== total || !identidadesDe(items)) throw new ExportInconsistent('The pages do not add up to the announced total');
|
||||
return of<TrackingExportEvent>({
|
||||
kind: 'done',
|
||||
snapshot: { corte: first.corte, ventana: first.ventana, filtros: first.filtros, filtros_disponibles: first.filtros_disponibles, columnas: first.columnas, items },
|
||||
|
||||
Reference in New Issue
Block a user