T8/T9: TEA Seguimiento and Análisis de riesgo as two components in rebuild's list style
tea-list is replaced by tab-seguimiento-tea and tab-riesgos-tea over one tea-rows module (params, rows, workbook, export), with Material filters, cards and pager. The risk list defaults to every child and keeps the association pairs per row; the focused patient is fetched with the list's own search. Specs and page cases follow.
This commit is contained in:
@@ -7,9 +7,15 @@ import type {
|
||||
RiskAssessment,
|
||||
} from 'fhir/r4';
|
||||
import { EXT } from '../fhir';
|
||||
import { teaRows } from './follow-up';
|
||||
import { donut, type Reading } from './measures';
|
||||
import { associationRows, teaParams, teaWorkbook } from './tea-list';
|
||||
import {
|
||||
ageMonths,
|
||||
associationRows,
|
||||
matchesTeaSearch,
|
||||
teaParams,
|
||||
teaRows,
|
||||
teaWorkbook,
|
||||
} from './tea-rows';
|
||||
|
||||
const measure: Measure = { resourceType: 'Measure', status: 'active' };
|
||||
const r: Reading = { strata: {}, populations: {}, score: 12, low: 7, high: 18 };
|
||||
@@ -21,9 +27,14 @@ function fixture(): Bundle {
|
||||
const patient: Patient = {
|
||||
resourceType: 'Patient',
|
||||
id: 'child',
|
||||
name: [{ text: 'Ana' }],
|
||||
name: [{ text: 'Ana López' }],
|
||||
identifier: [{ system: 'urn:isssteleon:clinic:source', value: '123' }],
|
||||
extension: [{ url: EXT + 'follow-up-status', valueCoding: { code: 'finished' } }],
|
||||
extension: [
|
||||
{ url: EXT + 'follow-up-status', valueCoding: { code: 'finished' } },
|
||||
{ url: EXT + 'tea-step', valueCode: 'eeg' },
|
||||
{ url: EXT + 'tea-case', valueCode: 'confirmed' },
|
||||
{ url: EXT + 'tea-eeg-result', valueCode: 'normal' },
|
||||
],
|
||||
};
|
||||
const ados: Observation = {
|
||||
resourceType: 'Observation',
|
||||
@@ -113,6 +124,7 @@ describe('TEA indicators', () => {
|
||||
expect(
|
||||
teaParams({
|
||||
step: 'eeg',
|
||||
case: 'confirmed',
|
||||
eeg: 'normal',
|
||||
model: 'no',
|
||||
age: '16-23',
|
||||
@@ -129,6 +141,7 @@ describe('TEA indicators', () => {
|
||||
}),
|
||||
).toEqual({
|
||||
'tea-step': 'eeg',
|
||||
'tea-case': 'confirmed',
|
||||
'tea-eeg-result': 'normal',
|
||||
'tea-model': 'no',
|
||||
'tea-age-group': '16-23',
|
||||
@@ -144,39 +157,22 @@ describe('TEA indicators', () => {
|
||||
expect(teaParams({ cssMax: 0 })['tea-css']).toEqual(['le0']);
|
||||
});
|
||||
|
||||
it('uses earliest included dates and builds the four detail cards and headline', () => {
|
||||
it('uses follow-up codes and assembles the included dates and association headline', () => {
|
||||
const [row, other] = teaRows(fixture());
|
||||
expect(row.steps.map(({ date, reached }) => [date, reached])).toEqual([
|
||||
['2026-02-27', true],
|
||||
['2026-03-02', true],
|
||||
[undefined, true],
|
||||
['2026-03-04', true],
|
||||
expect(row.steps.map(({ date }) => date)).toEqual([
|
||||
'2026-02-27',
|
||||
'2026-03-02',
|
||||
undefined,
|
||||
'2026-03-04',
|
||||
]);
|
||||
expect(row).toMatchObject({
|
||||
name: 'Ana',
|
||||
name: 'Ana López',
|
||||
step: 'EEG',
|
||||
case: 'confirmed',
|
||||
eegResult: 'normal',
|
||||
recordNumbers: ['123'],
|
||||
mchatScore: 9,
|
||||
ados: {
|
||||
css: 8,
|
||||
groups: [
|
||||
{
|
||||
domain: 'Afectación social (AS)',
|
||||
subdomains: [
|
||||
{
|
||||
subdomain: 'Comunicación',
|
||||
items: [
|
||||
{
|
||||
code: 'A-2',
|
||||
title: 'Frecuencia de la vocalización espontánea dirigida a otros',
|
||||
score: 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
eegs: [{ quality: 'Bueno', channels: 19 }],
|
||||
css: 8,
|
||||
headline: { pair: cssPair, or: 2, q: 0.01 },
|
||||
concordance: 'Concordante',
|
||||
});
|
||||
@@ -193,11 +189,24 @@ describe('TEA indicators', () => {
|
||||
expect(teaRows(page)[0].concordance).toBe('No concordante');
|
||||
});
|
||||
|
||||
it('defaults to children with association results and supports the other two modes', () => {
|
||||
it('defaults to all children and filters by association results', () => {
|
||||
const rows = teaRows(fixture());
|
||||
expect(associationRows(rows)).toEqual([rows[0]]);
|
||||
expect(associationRows(rows)).toEqual(rows);
|
||||
expect(associationRows(rows, 'with')).toEqual([rows[0]]);
|
||||
expect(associationRows(rows, 'without')).toEqual([rows[1]]);
|
||||
expect(associationRows(rows, 'all')).toEqual(rows);
|
||||
});
|
||||
|
||||
it('matches names and record numbers in the risk list', () => {
|
||||
const [row] = teaRows(fixture());
|
||||
expect(matchesTeaSearch(row, 'lopez an')).toBe(true);
|
||||
expect(matchesTeaSearch(row, '123')).toBe(true);
|
||||
expect(matchesTeaSearch(row, '456')).toBe(false);
|
||||
});
|
||||
|
||||
it('calculates completed months at the cut-off', () => {
|
||||
expect(ageMonths('2024-01-15', '2026-01-14')).toBe(23);
|
||||
expect(ageMonths('2024-01-15', '2026-01-15')).toBe(24);
|
||||
expect(ageMonths(undefined, '2026-01-15')).toBeUndefined();
|
||||
});
|
||||
|
||||
it('builds the follow-up workbook', () => {
|
||||
|
||||
Reference in New Issue
Block a user