Patient lists have a search box; TEA alterations by their Spanish names

This commit is contained in:
Roberto Treviño
2026-11-29 12:39:07 -06:00
parent 55c4e0b173
commit 2216186d26
8 changed files with 137 additions and 6 deletions
+17 -3
View File
@@ -1,3 +1,4 @@
import { METRIC_NAMES } from '../eeg-labels';
import { KeyValuePipe } from '@angular/common';
import { Component, computed, inject, input, resource, signal } from '@angular/core';
import { FormsModule } from '@angular/forms';
@@ -11,6 +12,7 @@ import { EXT, Fhir, resources } from '../fhir';
import { Loading } from '../loading';
import { ageLabel } from './figures';
import { name } from './measures';
import { matchesSearch, PatientSearch } from './patient-search';
/** One child on TEA's list, as the list shows her (core.tea.follow_up). */
export interface TeaRow {
@@ -67,14 +69,18 @@ const CASE: Record<string, string> = {
not_confirmed: 'Sin TEA',
};
/** `theta_power:above` → "theta_power (aumentado)". */
export const alteration = (a: string) =>
a.replace(/:(above|below)$/, (_, s) => (s === 'above' ? ' (aumentado)' : ' (disminuido)'));
export const alteration = (a: string) => {
const [metric, side] = a.split(':');
const shown = (METRIC_NAMES[metric] ?? metric).replace(/ \(.*\)$/, '');
return side ? `${shown} (${side === 'above' ? 'aumentado' : 'disminuido'})` : shown;
};
/** "Análisis de Riesgo" for TEA: the children active in the window, what their EEGs show,
* filtered as the old page filtered them. */
@Component({
selector: 'app-tab-riesgos-tea',
imports: [
PatientSearch,
FormsModule,
KeyValuePipe,
Loading,
@@ -100,6 +106,8 @@ export class TabRiesgosTea {
protected readonly caseState = signal('');
protected readonly altered = signal('');
protected readonly size = signal(50);
/** "Buscar paciente": the pseudonymous id, a record number or a name. */
protected readonly search = signal('');
protected readonly pageIndex = signal(0);
/** The query as last asked for ("Consultar"). */
private readonly asked = signal({ cutoff: '', window: 3 });
@@ -141,7 +149,13 @@ export class TabRiesgosTea {
(!band || (r.mchat !== undefined && band.test(r.mchat))) &&
(!level || (r.css !== undefined && level.test(r.css))) &&
(!this.caseState() || r.case === this.caseState()) &&
(!this.altered() || r.alterations.includes(this.altered())),
(!this.altered() || r.alterations.includes(this.altered())) &&
matchesSearch(this.search(), [
r.name,
r.patient.id,
...(r.patient.name ?? []).map((n) => n.text),
...(r.patient.identifier ?? []).map((i) => i.value),
]),
);
});
protected readonly shown = computed(() =>