b847e04697
The patient record ADOS-2 table and the Seguimiento ADOS-2 card list only the module's items, in the order of core.tea.ados2_items as the FHIR aggregate Observation carries them: each module item component has the module's item code and exact title as a second coding (and code.text), and ados2-domain / ados2-subdomain extensions. Components without those (items outside the module) are not listed. Association titles and the concordance look the item up by catalog field instead of by row index, so they do not depend on which items the module has. ADOS2_ITEMS moves to a shared src/app/ados2.ts.
101 lines
2.9 KiB
TypeScript
101 lines
2.9 KiB
TypeScript
import type { Observation, ObservationComponent } from 'fhir/r4';
|
|
import { describe, expect, it } from 'vitest';
|
|
import { ados2Component, ados2Groups } from './ados2';
|
|
import { EXT } from './fhir';
|
|
|
|
function item(
|
|
field: string,
|
|
domain: string,
|
|
subdomain: string,
|
|
code: string,
|
|
title: string,
|
|
value?: number,
|
|
): ObservationComponent {
|
|
return {
|
|
code: {
|
|
coding: [{ code: `ados2.${field}` }, { code, display: title }],
|
|
text: title,
|
|
},
|
|
extension: [
|
|
{ url: EXT + 'ados2-domain', valueCoding: { code: domain[0], display: domain } },
|
|
{ url: EXT + 'ados2-subdomain', valueCoding: { code: subdomain, display: subdomain } },
|
|
],
|
|
valueQuantity: value == null ? undefined : { value },
|
|
};
|
|
}
|
|
|
|
const AS = 'Afectación social (AS)';
|
|
const CRR = 'Comportamiento restringido y repetitivo (CRR)';
|
|
|
|
const observation: Observation = {
|
|
resourceType: 'Observation',
|
|
status: 'final',
|
|
code: { coding: [{ code: 'ados2' }] },
|
|
component: [
|
|
{ code: { coding: [{ code: 'ados2.module' }] }, valueCodeableConcept: { text: 'Módulo 1' } },
|
|
item('pointing', AS, 'Comunicación', 'A-7', 'Señalar', 2),
|
|
item('gestures', AS, 'Comunicación', 'A-8', 'Gestos', 1),
|
|
item(
|
|
'unusual_eye_contact',
|
|
AS,
|
|
'Interacción social recíproca',
|
|
'B-1',
|
|
'Contacto visual inusual',
|
|
),
|
|
item(
|
|
'intonation',
|
|
CRR,
|
|
'Comportamientos restringidos y repetitivos',
|
|
'A-3',
|
|
'Entonación de las vocalizaciones o verbalizaciones',
|
|
3,
|
|
),
|
|
{ code: { coding: [{ code: 'ados2.response_to_name' }] } },
|
|
],
|
|
};
|
|
|
|
describe('Ítems del ADOS-2', () => {
|
|
it('agrupa los ítems del módulo por dominio y subdominio en su orden', () => {
|
|
expect(ados2Groups(observation)).toEqual([
|
|
{
|
|
domain: AS,
|
|
subdomains: [
|
|
{
|
|
subdomain: 'Comunicación',
|
|
items: [
|
|
{ code: 'A-7', title: 'Señalar', score: 2 },
|
|
{ code: 'A-8', title: 'Gestos', score: 1 },
|
|
],
|
|
},
|
|
{
|
|
subdomain: 'Interacción social recíproca',
|
|
items: [{ code: 'B-1', title: 'Contacto visual inusual', score: undefined }],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
domain: CRR,
|
|
subdomains: [
|
|
{
|
|
subdomain: 'Comportamientos restringidos y repetitivos',
|
|
items: [
|
|
{
|
|
code: 'A-3',
|
|
title: 'Entonación de las vocalizaciones o verbalizaciones',
|
|
score: 3,
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
]);
|
|
expect(ados2Groups(undefined)).toEqual([]);
|
|
});
|
|
|
|
it('encuentra el ítem de una asociación por su número', () => {
|
|
expect(ados2Component(observation, 2)?.code.text).toBe('Señalar');
|
|
expect(ados2Component(observation, 8)?.code.coding?.[0].code).toBe('ados2.response_to_name');
|
|
expect(ados2Component(observation, 0)).toBeUndefined();
|
|
});
|
|
});
|