Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 749afe765d | |||
| fe4dd55452 | |||
| 053679c817 | |||
| ffa732df12 | |||
| 786b199203 |
@@ -0,0 +1,69 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
const form = { username: 'admin@isssteleon.mx', password: 'solo-para-pruebas' };
|
||||
expect((await page.request.post('/api/auth/login', { form })).status()).toBe(204);
|
||||
});
|
||||
|
||||
test('indicadores cacu: its sections in order, each card read one mode at a time', async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto('/indicadores/cacu');
|
||||
const tab = page.locator('app-tab-indicadores');
|
||||
await expect(tab.getByRole('heading', { name: 'Indicadores clínicos' })).toBeVisible();
|
||||
await expect(tab.locator('app-loading')).toHaveCount(0, { timeout: 5 * 60_000 });
|
||||
const headings = await tab
|
||||
.locator('h2, app-readings h3')
|
||||
.evaluateAll((els) => els.map((e) => (e as HTMLElement).innerText.trim()));
|
||||
expect(headings.slice(headings.indexOf('Indicadores de oportunidad'))).toEqual([
|
||||
'Indicadores de oportunidad',
|
||||
'Tiempos de la ruta del tamizaje',
|
||||
'Indicadores clínicos',
|
||||
'Resultados de citología, VPH y biopsia',
|
||||
'Distribución de resultados citológicos',
|
||||
'Resultados de VPH por genotipo',
|
||||
'Resultados de biopsia cervical',
|
||||
'Pacientes evaluadas por resultado de VPH',
|
||||
'Tasa de confirmación histopatológica',
|
||||
'Valor predictivo positivo de la colposcopía',
|
||||
]);
|
||||
const route = tab.locator('app-readings').first();
|
||||
for (const mode of ['Por pasos', 'Por CIE-10', 'Acumulado desde la toma']) {
|
||||
await route.getByRole('radio', { name: mode }).click();
|
||||
await expect(
|
||||
route.getByRole('table', { name: mode }).or(route.getByText('Sin datos en el periodo.')),
|
||||
).toBeVisible();
|
||||
}
|
||||
await tab.getByRole('radio', { name: 'Biopsia', exact: true }).click();
|
||||
await expect(
|
||||
tab.getByRole('heading', { name: 'Valor predictivo positivo de la biopsia' }),
|
||||
).toBeVisible();
|
||||
await tab.getByRole('radio', { name: 'Solicitudes' }).click();
|
||||
});
|
||||
|
||||
test('riesgos cacu: ages filter the whole list and a row opens its stages', async ({ page }) => {
|
||||
await page.goto('/indicadores/cacu');
|
||||
await page.getByRole('tab', { name: 'Análisis de riesgos' }).click();
|
||||
const list = page.locator('table.worklist tbody tr');
|
||||
await expect(list.first().locator('app-stages li')).toHaveCount(5);
|
||||
await list.first().getByRole('button', { name: 'Detalle' }).click();
|
||||
await expect(page.locator('tr.stage-detail')).toContainText('Toma de muestra');
|
||||
const answer = page.waitForResponse((r) => r.url().includes('birthdate=le'));
|
||||
await page.getByLabel('Edad mínima').fill('45');
|
||||
expect((await answer).ok()).toBe(true);
|
||||
for (const age of await list.locator('td:nth-child(2)').allInnerTexts())
|
||||
expect(parseInt(age)).toBeGreaterThanOrEqual(45);
|
||||
for (const [button, file] of [
|
||||
['Exportar Excel', 'seguimiento-cacu.xlsx'],
|
||||
['Exportar PDF', 'seguimiento-cacu.pdf'],
|
||||
]) {
|
||||
const saved = page.waitForEvent('download');
|
||||
await page.getByRole('button', { name: button }).click();
|
||||
expect((await saved).suggestedFilename()).toBe(file);
|
||||
}
|
||||
await list.first().locator('a').first().click();
|
||||
await expect(page.locator('[data-section=etapas]')).toContainText('Reporte de biopsia');
|
||||
const record = page.waitForEvent('download');
|
||||
await page.getByRole('button', { name: 'Exportar PDF' }).click();
|
||||
expect((await record).suggestedFilename()).toBe('expediente-cacu.pdf');
|
||||
});
|
||||
+29
-7
@@ -59,10 +59,10 @@ test("indicators: the KPIs are the API's MeasureReports, every tab and the patie
|
||||
await expect(page.locator('app-tab-indicadores app-plot').first()).toBeVisible();
|
||||
|
||||
await page.getByRole('tab', { name: 'Trazabilidad' }).click();
|
||||
await expect(page.locator('app-tab-trazabilidad mat-card')).toHaveCount(14);
|
||||
await expect(page.locator('app-tab-trazabilidad section.panel')).toHaveCount(9);
|
||||
|
||||
await page.getByRole('tab', { name: 'Datos y definiciones' }).click();
|
||||
await expect(page.locator('app-tab-definiciones tbody tr')).toHaveCount(14);
|
||||
await expect(page.locator('app-tab-definiciones details')).toHaveCount(21);
|
||||
|
||||
const list = page.waitForResponse((r) => r.url().includes('/fhir/Patient?'));
|
||||
await page.getByRole('tab', { name: 'Análisis de riesgos' }).click();
|
||||
@@ -73,7 +73,7 @@ test("indicators: the KPIs are the API's MeasureReports, every tab and the patie
|
||||
await expect(rows).toHaveCount(Math.min(20, bundle.total));
|
||||
await expect(rows.first().locator('a').first()).toHaveText(first);
|
||||
await page.getByRole('button', { name: 'Siguiente' }).click();
|
||||
await expect(page.getByText(`21–`)).toBeVisible();
|
||||
await expect(page.getByText('Página 2 de')).toBeVisible();
|
||||
|
||||
await page.getByRole('button', { name: 'Anterior' }).click();
|
||||
await rows.first().locator('a').first().click();
|
||||
@@ -103,13 +103,12 @@ test('conectar: open the hospital pipeline, preview a source, run it to success'
|
||||
await page.getByText('cacu', { exact: true }).click();
|
||||
await expect(page.locator('vflow')).toBeVisible();
|
||||
// a node's caption: its kind, then its name
|
||||
await page.locator('.node-caption', { hasText: 'Pacientes' }).click();
|
||||
await page.locator('.node-caption', { hasText: 'Fuente de datosPacientes' }).click();
|
||||
// drawn from a fixture, read back as a guided SQLite source: the dialog edits it
|
||||
await expect(page.getByRole('button', { name: 'Editar conexión' })).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Vista previa' }).click();
|
||||
await expect(page.locator('.preview tr[mat-row]').first()).toBeVisible();
|
||||
// A map node shows the site's codes in platform terms (its ConceptMap), editable as rows.
|
||||
await page;
|
||||
await page
|
||||
.locator('.node-caption', { hasText: 'Traducir códigos' })
|
||||
.filter({ has: page.locator('.name', { hasText: /^Citología$/ }) })
|
||||
@@ -206,11 +205,34 @@ function captured(domain: string) {
|
||||
const period = (text: string) => text.replace(/, \d{4}-(S[12]|\d{2})$/, ', <periodo>');
|
||||
const kindOf = (types: string[]) => [...new Set(types)].sort().join('+');
|
||||
|
||||
for (const domain of ['cacu', 'cama', 'tea']) {
|
||||
// CaCu's page is its own (Phase 6); CaMa's and TEA's follow the old one.
|
||||
for (const domain of ['cama', 'tea']) {
|
||||
test(`indicadores ${domain}: the old page's headings, in order, and the same kinds of plots`, async ({
|
||||
page,
|
||||
}) => {
|
||||
const old = captured(domain);
|
||||
const all = captured(domain);
|
||||
// CaMa's five timeliness boxes are one route card now: its heading stands for them.
|
||||
const route = all.findIndex(
|
||||
(i) => i.kind === 'h3' && i.text === 'Tiempo de tamizaje a diagnóstico',
|
||||
);
|
||||
const clinical = all.findIndex((i) => i.text === 'Indicadores clínicos');
|
||||
// Lote 2: the detection rate has its own title, and the histopathology figures are two
|
||||
// cards (the result by BI-RADS; the confirmation in two readings).
|
||||
const detection = (i: { text?: string }) =>
|
||||
i.text === 'Tasa de confirmación histopatológica'
|
||||
? { ...i, text: 'Tasa de detección histopatológica' }
|
||||
: i;
|
||||
const results = all.findIndex(
|
||||
(i) => i.text === 'Resultado histopatológico por categoría BI-RADS',
|
||||
);
|
||||
const cards = [
|
||||
{ kind: 'h3', text: 'Resultado histopatológico por categoría BI-RADS' },
|
||||
{ kind: 'h3', text: 'Confirmación histopatológica' }, // one card: title, tabs and reading
|
||||
];
|
||||
const old =
|
||||
domain === 'cama'
|
||||
? [...all.slice(0, route + 1).map(detection), ...all.slice(clinical, results), ...cards]
|
||||
: all;
|
||||
await page.goto(`/indicadores/${domain}`);
|
||||
const tab = page.locator('app-tab-indicadores');
|
||||
await expect(tab.getByRole('heading', { name: 'Indicadores clínicos' })).toBeVisible();
|
||||
|
||||
+204
-7
@@ -422,6 +422,7 @@
|
||||
},
|
||||
"default": {},
|
||||
"description": "Dato \u2192 columna, sin leer el texto.",
|
||||
"keys": "field",
|
||||
"title": "Datos tomados de columnas",
|
||||
"type": "object"
|
||||
},
|
||||
@@ -455,13 +456,70 @@
|
||||
"eeg"
|
||||
],
|
||||
"title": "Estudio",
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"widget": {
|
||||
"formlyConfig": {
|
||||
"props": {
|
||||
"options": [
|
||||
{
|
||||
"label": "Identidad de la persona",
|
||||
"value": "identity"
|
||||
},
|
||||
{
|
||||
"label": "Citolog\u00eda cervical",
|
||||
"value": "cervical_cytology"
|
||||
},
|
||||
{
|
||||
"label": "Biopsia cervical",
|
||||
"value": "cervical_biopsy"
|
||||
},
|
||||
{
|
||||
"label": "Mastograf\u00eda",
|
||||
"value": "mammography"
|
||||
},
|
||||
{
|
||||
"label": "Biopsia de mama",
|
||||
"value": "breast_biopsy"
|
||||
},
|
||||
{
|
||||
"label": "Tratamiento de c\u00e1ncer de mama",
|
||||
"value": "breast_treatment"
|
||||
},
|
||||
{
|
||||
"label": "Recurrencia de c\u00e1ncer de mama",
|
||||
"value": "breast_recurrence"
|
||||
},
|
||||
{
|
||||
"label": "Nota m\u00e9dica",
|
||||
"value": "clinical_note"
|
||||
},
|
||||
{
|
||||
"label": "Defunci\u00f3n",
|
||||
"value": "death"
|
||||
},
|
||||
{
|
||||
"label": "M-CHAT-R/F",
|
||||
"value": "mchat"
|
||||
},
|
||||
{
|
||||
"label": "ADOS-2",
|
||||
"value": "ados2"
|
||||
},
|
||||
{
|
||||
"label": "Electroencefalograma",
|
||||
"value": "eeg"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"formats": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"default": {},
|
||||
"keys": "field",
|
||||
"title": "Formatos de fecha",
|
||||
"type": "object"
|
||||
},
|
||||
@@ -535,6 +593,7 @@
|
||||
},
|
||||
"default": {},
|
||||
"description": "Dato \u2192 expresi\u00f3n con un grupo ( ).",
|
||||
"keys": "field",
|
||||
"title": "Patrones",
|
||||
"type": "object"
|
||||
},
|
||||
@@ -595,7 +654,63 @@
|
||||
"eeg"
|
||||
],
|
||||
"title": "Estudio",
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"widget": {
|
||||
"formlyConfig": {
|
||||
"props": {
|
||||
"options": [
|
||||
{
|
||||
"label": "Identidad de la persona",
|
||||
"value": "identity"
|
||||
},
|
||||
{
|
||||
"label": "Citolog\u00eda cervical",
|
||||
"value": "cervical_cytology"
|
||||
},
|
||||
{
|
||||
"label": "Biopsia cervical",
|
||||
"value": "cervical_biopsy"
|
||||
},
|
||||
{
|
||||
"label": "Mastograf\u00eda",
|
||||
"value": "mammography"
|
||||
},
|
||||
{
|
||||
"label": "Biopsia de mama",
|
||||
"value": "breast_biopsy"
|
||||
},
|
||||
{
|
||||
"label": "Tratamiento de c\u00e1ncer de mama",
|
||||
"value": "breast_treatment"
|
||||
},
|
||||
{
|
||||
"label": "Recurrencia de c\u00e1ncer de mama",
|
||||
"value": "breast_recurrence"
|
||||
},
|
||||
{
|
||||
"label": "Nota m\u00e9dica",
|
||||
"value": "clinical_note"
|
||||
},
|
||||
{
|
||||
"label": "Defunci\u00f3n",
|
||||
"value": "death"
|
||||
},
|
||||
{
|
||||
"label": "M-CHAT-R/F",
|
||||
"value": "mchat"
|
||||
},
|
||||
{
|
||||
"label": "ADOS-2",
|
||||
"value": "ados2"
|
||||
},
|
||||
{
|
||||
"label": "Electroencefalograma",
|
||||
"value": "eeg"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"maxLength": 40,
|
||||
@@ -705,7 +820,8 @@
|
||||
"url",
|
||||
"oauth",
|
||||
"table",
|
||||
"format"
|
||||
"format",
|
||||
"columns"
|
||||
],
|
||||
"title": "Type",
|
||||
"type": "string"
|
||||
@@ -828,7 +944,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"on": {
|
||||
"description": "Pares [columna izquierda, derecha].",
|
||||
"description": "Columna de la primera entrada = columna de la segunda.",
|
||||
"items": {
|
||||
"maxItems": 2,
|
||||
"minItems": 2,
|
||||
@@ -1003,6 +1119,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Dato de la plataforma \u2192 columna del sitio.",
|
||||
"keys": "field",
|
||||
"title": "Campos",
|
||||
"type": "object"
|
||||
},
|
||||
@@ -1012,6 +1129,7 @@
|
||||
},
|
||||
"default": {},
|
||||
"description": "Por ejemplo %d/%m/%Y.",
|
||||
"keys": "field",
|
||||
"title": "Formatos de fecha",
|
||||
"type": "object"
|
||||
},
|
||||
@@ -1059,6 +1177,7 @@
|
||||
},
|
||||
"default": {},
|
||||
"description": "Un dato igual para todas las filas.",
|
||||
"keys": "field",
|
||||
"title": "Valores fijos",
|
||||
"type": "object"
|
||||
}
|
||||
@@ -1710,12 +1829,14 @@
|
||||
"properties": {
|
||||
"args": {
|
||||
"additionalProperties": true,
|
||||
"advanced": true,
|
||||
"default": {},
|
||||
"description": "Los de la fuente dlt.",
|
||||
"title": "Argumentos (JSON)",
|
||||
"title": "Argumentos",
|
||||
"type": "object"
|
||||
},
|
||||
"guided": {
|
||||
"advanced": true,
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Guided"
|
||||
@@ -1723,7 +1844,8 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"title": "Asistente"
|
||||
},
|
||||
"id": {
|
||||
"maxLength": 40,
|
||||
@@ -1764,6 +1886,7 @@
|
||||
]
|
||||
},
|
||||
"primary_key": {
|
||||
"advanced": true,
|
||||
"default": [],
|
||||
"description": "Columnas que identifican una fila.",
|
||||
"items": {
|
||||
@@ -1773,6 +1896,7 @@
|
||||
"type": "array"
|
||||
},
|
||||
"resource": {
|
||||
"advanced": true,
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
@@ -1785,12 +1909,14 @@
|
||||
"title": "Recurso"
|
||||
},
|
||||
"source": {
|
||||
"advanced": true,
|
||||
"description": "M\u00f3dulo:funci\u00f3n de la fuente dlt.",
|
||||
"pattern": "^[A-Za-z_][\\w.]*:[A-Za-z_]\\w*$",
|
||||
"title": "Fuente dlt",
|
||||
"type": "string"
|
||||
},
|
||||
"then": {
|
||||
"advanced": true,
|
||||
"anyOf": [
|
||||
{
|
||||
"pattern": "^[A-Za-z_][\\w.]*:[A-Za-z_]\\w*$",
|
||||
@@ -2004,7 +2130,63 @@
|
||||
"eeg"
|
||||
],
|
||||
"title": "Estudio",
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"widget": {
|
||||
"formlyConfig": {
|
||||
"props": {
|
||||
"options": [
|
||||
{
|
||||
"label": "Identidad de la persona",
|
||||
"value": "identity"
|
||||
},
|
||||
{
|
||||
"label": "Citolog\u00eda cervical",
|
||||
"value": "cervical_cytology"
|
||||
},
|
||||
{
|
||||
"label": "Biopsia cervical",
|
||||
"value": "cervical_biopsy"
|
||||
},
|
||||
{
|
||||
"label": "Mastograf\u00eda",
|
||||
"value": "mammography"
|
||||
},
|
||||
{
|
||||
"label": "Biopsia de mama",
|
||||
"value": "breast_biopsy"
|
||||
},
|
||||
{
|
||||
"label": "Tratamiento de c\u00e1ncer de mama",
|
||||
"value": "breast_treatment"
|
||||
},
|
||||
{
|
||||
"label": "Recurrencia de c\u00e1ncer de mama",
|
||||
"value": "breast_recurrence"
|
||||
},
|
||||
{
|
||||
"label": "Nota m\u00e9dica",
|
||||
"value": "clinical_note"
|
||||
},
|
||||
{
|
||||
"label": "Defunci\u00f3n",
|
||||
"value": "death"
|
||||
},
|
||||
{
|
||||
"label": "M-CHAT-R/F",
|
||||
"value": "mchat"
|
||||
},
|
||||
{
|
||||
"label": "ADOS-2",
|
||||
"value": "ados2"
|
||||
},
|
||||
{
|
||||
"label": "Electroencefalograma",
|
||||
"value": "eeg"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"maxLength": 40,
|
||||
@@ -5545,6 +5727,21 @@
|
||||
"title": "Identifier"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "gt, ge, lt or le and a day (2000-12-31)",
|
||||
"in": "query",
|
||||
"name": "birthdate",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"default": [],
|
||||
"description": "gt, ge, lt or le and a day (2000-12-31)",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": "Birthdate",
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "-recent or -risk-<outcome>",
|
||||
"in": "query",
|
||||
|
||||
Generated
+285
-2
@@ -25,9 +25,11 @@
|
||||
"d3-zoom": "3.0.0",
|
||||
"material-symbols": "0.48.3",
|
||||
"ngx-vflow": "2.7.0",
|
||||
"pdfmake": "0.3.14",
|
||||
"plotly.js-cartesian-dist-min": "4.1.2",
|
||||
"rxjs": "~7.8.0",
|
||||
"tslib": "^2.3.0"
|
||||
"tslib": "^2.3.0",
|
||||
"write-excel-file": "4.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/build": "^22.3.0",
|
||||
@@ -38,6 +40,7 @@
|
||||
"@types/d3-selection": "3.0.13",
|
||||
"@types/d3-zoom": "3.0.9",
|
||||
"@types/fhir": "0.0.44",
|
||||
"@types/pdfmake": "0.3.5",
|
||||
"@types/plotly.js": "3.0.15",
|
||||
"jsdom": "^31.0.0",
|
||||
"ng-openapi-gen": "^1.1.0",
|
||||
@@ -2402,6 +2405,30 @@
|
||||
"@ngx-formly/core": "11.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@noble/ciphers": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz",
|
||||
"integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^14.21.3 || >=16"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@noble/hashes": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz",
|
||||
"integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^14.21.3 || >=16"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@oxc-parser/binding-android-arm-eabi": {
|
||||
"version": "0.158.0",
|
||||
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm-eabi/-/binding-android-arm-eabi-0.158.0.tgz",
|
||||
@@ -3465,6 +3492,12 @@
|
||||
"integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@swc/helpers": {
|
||||
"version": "0.5.24",
|
||||
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.24.tgz",
|
||||
"integrity": "sha512-6tcXo4kA8HgGO7AVmawB57RYi/piBPYVHVcO6dXjX+SZw8GoHmi262sp4v2Ha2kNP9Cx84qei27yT+fjS1lxgg==",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/@tybys/wasm-util": {
|
||||
"version": "0.10.5",
|
||||
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.5.tgz",
|
||||
@@ -3570,6 +3603,37 @@
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "26.6.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.11.tgz",
|
||||
"integrity": "sha512-uUyQ2XLEz+EXh34lmS3GhKrkqn/8FU7KUiKRpk347At2bmnMVWss45yz8b4FG/tUtmV1tV/+TVkITItPROyeeQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~8.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pdfkit": {
|
||||
"version": "0.17.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/pdfkit/-/pdfkit-0.17.7.tgz",
|
||||
"integrity": "sha512-VMOZDWw7HtNtLbjIuHIhVArm9PlV0gxpz32jAl1IuXWlIgbr1lKFoTsrtvEzY8a9BIpQJEE5DwNPKD50otTs6g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pdfmake": {
|
||||
"version": "0.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/pdfmake/-/pdfmake-0.3.5.tgz",
|
||||
"integrity": "sha512-AQI4ISWzt7qmnKaipkikibz9x2XIvU/1zqfEHwKhBU7vP6oIhlGoLB9KsSIAryH7f9uuJebXScldb6F4ebwFxg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"@types/pdfkit": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/plotly.js": {
|
||||
"version": "3.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@types/plotly.js/-/plotly.js-3.0.15.tgz",
|
||||
@@ -3816,6 +3880,15 @@
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/base64-js": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-0.0.8.tgz",
|
||||
"integrity": "sha512-3XSA2cR/h/73EzlXXdU6YNycmYI7+kicTxks4eJg2g39biHR84slg2+des+p7iHYhbRg/udIS4TD53WabcOUkw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/baseline-browser-mapping": {
|
||||
"version": "2.11.39",
|
||||
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.39.tgz",
|
||||
@@ -3891,6 +3964,35 @@
|
||||
"url": "https://github.com/sponsors/fb55"
|
||||
}
|
||||
},
|
||||
"node_modules/brotli": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/brotli/-/brotli-1.3.3.tgz",
|
||||
"integrity": "sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"base64-js": "^1.1.2"
|
||||
}
|
||||
},
|
||||
"node_modules/brotli/node_modules/base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/browserslist": {
|
||||
"version": "4.29.6",
|
||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.6.tgz",
|
||||
@@ -4119,6 +4221,15 @@
|
||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/clone": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz",
|
||||
"integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/colorjs.io": {
|
||||
"version": "0.7.1",
|
||||
"resolved": "https://registry.npmjs.org/colorjs.io/-/colorjs.io-0.7.1.tgz",
|
||||
@@ -4326,6 +4437,12 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/dfa": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/dfa/-/dfa-1.2.0.tgz",
|
||||
"integrity": "sha512-ED3jP8saaweFTjeGX8HQPjeC1YYyZs98jGNZx6IiBvxW7JG5v492kamAQB3m2wop07CvU/RQmzcKr6bgcC5D/Q==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/dom-serializer": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-3.1.1.tgz",
|
||||
@@ -4561,7 +4678,6 @@
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fast-string-truncated-width": {
|
||||
@@ -4626,6 +4742,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/fflate": {
|
||||
"version": "0.8.3",
|
||||
"resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.3.tgz",
|
||||
"integrity": "sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/flru": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/flru/-/flru-1.0.2.tgz",
|
||||
@@ -4636,6 +4758,23 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/fontkit": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/fontkit/-/fontkit-2.0.4.tgz",
|
||||
"integrity": "sha512-syetQadaUEDNdxdugga9CpEYVaQIxOwk7GlwZWWZ19//qW4zE5bknOKeMBDYAASwnpaSHKJITRLMF9m1fp3s6g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@swc/helpers": "^0.5.12",
|
||||
"brotli": "^1.3.2",
|
||||
"clone": "^2.1.2",
|
||||
"dfa": "^1.2.0",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"restructure": "^3.0.0",
|
||||
"tiny-inflate": "^1.0.3",
|
||||
"unicode-properties": "^1.4.0",
|
||||
"unicode-trie": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/fs-extra": {
|
||||
"version": "11.4.1",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.4.1.tgz",
|
||||
@@ -5366,6 +5505,16 @@
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/linebreak": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/linebreak/-/linebreak-1.1.0.tgz",
|
||||
"integrity": "sha512-MHp03UImeVhB7XZtjd0E4n6+3xr5Dq/9xI/5FptGk5FrbDR3zagPa2DS6U8ks/3HjbKWG9Q1M2ufOzxV2qLYSQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"base64-js": "0.0.8",
|
||||
"unicode-trie": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/listr2": {
|
||||
"version": "11.4.1",
|
||||
"resolved": "https://registry.npmjs.org/listr2/-/listr2-11.4.1.tgz",
|
||||
@@ -5844,6 +5993,12 @@
|
||||
"@oxc-parser/binding-win32-x64-msvc": "0.158.0"
|
||||
}
|
||||
},
|
||||
"node_modules/pako": {
|
||||
"version": "0.2.9",
|
||||
"resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz",
|
||||
"integrity": "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/parse5": {
|
||||
"version": "8.1.1",
|
||||
"resolved": "https://registry.npmjs.org/parse5/-/parse5-8.1.1.tgz",
|
||||
@@ -5922,6 +6077,34 @@
|
||||
"url": "https://github.com/fb55/entities?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/pdfkit": {
|
||||
"version": "0.20.2",
|
||||
"resolved": "https://registry.npmjs.org/pdfkit/-/pdfkit-0.20.2.tgz",
|
||||
"integrity": "sha512-Q/w03ICAQyXfHNfTsg1udp0ADerdBN0s7a6XSPL7J7Ro6ABnafoBOCDBstIO9U02mvzHEV8HrvFIw5iV5ejIRA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@noble/ciphers": "^1.3.0",
|
||||
"@noble/hashes": "^1.8.0",
|
||||
"fflate": "^0.8.3",
|
||||
"fontkit": "^2.0.4",
|
||||
"linebreak": "^1.1.0",
|
||||
"png-js": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/pdfmake": {
|
||||
"version": "0.3.14",
|
||||
"resolved": "https://registry.npmjs.org/pdfmake/-/pdfmake-0.3.14.tgz",
|
||||
"integrity": "sha512-EDyOlwiDnE8e0eITSpHwZCVAP/veWq0TxA2RyhoDO0cSLat7HEGNtKUN6UiW9+YovO2GhcWlK99Q7tj9sof9gg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"linebreak": "^1.1.0",
|
||||
"pdfkit": "^0.20.2",
|
||||
"xmldoc": "^2.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
},
|
||||
"node_modules/picocolors": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
||||
@@ -5990,6 +6173,14 @@
|
||||
"integrity": "sha512-3UkyAT7/U8f3sOLavLnUjA6mqFmnqEe246GZhxT0J3TT9oZ0mh6SgwsL1yo/3/4xfmRSDFdGOxe+EsvT2XiE0g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/png-js": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/png-js/-/png-js-2.0.0.tgz",
|
||||
"integrity": "sha512-GdzJuUMc6ZSpxFJWVxtOH1bzYHym+TOnveqUjb+VJIbZWbZzyiRGFiKhbiielfpYbgMlhHVhsJ0FTazfuRFkMA==",
|
||||
"dependencies": {
|
||||
"fflate": "^0.8.2"
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.5.33",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.33.tgz",
|
||||
@@ -6165,6 +6356,12 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/restructure": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/restructure/-/restructure-3.0.2.tgz",
|
||||
"integrity": "sha512-gSfoiOEA0VPE6Tukkrr7I0RBdE0s7H1eFCDBk05l1KIQT1UIKNc5JZy6jdyW6eYH3aR3g5b3PuL77rq0hvwtAw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/rolldown": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.3.1.tgz",
|
||||
@@ -6663,6 +6860,15 @@
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/sax": {
|
||||
"version": "1.6.1",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.6.1.tgz",
|
||||
"integrity": "sha512-42tBVwLWnaQvW5zc4HbZrTuWccECCZfBi92FDuwtqxasH+JbPB3/FOKb1m222K42R4WxuxzzMsTswfzgtSu64Q==",
|
||||
"license": "BlueOak-1.0.0",
|
||||
"engines": {
|
||||
"node": ">=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/saxes": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz",
|
||||
@@ -6852,6 +7058,12 @@
|
||||
"node": ">=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tiny-inflate": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.3.tgz",
|
||||
"integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/tinybench": {
|
||||
"version": "6.2.5",
|
||||
"resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.5.tgz",
|
||||
@@ -6979,6 +7191,53 @@
|
||||
"node": ">=22.19.0"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "8.9.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz",
|
||||
"integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/unicode-properties": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/unicode-properties/-/unicode-properties-1.4.1.tgz",
|
||||
"integrity": "sha512-CLjCCLQ6UuMxWnbIylkisbRj31qxHPAurvena/0iwSVbQ2G1VY5/HjV0IRabOEbDHlzZlRdCrD4NhB0JtU40Pg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"base64-js": "^1.3.0",
|
||||
"unicode-trie": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/unicode-properties/node_modules/base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/unicode-trie": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unicode-trie/-/unicode-trie-2.0.0.tgz",
|
||||
"integrity": "sha512-x7bc76x0bm4prf1VLg79uhAzKw8DVboClSN5VxJuQ+LKDOVEW9CdH+VY7SP+vX7xCYQqzzgQpFqz15zeLvAtZQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"pako": "^0.2.5",
|
||||
"tiny-inflate": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/universalify": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
|
||||
@@ -7676,6 +7935,18 @@
|
||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/write-excel-file": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/write-excel-file/-/write-excel-file-4.1.1.tgz",
|
||||
"integrity": "sha512-MUnCnNtQrcZek832ZcU24uU0rSphFmKPD1DvIjXOlygVb93CV7Tme6H3jUTkxsMmjB2W7HIzERzjqTi5kui71A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fflate": "^0.8.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/xml-name-validator": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz",
|
||||
@@ -7693,6 +7964,18 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/xmldoc": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/xmldoc/-/xmldoc-2.0.3.tgz",
|
||||
"integrity": "sha512-6gRk4NY/Jvg67xn7OzJuxLRsGgiXBaPUQplVJ/9l99uIugxh4FTOewYz5ic8WScj7Xx/2WvhENiQKwkK9RpE4w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"sax": "^1.4.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/xxhash-wasm": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.1.0.tgz",
|
||||
|
||||
+4
-1
@@ -29,9 +29,11 @@
|
||||
"d3-zoom": "3.0.0",
|
||||
"material-symbols": "0.48.3",
|
||||
"ngx-vflow": "2.7.0",
|
||||
"pdfmake": "0.3.14",
|
||||
"plotly.js-cartesian-dist-min": "4.1.2",
|
||||
"rxjs": "~7.8.0",
|
||||
"tslib": "^2.3.0"
|
||||
"tslib": "^2.3.0",
|
||||
"write-excel-file": "4.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/build": "^22.3.0",
|
||||
@@ -42,6 +44,7 @@
|
||||
"@types/d3-selection": "3.0.13",
|
||||
"@types/d3-zoom": "3.0.9",
|
||||
"@types/fhir": "0.0.44",
|
||||
"@types/pdfmake": "0.3.5",
|
||||
"@types/plotly.js": "3.0.15",
|
||||
"jsdom": "^31.0.0",
|
||||
"ng-openapi-gen": "^1.1.0",
|
||||
|
||||
@@ -34,6 +34,11 @@ export interface SearchPatient$Params {
|
||||
*/
|
||||
identifier?: (string | null);
|
||||
|
||||
/**
|
||||
* gt, ge, lt or le and a day (2000-12-31)
|
||||
*/
|
||||
birthdate?: Array<string>;
|
||||
|
||||
/**
|
||||
* -recent or -risk-<outcome>
|
||||
*/
|
||||
@@ -68,6 +73,7 @@ export function searchPatient(http: HttpClient, rootUrl: string, params: SearchP
|
||||
rb.query('follow-up-status', params['follow-up-status'], {});
|
||||
rb.query('name', params.name, {});
|
||||
rb.query('identifier', params.identifier, {});
|
||||
rb.query('birthdate', params.birthdate, {});
|
||||
rb.query('_sort', params['_sort'], {});
|
||||
rb.query('risk-horizon', params['risk-horizon'], {});
|
||||
rb.query('_revinclude', params['_revinclude'], {});
|
||||
|
||||
@@ -11,5 +11,5 @@ export interface FieldSpec {
|
||||
placeholder?: string;
|
||||
provider?: (string | null);
|
||||
required?: boolean;
|
||||
type?: 'text' | 'number' | 'password' | 'select' | 'folder' | 'server_file' | 'upload' | 'url' | 'oauth' | 'table' | 'format';
|
||||
type?: 'text' | 'number' | 'password' | 'select' | 'folder' | 'server_file' | 'upload' | 'url' | 'oauth' | 'table' | 'format' | 'columns';
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ export interface Join {
|
||||
label?: string;
|
||||
|
||||
/**
|
||||
* Pares [columna izquierda, derecha].
|
||||
* Columna de la primera entrada = columna de la segunda.
|
||||
*/
|
||||
on: Array<[string, string]>;
|
||||
position?: (Position | null);
|
||||
|
||||
@@ -33,6 +33,8 @@ export interface SourceDialogData {
|
||||
guided?: Guided | null;
|
||||
label?: string;
|
||||
}
|
||||
const NONE: string[] = [];
|
||||
|
||||
/** What it gives back: the dialog's answers (the node's dlt fields are made from them). */
|
||||
export interface SourceDialogResult {
|
||||
guided: Guided;
|
||||
@@ -203,17 +205,17 @@ export class SourceDialog {
|
||||
}
|
||||
}
|
||||
|
||||
/** The tables a database listed, for its table field. */
|
||||
/** A list answer (the columns picked), as a list. */
|
||||
protected listed(name: string): string[] {
|
||||
const v = this.value(name);
|
||||
return Array.isArray(v) ? (v as string[]) : [];
|
||||
return Array.isArray(v) ? (v as string[]) : NONE; // a new list each time renders forever
|
||||
}
|
||||
/** The columns to pick from: the first rows', and those already picked. */
|
||||
protected columnOptions(name: string): string[] {
|
||||
return [...new Set([...this.columns(), ...this.listed(name)])];
|
||||
}
|
||||
|
||||
/** The tables a database listed, for its table field. */
|
||||
protected tables(): string[] {
|
||||
return this.tableList();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
import type { Content, TDocumentDefinitions } from 'pdfmake/interfaces';
|
||||
|
||||
/** A table to save, as the page shows it: its headers and rows, and what it was asked with. */
|
||||
export interface Sheet {
|
||||
title: string;
|
||||
query?: [string, string][];
|
||||
head: string[];
|
||||
rows: string[][];
|
||||
}
|
||||
|
||||
/** Every cell is text: nothing in it runs as a formula. */
|
||||
export async function saveExcel(sheet: Sheet, file: string): Promise<void> {
|
||||
const { default: write } = await import('write-excel-file/browser');
|
||||
const text = (value: string) => ({ value, type: String });
|
||||
const head = sheet.head.map((value) => ({ ...text(value), fontWeight: 'bold' as const }));
|
||||
await write([
|
||||
{ sheet: 'Resultados', data: [head, ...sheet.rows.map((r) => r.map(text))] },
|
||||
{ sheet: 'Consulta', data: (sheet.query ?? []).map((q) => q.map(text)) },
|
||||
]).toFile(`${file}.xlsx`);
|
||||
}
|
||||
|
||||
/** The tables on the institutional page: logo, date and page numbers. */
|
||||
export async function savePdf(sheets: Sheet[], file: string, wide = false): Promise<void> {
|
||||
const [pdfmake, fonts, logo] = await Promise.all([
|
||||
import('pdfmake/build/pdfmake'),
|
||||
import('pdfmake/build/vfs_fonts'),
|
||||
fetch('assets/branding/isssteleon-logo.png').then((r) => r.blob()),
|
||||
]);
|
||||
const image = await new Promise<string>((done, fail) => {
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => done(reader.result as string);
|
||||
reader.onerror = () => fail(reader.error);
|
||||
reader.readAsDataURL(logo);
|
||||
});
|
||||
const made = new Date().toLocaleString('es-MX', { dateStyle: 'medium', timeStyle: 'short' });
|
||||
const definition: TDocumentDefinitions = {
|
||||
pageSize: 'LETTER',
|
||||
pageOrientation: wide ? 'landscape' : 'portrait',
|
||||
pageMargins: [36, 60, 36, 40],
|
||||
defaultStyle: { fontSize: 7.5 },
|
||||
header: { image, width: 110, margin: [36, 18, 0, 0] },
|
||||
footer: (page, pages) => ({
|
||||
columns: [
|
||||
`Generado: ${made}`,
|
||||
{ text: 'Confidencial, uso interno', alignment: 'center' },
|
||||
{ text: `Página ${page} de ${pages}`, alignment: 'right' },
|
||||
],
|
||||
margin: [36, 12],
|
||||
fontSize: 7,
|
||||
}),
|
||||
content: sheets.flatMap((s): Content[] => [
|
||||
{ text: s.title, fontSize: 13, bold: true, margin: [0, 10, 0, 4] },
|
||||
...(s.query ?? []).map(([k, v]) => ({ text: [{ text: `${k}: `, bold: true }, v] })),
|
||||
s.rows.length
|
||||
? {
|
||||
layout: 'lightHorizontalLines',
|
||||
margin: [0, 6, 0, 0],
|
||||
table: {
|
||||
headerRows: 1,
|
||||
dontBreakRows: true,
|
||||
body: [s.head.map((text) => ({ text, bold: true })), ...s.rows],
|
||||
},
|
||||
}
|
||||
: 'Sin registros.',
|
||||
]),
|
||||
};
|
||||
pdfmake.default.addVirtualFileSystem(fonts.default);
|
||||
await pdfmake.default.createPdf(definition).download(`${file}.pdf`);
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
import { bars } from './bars';
|
||||
import { Reading } from './measures';
|
||||
|
||||
describe('bars', () => {
|
||||
it('list every category, so the shares add up', () => {
|
||||
const r: Reading = {
|
||||
populations: {},
|
||||
strata: {
|
||||
category: { a: { 'initial-population': 3 }, other: { 'initial-population': 1 } },
|
||||
},
|
||||
};
|
||||
const catalog = [{ code: 'a', label: 'A', color: '#000' }];
|
||||
const t = bars({ kind: 'counts', label: 'x', measure: 'M', catalog }, () => r)!;
|
||||
expect(t.rows.map((x) => x.cells)).toEqual([
|
||||
['3', '75.0 %'],
|
||||
['1', '25.0 %'],
|
||||
]);
|
||||
});
|
||||
it('a group with no patients has no rate', () => {
|
||||
const r: Reading = {
|
||||
populations: {},
|
||||
strata: { s: { initial: { numerator: 0, denominator: 0 } } },
|
||||
};
|
||||
const mode = { kind: 'shares', label: 'x', measure: 'M', stratum: 's', order: ['initial'] };
|
||||
expect(bars(mode as any, () => r)!.rows[0].cells).toEqual(['0/0', '—']);
|
||||
});
|
||||
it('a proportion split into its parts shows both in units and shares', () => {
|
||||
const r: Reading = { populations: { numerator: 1, denominator: 4 }, strata: {} };
|
||||
const t = bars({ kind: 'split', label: 'x', measure: 'M', yes: 'Con', no: 'Sin' }, () => r)!;
|
||||
expect(t.rows.map((x) => [x.label, ...x.cells])).toEqual([
|
||||
['Con', '1', '25.0 %'],
|
||||
['Sin', '3', '75.0 %'],
|
||||
]);
|
||||
});
|
||||
it('rows with patients and no biopsy are not rows with no patients; malignant counts only graded', () => {
|
||||
const r: Reading = {
|
||||
populations: {},
|
||||
strata: {
|
||||
birads: {
|
||||
'4A': { 'initial-population': 3 },
|
||||
'5': { 'initial-population': 4 },
|
||||
'6': { 'initial-population': 2 },
|
||||
},
|
||||
'birads-category': {
|
||||
'4A|no_biopsy': { 'initial-population': 3 },
|
||||
'5|benign': { 'initial-population': 1 },
|
||||
'5|invasive': { 'initial-population': 1 },
|
||||
'5|no_data': { 'initial-population': 2 },
|
||||
'6|no_data': { 'initial-population': 2 },
|
||||
},
|
||||
},
|
||||
};
|
||||
const results = [
|
||||
{ code: 'benign', label: 'Benigno', color: '#1' },
|
||||
{ code: 'invasive', label: 'Invasor', color: '#2' },
|
||||
{ code: 'no_biopsy', label: 'Sin biopsia', color: '#3' },
|
||||
{ code: 'no_data', label: 'Sin dato', color: '#4' },
|
||||
];
|
||||
const rows = ['4A', '5', '6', '4B'].map((code) => ({ code, label: code, color: '#0' }));
|
||||
const mode = {
|
||||
kind: 'outcomes',
|
||||
label: 'x',
|
||||
measure: 'M',
|
||||
stratum: 'birads',
|
||||
rows,
|
||||
results,
|
||||
malignant: ['invasive'],
|
||||
};
|
||||
const t = bars(mode as any, () => r)!;
|
||||
expect(t.rows.map((x) => x.cells)).toEqual([
|
||||
['3', '0', '0', '3', '0', 'Sin biopsias'],
|
||||
['4', '1', '1', '0', '2', '1/2 (50.0 %)'],
|
||||
['2', '0', '0', '0', '2', 'Sin biopsias clasificables'],
|
||||
['0', '—', '—', '—', '—', '—'],
|
||||
]);
|
||||
expect(t.rows.map((x) => x.none)).toEqual([
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
'Sin pacientes en el periodo',
|
||||
]);
|
||||
expect(t.rows[1].segments!.map((x) => x.width)).toEqual([25, 25, 0, 50]);
|
||||
});
|
||||
it('bars on a percent scale are as long as the shares shown', () => {
|
||||
const r: Reading = {
|
||||
populations: {},
|
||||
strata: { category: { a: { 'initial-population': 1 }, b: { 'initial-population': 3 } } },
|
||||
};
|
||||
const catalog = [
|
||||
{ code: 'a', label: 'A', color: '#0' },
|
||||
{ code: 'b', label: 'B', color: '#1' },
|
||||
{ code: 'c', label: 'C', color: '#2' },
|
||||
];
|
||||
const t = bars({ kind: 'counts', label: 'x', measure: 'M', catalog, percent: true }, () => r)!;
|
||||
expect(t.rows.map((x) => x.width)).toEqual([25, 75, 0]);
|
||||
expect(t.rows.map((x) => x.cells)).toEqual([
|
||||
['1', '25.0 %'],
|
||||
['3', '75.0 %'],
|
||||
['0', '0.0 %'],
|
||||
]);
|
||||
});
|
||||
it('a split takes the colours it is given', () => {
|
||||
const r: Reading = { populations: { numerator: 1, denominator: 4 }, strata: {} };
|
||||
const mode = {
|
||||
kind: 'split',
|
||||
label: 'x',
|
||||
measure: 'M',
|
||||
yes: 'Con',
|
||||
no: 'Sin',
|
||||
colors: ['#a', '#b'],
|
||||
};
|
||||
expect(bars(mode as any, () => r)!.rows.map((x) => x.color)).toEqual(['#a', '#b']);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,231 @@
|
||||
import { CIE10 } from './cie10';
|
||||
import { name, Reading } from './measures';
|
||||
|
||||
/** A category as drawn: its code in the report, its name and its colour. */
|
||||
export type Category = { code: string; label: string; color: string };
|
||||
|
||||
/** One way of reading a card, as bars from the reports, or a figure. */
|
||||
export type Mode = {
|
||||
label: string;
|
||||
caption?: string;
|
||||
/** said above the table: what its rows count (patients, reported biopsies…) */
|
||||
heading?: string;
|
||||
} &
|
||||
/** `percent`: every bar on a fixed scale of 0 to 100 %, so its length is the share shown */
|
||||
(
|
||||
| { kind: 'counts'; measure: string; catalog: Category[]; percent?: boolean }
|
||||
| { kind: 'shares'; measure: string; stratum: string; order: string[] }
|
||||
| { kind: 'positives'; measure: string; stratum: string; order: string[] }
|
||||
| { kind: 'signs'; measure: string; strata: string[] }
|
||||
| { kind: 'days'; steps: { label: string; measure: string }[] }
|
||||
| { kind: 'days-by'; measure: string; stratum: string }
|
||||
/** A proportion as its two parts (what counted and what did not), in units, with the shares */
|
||||
| { kind: 'split'; measure: string; yes: string; no: string; colors?: [string, string] }
|
||||
/** Each row's units by result (a bar in segments), and the share of the row's units with a
|
||||
* result that are `malignant`; a row with units and no result is not a row with none */
|
||||
| {
|
||||
kind: 'outcomes';
|
||||
measure: string;
|
||||
stratum: string;
|
||||
rows: Category[];
|
||||
results: Category[];
|
||||
malignant: string[];
|
||||
}
|
||||
| { kind: 'figure'; measure: string; figure: 'donut' | 'scenarios'; catalog?: Category[] }
|
||||
);
|
||||
|
||||
/** One bar: its length and quartile marks in % of the scale, and its cells of text. */
|
||||
export interface Bar {
|
||||
label: string;
|
||||
color?: string;
|
||||
width: number;
|
||||
marks: number[];
|
||||
cells: string[];
|
||||
/** the bar in parts (in % of the bar), each with what it says when hovered */
|
||||
segments?: { width: number; color: string; title: string }[];
|
||||
/** said in place of the bar (a row with nothing to draw) */
|
||||
none?: string;
|
||||
}
|
||||
export interface Bars {
|
||||
head: string[];
|
||||
rows: Bar[];
|
||||
/** the colours of the segments */
|
||||
legend?: { label: string; color: string }[];
|
||||
}
|
||||
|
||||
const pct = (n: number, of: number) => (of ? `${((100 * n) / of).toFixed(1)} %` : '—');
|
||||
const size = (cell?: Record<string, number>) => cell?.['initial-population'] ?? 0;
|
||||
const days = (n: number) => (Math.round(n * 10) / 10).toLocaleString('es-MX');
|
||||
|
||||
/** The bars of a mode; none when the period has nothing to draw. */
|
||||
export function bars(mode: Mode, of: (measure: string) => Reading | undefined): Bars | undefined {
|
||||
switch (mode.kind) {
|
||||
case 'counts': {
|
||||
const cells = of(mode.measure)?.strata['category'] ?? {};
|
||||
const total = Object.values(cells).reduce((n, c) => n + size(c), 0);
|
||||
if (!total) return undefined;
|
||||
// a category outside the catalog is listed after it, so the shares add up
|
||||
const named = mode.catalog.map((c) => c.code);
|
||||
const rest = Object.keys(cells).filter((c) => !named.includes(c));
|
||||
const all = [
|
||||
...mode.catalog,
|
||||
...rest.map((code) => ({ code, label: name(code), color: '#9AA3AB' })),
|
||||
];
|
||||
const most = mode.percent ? total : Math.max(...Object.values(cells).map(size));
|
||||
return {
|
||||
head: ['n', '%'],
|
||||
rows: all.map(({ code, label, color }) => {
|
||||
const n = size(cells[code]);
|
||||
const cols = [`${n}`, pct(n, total)];
|
||||
return { label, color, width: (100 * n) / most, marks: [], cells: cols };
|
||||
}),
|
||||
};
|
||||
}
|
||||
case 'shares': {
|
||||
const cells = of(mode.measure)?.strata[mode.stratum] ?? {};
|
||||
return ratios(
|
||||
mode.order
|
||||
.filter((c) => cells[c])
|
||||
.map((c) => [name(c), cells[c]['numerator'] ?? 0, cells[c]['denominator'] ?? 0]),
|
||||
);
|
||||
}
|
||||
case 'positives': {
|
||||
const cells = of(mode.measure)?.strata[`${mode.stratum}-category`] ?? {};
|
||||
const found = new Set(Object.keys(cells).map((k) => k.split('|')[0]));
|
||||
return ratios(
|
||||
mode.order
|
||||
.filter((c) => found.has(c))
|
||||
.map((c) => {
|
||||
const positive = size(cells[`${c}|positive`]);
|
||||
return [name(c), positive, positive + size(cells[`${c}|negative`])];
|
||||
}),
|
||||
);
|
||||
}
|
||||
case 'signs': {
|
||||
const strata = of(mode.measure)?.strata ?? {};
|
||||
return ratios(
|
||||
mode.strata
|
||||
.filter((s) => Object.keys(strata[s] ?? {}).length)
|
||||
.map((s) => {
|
||||
const positive = size(strata[s]['positive']);
|
||||
return [name(s), positive, positive + size(strata[s]['negative'])];
|
||||
}),
|
||||
);
|
||||
}
|
||||
case 'days':
|
||||
return medians(
|
||||
mode.steps.map(({ label, measure }) => {
|
||||
const r = of(measure);
|
||||
return { label, n: r?.populations['measure-observation'] ?? 0, score: r };
|
||||
}),
|
||||
);
|
||||
case 'days-by': {
|
||||
const r = of(mode.measure);
|
||||
const cells = r?.strata[mode.stratum] ?? {};
|
||||
return medians(
|
||||
Object.keys(cells)
|
||||
.map((c) => ({
|
||||
label: CIE10[c] ? `${c} · ${CIE10[c]}` : name(c),
|
||||
n: cells[c]['measure-observation'] ?? 0,
|
||||
score: r?.scores?.[mode.stratum]?.[c],
|
||||
}))
|
||||
.sort((a, b) => b.n - a.n),
|
||||
);
|
||||
}
|
||||
case 'split': {
|
||||
const { numerator = 0, denominator = 0 } = of(mode.measure)?.populations ?? {};
|
||||
if (!denominator) return undefined;
|
||||
const parts: [string, number][] = [
|
||||
[mode.yes, numerator],
|
||||
[mode.no, denominator - numerator],
|
||||
];
|
||||
return {
|
||||
head: ['n', '%'],
|
||||
rows: parts.map(([label, n], i) => ({
|
||||
label,
|
||||
color: mode.colors?.[i],
|
||||
width: (100 * n) / denominator,
|
||||
marks: [],
|
||||
cells: [`${n}`, pct(n, denominator)],
|
||||
})),
|
||||
};
|
||||
}
|
||||
case 'outcomes': {
|
||||
const r = of(mode.measure);
|
||||
const units = r?.strata[mode.stratum] ?? {};
|
||||
const cells = r?.strata[`${mode.stratum}-category`] ?? {};
|
||||
if (!Object.keys(units).length) return undefined;
|
||||
const graded = (i: number) => !['no_biopsy', 'no_data'].includes(mode.results[i].code);
|
||||
return {
|
||||
head: ['Pacientes', ...mode.results.map((x) => x.label), '% maligno'],
|
||||
legend: mode.results.map(({ label, color }) => ({ label, color })),
|
||||
rows: mode.rows.map(({ code, label }) => {
|
||||
const n = size(units[code]);
|
||||
const by = mode.results.map((x) => size(cells[`${code}|${x.code}`]));
|
||||
const den = by.reduce((t, k, i) => t + (graded(i) ? k : 0), 0);
|
||||
const bad = by.reduce(
|
||||
(t, k, i) => t + (mode.malignant.includes(mode.results[i].code) ? k : 0),
|
||||
0,
|
||||
);
|
||||
return {
|
||||
label,
|
||||
width: 100,
|
||||
marks: [],
|
||||
none: n ? undefined : 'Sin pacientes en el periodo',
|
||||
segments: mode.results.map((x, i) => ({
|
||||
width: n ? (100 * by[i]) / n : 0,
|
||||
color: x.color,
|
||||
title: `${x.label}: ${by[i]} de ${n} (${pct(by[i], n)})`,
|
||||
})),
|
||||
cells: [
|
||||
`${n}`,
|
||||
...by.map((k) => (n ? `${k}` : '—')),
|
||||
n
|
||||
? den
|
||||
? `${bad}/${den} (${pct(bad, den)})`
|
||||
: by[mode.results.findIndex((x) => x.code === 'no_data')]
|
||||
? 'Sin biopsias clasificables'
|
||||
: 'Sin biopsias'
|
||||
: '—',
|
||||
],
|
||||
};
|
||||
}),
|
||||
};
|
||||
}
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function ratios(rows: [string, number, number][]): Bars | undefined {
|
||||
if (!rows.length) return undefined;
|
||||
return {
|
||||
head: ['n/N', '%'],
|
||||
rows: rows.map(([label, n, total]) => ({
|
||||
label,
|
||||
width: total ? (100 * n) / total : 0,
|
||||
marks: [],
|
||||
cells: [`${n}/${total}`, pct(n, total)],
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
type Score = { score?: number; low?: number; high?: number };
|
||||
function medians(rows: { label: string; n: number; score?: Score }[]): Bars | undefined {
|
||||
if (!rows.some((r) => r.score?.score !== undefined)) return undefined;
|
||||
const top = Math.max(...rows.flatMap((r) => [r.score?.score ?? 0, r.score?.high ?? 0])) || 1;
|
||||
const at = (v: number) => (100 * v) / top;
|
||||
return {
|
||||
head: ['Mediana', 'n', 'Q1–Q3'],
|
||||
rows: rows.map(({ label, n, score: s }) => {
|
||||
if (s?.score === undefined) return { label, width: 0, marks: [], cells: ['—', `${n}`, '—'] };
|
||||
const spread = s.low !== undefined && s.high !== undefined ? [s.low, s.high] : [];
|
||||
return {
|
||||
label,
|
||||
width: at(s.score),
|
||||
marks: spread.map(at),
|
||||
cells: [`${days(s.score)} días`, `${n}`, spread.map(days).join('–') || '—'],
|
||||
};
|
||||
}),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/** The ICD-10 codes a cervical diagnosis is dated by (core.cacu DIAGNOSIS_ICD10). */
|
||||
export const CIE10: Record<string, string> = {
|
||||
Z014: 'Examen ginecológico',
|
||||
Z124: 'Pesquisa de tumor del cuello uterino',
|
||||
B977: 'Papilomavirus',
|
||||
R876: 'Citología cervical anormal',
|
||||
N870: 'Displasia cervical leve',
|
||||
N871: 'Displasia cervical moderada',
|
||||
N872: 'Displasia cervical severa',
|
||||
N879: 'Displasia cervical no especificada',
|
||||
D060: 'Carcinoma in situ del endocérvix',
|
||||
D061: 'Carcinoma in situ del exocérvix',
|
||||
D067: 'Carcinoma in situ de otras partes del cuello',
|
||||
D069: 'Carcinoma in situ del cuello',
|
||||
C530: 'Cáncer del endocérvix',
|
||||
C531: 'Cáncer del exocérvix',
|
||||
C538: 'Cáncer de sitios contiguos del cuello',
|
||||
C539: 'Cáncer del cuello uterino',
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
import { durationMax, durationRows } from './durations';
|
||||
import { Reading } from './measures';
|
||||
|
||||
const reading = (score?: number, n = 0, low?: number, high?: number): Reading => ({
|
||||
populations: { 'measure-observation': n },
|
||||
score,
|
||||
low,
|
||||
high,
|
||||
strata: {},
|
||||
});
|
||||
|
||||
describe('durationRows', () => {
|
||||
const reads: Record<string, Reading> = {
|
||||
A: reading(0, 3, 0, 1),
|
||||
B: reading(6, 20, 4, 8),
|
||||
C: reading(undefined, 0),
|
||||
};
|
||||
const rows = durationRows(
|
||||
[
|
||||
{ label: 'zero', measure: 'A' },
|
||||
{ label: 'value', measure: 'B' },
|
||||
{ label: 'nothing measured', measure: 'C' },
|
||||
{ label: 'no report', measure: 'D' },
|
||||
{ label: 'not in the catalog', measure: 'E' },
|
||||
{ label: 'no measure' },
|
||||
],
|
||||
(m) => reads[m],
|
||||
(m) => m !== 'E',
|
||||
);
|
||||
|
||||
it('keeps a real zero as a value', () => {
|
||||
expect(rows[0]).toEqual({
|
||||
label: 'zero',
|
||||
status: 'value',
|
||||
median: 0,
|
||||
observations: 3,
|
||||
low: 0,
|
||||
high: 1,
|
||||
});
|
||||
});
|
||||
it('tells no measurements from an unpublished measure', () => {
|
||||
expect(rows.map((r) => r.status)).toEqual([
|
||||
'value',
|
||||
'value',
|
||||
'empty',
|
||||
'empty',
|
||||
'unpublished',
|
||||
'unpublished',
|
||||
]);
|
||||
});
|
||||
it('scales from zero to the largest median or third quartile', () => {
|
||||
expect(durationMax(rows)).toBe(8);
|
||||
expect(durationMax([])).toBe(0);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,46 @@
|
||||
import { Reading } from './measures';
|
||||
|
||||
/** One step of a route: its name and the measure that times it. A step with no measure is
|
||||
* not published yet. */
|
||||
export interface RouteStep {
|
||||
label: string;
|
||||
measure?: string;
|
||||
}
|
||||
|
||||
/** One row of a duration table: the median days, how many measurements and the quartiles.
|
||||
* `empty` (published, nothing measured in the period) is not `unpublished` (no measure), and
|
||||
* neither is a zero: a median of 0 days is a value. */
|
||||
export interface DurationRow {
|
||||
label: string;
|
||||
status: 'value' | 'empty' | 'unpublished';
|
||||
median?: number;
|
||||
observations?: number;
|
||||
low?: number;
|
||||
high?: number;
|
||||
}
|
||||
|
||||
/** The rows of a route in one reading; every step keeps its row. `published` says which
|
||||
* measures the catalog has. */
|
||||
export function durationRows(
|
||||
steps: RouteStep[],
|
||||
read: (measure: string) => Reading | undefined,
|
||||
published: (measure: string) => boolean,
|
||||
): DurationRow[] {
|
||||
return steps.map(({ label, measure }) => {
|
||||
if (!measure || !published(measure)) return { label, status: 'unpublished' };
|
||||
const r = read(measure);
|
||||
if (r?.score === undefined) return { label, status: 'empty' };
|
||||
return {
|
||||
label,
|
||||
status: 'value',
|
||||
median: r.score,
|
||||
observations: r.populations['measure-observation'],
|
||||
low: r.low,
|
||||
high: r.high,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/** The scale of a table of durations, from zero: the largest median or third quartile shown. */
|
||||
export const durationMax = (rows: DurationRow[]): number =>
|
||||
Math.max(0, ...rows.map((r) => Math.max(r.median ?? 0, r.high ?? 0)));
|
||||
@@ -12,38 +12,6 @@ function rgba(hex: string, alpha: number): string {
|
||||
return `rgba(${v >> 16},${(v >> 8) & 255},${v & 255},${alpha})`;
|
||||
}
|
||||
|
||||
/** The screening route: each step's median days from the sample, with Q1–Q3. */
|
||||
export function routeFigure(steps: { label: string; r: Reading | undefined }[]): Figure {
|
||||
const shown = steps.filter((s) => s.r?.score !== undefined);
|
||||
return {
|
||||
data: [
|
||||
{
|
||||
type: 'bar',
|
||||
orientation: 'h',
|
||||
y: shown.map(
|
||||
(s) => `${s.label}<br>n = ${count(s.r!.populations['measure-observation'] ?? 0)}`,
|
||||
),
|
||||
x: shown.map((s) => s.r!.score!),
|
||||
marker: { color: OLIVE },
|
||||
error_x: {
|
||||
type: 'data',
|
||||
symmetric: false,
|
||||
thickness: 1.5,
|
||||
width: 6,
|
||||
array: shown.map((s) => (s.r!.high ?? s.r!.score!) - s.r!.score!),
|
||||
arrayminus: shown.map((s) => s.r!.score! - (s.r!.low ?? s.r!.score!)),
|
||||
},
|
||||
hovertemplate: '%{y}<br>mediana %{x} días<extra></extra>',
|
||||
} as Partial<Plotly.Data>,
|
||||
],
|
||||
layout: {
|
||||
showlegend: false,
|
||||
xaxis: { title: { text: 'Días' }, rangemode: 'tozero', zeroline: false },
|
||||
yaxis: { autorange: 'reversed', type: 'category', automargin: true },
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/** A category's count in the report (the composition's `category` stratum). */
|
||||
function counted(r: Reading, code: string): number {
|
||||
return r.strata['category']?.[code]?.['initial-population'] ?? 0;
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
import type { Sheet } from '../export';
|
||||
import { STATES } from '../paciente/stages';
|
||||
import type { Row } from './follow-up';
|
||||
import { name } from './measures';
|
||||
|
||||
const NONE = 'No disponible';
|
||||
const HEAD = [
|
||||
'Paciente',
|
||||
'CURP',
|
||||
'Edad',
|
||||
'Estatus',
|
||||
'Etapas',
|
||||
'Última citología',
|
||||
'VPH',
|
||||
'Biopsia',
|
||||
'LIEAG+',
|
||||
'Cáncer',
|
||||
'Días a diagnóstico',
|
||||
];
|
||||
|
||||
/** A cytology's result, or why it has none. */
|
||||
export function cytologyResult(c: NonNullable<Row['cytology']>): string {
|
||||
if (c.result) return name(c.result);
|
||||
return c.adequacy === 'unsatisfactory' ? 'Insatisfactoria' : 'Pendiente';
|
||||
}
|
||||
|
||||
const percent = (p?: number) => (p === undefined ? NONE : `${(100 * p).toFixed(1)} %`);
|
||||
|
||||
/** The follow-up list as a table to save, with the query it answers. */
|
||||
export function followUpSheet(rows: Row[], query: [string, string][]): Sheet {
|
||||
return {
|
||||
title: 'Resultados de seguimiento',
|
||||
query: [...query, ['Registros', `${rows.length}`]],
|
||||
head: HEAD,
|
||||
rows: rows.map((r) => [
|
||||
r.name ?? r.patient.id!.slice(0, 10),
|
||||
r.curp ?? NONE,
|
||||
`${r.age ?? NONE}`,
|
||||
name(r.status),
|
||||
r.stages
|
||||
.filter((s) => s.state !== 'unknown')
|
||||
.map((s) => `${s.label}: ${s.day ?? STATES[s.state]}`)
|
||||
.join('\n'),
|
||||
r.cytology ? `${cytologyResult(r.cytology)} (${r.cytology.date})` : NONE,
|
||||
r.hpv ? `${r.hpv.positive ? 'Positivo' : 'Negativo'} (${r.hpv.date})` : NONE,
|
||||
r.biopsy ? `${name(r.biopsy.histology ?? '') || 'Sin grado'} (${r.biopsy.date})` : NONE,
|
||||
percent(r.risk.cin2),
|
||||
percent(r.risk.cancer),
|
||||
`${r.daysToDiagnosis ?? NONE}`,
|
||||
]),
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { RiskAssessment } from 'fhir/r4';
|
||||
import { ageGroup, currentRisk, windowStart } from './follow-up';
|
||||
import { ageGroup, currentRisk, windowStart, ageAt, bornFor } from './follow-up';
|
||||
import { periods } from './measures';
|
||||
|
||||
describe('follow-up list', () => {
|
||||
@@ -45,3 +45,14 @@ describe('follow-up list', () => {
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('ages', () => {
|
||||
it('ask for the birth dates whose completed years fall in the range', () => {
|
||||
expect(bornFor('2026-06-30', 36, 40)).toEqual(['le1990-06-30', 'gt1985-06-30']);
|
||||
expect(bornFor('2026-06-30', null, null)).toEqual([]);
|
||||
expect(bornFor('2024-02-29', 1, null)).toEqual(['le2023-02-28']);
|
||||
expect([ageAt('1990-06-30', '2026-06-30'), ageAt('1990-07-01', '2026-06-30')]).toEqual([
|
||||
36, 35,
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { Bundle, DiagnosticReport, Observation, Patient, RiskAssessment } from 'fhir/r4';
|
||||
import { code, ext, resources } from '../fhir';
|
||||
import { route, Stage } from '../paciente/stages';
|
||||
|
||||
/** One row of the follow-up list: what the list shows of a patient at the cut-off. */
|
||||
export interface Row {
|
||||
@@ -8,6 +9,8 @@ export interface Row {
|
||||
curp?: string;
|
||||
status: string;
|
||||
ageGroup: string;
|
||||
age?: number;
|
||||
stages: Stage[];
|
||||
cytology?: { date: string; result?: string; adequacy?: string };
|
||||
hpv?: { date: string; positive: boolean; types1618?: boolean };
|
||||
daysToDiagnosis?: number;
|
||||
@@ -24,15 +27,36 @@ const AGE_GROUPS: [number, number][] = [
|
||||
[55, 64],
|
||||
];
|
||||
|
||||
/** Completed years at a day. */
|
||||
export function ageAt(birth: string | undefined, at: string): number | undefined {
|
||||
if (!birth) return undefined;
|
||||
const [by, bm, bd] = birth.split('-').map(Number);
|
||||
const [y, m, d] = at.split('-').map(Number);
|
||||
return y - by - (m < bm || (m === bm && d < bd) ? 1 : 0);
|
||||
}
|
||||
|
||||
/** The birth dates of who has completed between `from` and `to` years at a day, as FHIR's
|
||||
* `birthdate` parameter. */
|
||||
export function bornFor(at: string, from: number | null, to: number | null): string[] {
|
||||
const back = (years: number) => `${Number(at.slice(0, 4)) - years}${at.slice(4)}`;
|
||||
return [
|
||||
...(from === null ? [] : [`le${valid(back(from))}`]),
|
||||
...(to === null ? [] : [`gt${valid(back(to + 1))}`]),
|
||||
];
|
||||
}
|
||||
/** February 29th in a year without one: the 28th. */
|
||||
const valid = (day: string) =>
|
||||
day.endsWith('-02-29') && new Date(`${day}T00:00:00Z`).getUTCMonth() !== 1
|
||||
? `${day.slice(0, 8)}28`
|
||||
: day;
|
||||
|
||||
export function ageGroup(
|
||||
birth: string | undefined,
|
||||
at: string,
|
||||
groups: [number, number][] = AGE_GROUPS,
|
||||
): string {
|
||||
if (!birth) return 'Sin dato';
|
||||
const [by, bm, bd] = birth.split('-').map(Number);
|
||||
const [y, m, d] = at.split('-').map(Number);
|
||||
const age = y - by - (m < bm || (m === bm && d < bd) ? 1 : 0);
|
||||
const age = ageAt(birth, at);
|
||||
if (age === undefined) return 'Sin dato';
|
||||
const found = groups.find(([lo, hi]) => lo <= age && age <= hi);
|
||||
if (found) return `${found[0]}-${found[1]}`;
|
||||
return age < groups[0][0] ? `<${groups[0][0]}` : `${groups.at(-1)![1] + 1}+`;
|
||||
@@ -103,6 +127,8 @@ export function rows(page: Bundle, start: string, cutoff: string, horizon: numbe
|
||||
curp: patient.identifier?.find((i) => i.system === CURP)?.value,
|
||||
status: ext(patient, 'follow-up-status')?.valueCoding?.code ?? '',
|
||||
ageGroup: ageGroup(patient.birthDate, cutoff),
|
||||
age: ageAt(patient.birthDate, cutoff),
|
||||
stages: route(last, cutoff),
|
||||
cytology: last && {
|
||||
date: last.effectiveDateTime!,
|
||||
result: code(lastResults.get('cervical_cytology.result')?.valueCodeableConcept),
|
||||
|
||||
@@ -50,6 +50,8 @@ export interface Reading {
|
||||
high?: number;
|
||||
unit?: string;
|
||||
strata: Record<string, Record<string, Record<string, number>>>;
|
||||
/** A stratum value's own score (a median and its quartiles). */
|
||||
scores?: Record<string, Record<string, { score?: number; low?: number; high?: number }>>;
|
||||
}
|
||||
|
||||
function counts(group: {
|
||||
@@ -65,6 +67,7 @@ export function reading(report: MeasureReport | undefined): Reading | undefined
|
||||
if (!group) return undefined;
|
||||
const score = group.measureScore;
|
||||
const strata: Reading['strata'] = {};
|
||||
const scores: NonNullable<Reading['scores']> = {};
|
||||
for (const s of group.stratifier ?? []) {
|
||||
// A crossed stratifier (several codes) is keyed `a-b`, its strata `valueA|valueB`.
|
||||
const name = (s.code ?? []).map((c) => code(c) ?? c.text ?? '').join('-');
|
||||
@@ -76,6 +79,13 @@ export function reading(report: MeasureReport | undefined): Reading | undefined
|
||||
counts(x),
|
||||
]),
|
||||
);
|
||||
for (const { value, measureScore: own } of s.stratum ?? [])
|
||||
if (own)
|
||||
(scores[name] ??= {})[value?.text ?? ''] = {
|
||||
score: own.value,
|
||||
low: ext(own, 'q1')?.valueDecimal,
|
||||
high: ext(own, 'q3')?.valueDecimal,
|
||||
};
|
||||
}
|
||||
return {
|
||||
populations: counts(group),
|
||||
@@ -84,6 +94,7 @@ export function reading(report: MeasureReport | undefined): Reading | undefined
|
||||
high: (ext(score, 'ic-alto') ?? ext(score, 'q3'))?.valueDecimal,
|
||||
unit: score?.unit,
|
||||
strata,
|
||||
scores,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -122,6 +133,21 @@ export const LABELS: Record<string, string> = {
|
||||
good: 'Bueno',
|
||||
bad: 'Malo',
|
||||
not_analyzed: 'Sin analizar',
|
||||
initial: 'Inicial',
|
||||
subsequent: 'Subsecuente',
|
||||
positive: 'Positivo',
|
||||
negative: 'Negativo',
|
||||
hpv_16: 'VPH 16',
|
||||
hpv_18: 'VPH 18',
|
||||
ascus_plus: 'ASC-US o mayor',
|
||||
lsil_plus: 'LIEBG o mayor',
|
||||
hsil_plus: 'LIEAG o mayor',
|
||||
cin1_plus: 'Histología LIEBG o mayor',
|
||||
cin2_plus: 'Histología LIEAG o mayor',
|
||||
several: 'Varios códigos',
|
||||
no_result: 'Sin resultado de VPH',
|
||||
inconsistent: 'Inconsistente',
|
||||
no_grade: 'Sin grado',
|
||||
...Object.fromEntries(
|
||||
['0', '1', '2', '3', '4', '4A', '4B', '4C', '5', '6'].map((c) => [c, `BI-RADS ${c}`]),
|
||||
),
|
||||
@@ -134,6 +160,13 @@ export const STRATA: Record<string, string> = {
|
||||
follow_up_status: 'Estatus de seguimiento',
|
||||
result: 'Citología de alto grado',
|
||||
birads: 'BI-RADS de la mastografía',
|
||||
diagnosis_code: 'Diagnóstico CIE-10',
|
||||
cytology: 'Citología previa',
|
||||
hpv: 'VPH de la citología previa',
|
||||
level: 'Histología confirmada',
|
||||
round: 'Tamizaje inicial o subsecuente',
|
||||
hpv_16: 'VPH 16',
|
||||
hpv_18: 'VPH 18',
|
||||
};
|
||||
export const name = (value: string) => LABELS[value] ?? value;
|
||||
|
||||
@@ -149,14 +182,14 @@ export function formatScore(measure: Measure, r: Reading | undefined): string {
|
||||
}
|
||||
}
|
||||
|
||||
export function detail(measure: Measure, r: Reading | undefined): string {
|
||||
export function detail(measure: Measure, r: Reading | undefined, unit = 'pacientes'): string {
|
||||
if (!r) return '';
|
||||
const p = r.populations;
|
||||
switch (scoring(measure)) {
|
||||
case 'proportion':
|
||||
return r.score === undefined
|
||||
? 'Sin pacientes en el periodo.'
|
||||
: `${p['numerator']} de ${p['denominator']} pacientes. IC 95 %: ${pct(r.low)}–${pct(r.high)}.`;
|
||||
? `Sin ${unit} en el periodo.`
|
||||
: `${p['numerator']} de ${p['denominator']} ${unit}. IC 95 %: ${pct(r.low)}–${pct(r.high)}.`;
|
||||
case 'continuous-variable':
|
||||
return r.score === undefined
|
||||
? `${p['initial-population'] ?? 0} sin medición en el periodo.`
|
||||
|
||||
@@ -0,0 +1,280 @@
|
||||
import type { Mode } from './bars';
|
||||
import type { Catalog, Page, ReadingsCard } from './pages';
|
||||
|
||||
const OLIVE = '#A8C243';
|
||||
const ROSE = '#C24269';
|
||||
|
||||
/** Bethesda results as the old app grouped and coloured them. */
|
||||
const CYTOLOGY: Catalog = {
|
||||
groups: [
|
||||
{ id: 'normal', label: 'Sin anomalía', color: OLIVE },
|
||||
{ id: 'abnormal', label: 'Anormal', color: ROSE },
|
||||
],
|
||||
categories: [
|
||||
{ code: 'NILM', label: 'Normal', color: '#A8C243', group: 'normal' },
|
||||
{ code: 'ASC-US', label: 'ASC-US', color: '#92324F', group: 'abnormal' },
|
||||
{ code: 'LSIL', label: 'LIEBG', color: '#AA3A5C', group: 'abnormal' },
|
||||
{ code: 'ASC-H', label: 'ASC-H', color: '#C24269', group: 'abnormal' },
|
||||
{ code: 'HSIL', label: 'LIEAG', color: '#C54C71', group: 'abnormal' },
|
||||
{ code: 'CIS', label: 'Carcinoma in situ', color: '#C9577A', group: 'abnormal' },
|
||||
],
|
||||
};
|
||||
|
||||
/** Biopsy grades: below high grade, and high grade or worse (what confirmation counts). */
|
||||
const BIOPSY: Catalog = {
|
||||
groups: [
|
||||
{ id: 'low', label: 'Menor que LIEAG', color: OLIVE },
|
||||
{ id: 'high', label: 'LIEAG o más', color: ROSE },
|
||||
],
|
||||
categories: [
|
||||
{ code: 'normal', label: 'Normal', color: '#7E9232', group: 'low' },
|
||||
{ code: 'LSIL', label: 'LIEBG (CIN 1)', color: '#B2C958', group: 'low' },
|
||||
{ code: 'HSIL', label: 'LIEAG (CIN 2 y 3)', color: '#92324F', group: 'high' },
|
||||
{ code: 'CIS', label: 'Carcinoma in situ', color: '#C24269', group: 'high' },
|
||||
{ code: 'carcinoma', label: 'Carcinoma invasor', color: '#C9577A', group: 'high' },
|
||||
],
|
||||
faded: ['normal', 'LSIL'],
|
||||
};
|
||||
|
||||
/** HPV reports by genotype, and biopsy requests by what became of them. */
|
||||
const HPV = [
|
||||
{ code: 'negative', label: 'Negativo', color: '#A8C243' },
|
||||
{ code: 'positive_16', label: 'VPH 16', color: '#C24269' },
|
||||
{ code: 'positive_18', label: 'VPH 18', color: '#9C42C2' },
|
||||
{ code: 'positive_16_18', label: 'VPH 16 y 18', color: '#92324F' },
|
||||
{ code: 'positive_other', label: 'Otro de alto riesgo', color: '#C54C71' },
|
||||
{ code: 'positive_incomplete', label: 'Positivo, genotipo incompleto', color: '#C9577A' },
|
||||
];
|
||||
const REQUESTS = [
|
||||
{ code: 'high_grade', label: 'LIEAG o más', color: '#C24269' },
|
||||
{ code: 'below_high_grade', label: 'Menor que LIEAG', color: '#A8C243' },
|
||||
{ code: 'pending', label: 'Pendiente', color: '#C9CDD2' },
|
||||
{ code: 'no_grade', label: 'Sin grado', color: '#9AA3AB' },
|
||||
];
|
||||
|
||||
/** A PPV's card: the whole, and by each of its stratifiers. */
|
||||
const ppv = (measure: string, title: string, note: string, ...more: Mode[]): ReadingsCard => ({
|
||||
kind: 'readings',
|
||||
title,
|
||||
headline: measure,
|
||||
note: `${note} Confirma la histología LIEBG o mayor.`,
|
||||
modes: [
|
||||
{ kind: 'figure', label: 'Total', measure, figure: 'donut' },
|
||||
{
|
||||
kind: 'shares',
|
||||
label: 'Citología previa',
|
||||
caption: 'La última válida de los 365 días anteriores; cada grupo incluye los más severos.',
|
||||
measure,
|
||||
stratum: 'cytology',
|
||||
order: ['ascus_plus', 'lsil_plus', 'hsil_plus', 'no_data'],
|
||||
},
|
||||
{
|
||||
kind: 'shares',
|
||||
label: 'VPH previo',
|
||||
caption: 'Los grupos se traslapan.',
|
||||
measure,
|
||||
stratum: 'hpv',
|
||||
order: ['negative', 'positive', 'hpv_16', 'hpv_18', 'no_data'],
|
||||
},
|
||||
{
|
||||
kind: 'shares',
|
||||
label: 'Nivel de histología',
|
||||
measure,
|
||||
stratum: 'level',
|
||||
order: ['cin1_plus', 'cin2_plus', 'carcinoma'],
|
||||
},
|
||||
{
|
||||
kind: 'shares',
|
||||
label: 'Tamizaje',
|
||||
measure,
|
||||
stratum: 'round',
|
||||
order: ['initial', 'subsequent', 'no_data'],
|
||||
},
|
||||
...more,
|
||||
],
|
||||
});
|
||||
|
||||
const CACU_DAYS = {
|
||||
value: '{median} días (mediana)',
|
||||
note: '{obs} citologías; primer cuartil: {q1} días; tercer cuartil: {q3} días.',
|
||||
};
|
||||
export const CACU: Page = {
|
||||
anchor: 'CACU_EU7',
|
||||
kpis: [
|
||||
{
|
||||
measure: 'CACU_EU7',
|
||||
title: 'Pacientes evaluadas',
|
||||
value: '{n} pacientes',
|
||||
note: 'Pacientes con citología tomada en el periodo.',
|
||||
},
|
||||
{
|
||||
measure: 'CACU_EU_TIEMPO_REPORTE',
|
||||
title: 'Tiempo desde la toma de muestra al resultado',
|
||||
...CACU_DAYS,
|
||||
},
|
||||
{
|
||||
measure: 'CACU_DIAS_TOMA_DIAGNOSTICO',
|
||||
title: 'Tiempo de tamizaje a diagnóstico',
|
||||
...CACU_DAYS,
|
||||
},
|
||||
{
|
||||
measure: 'CACU_DIAS_TOMA_TRATAMIENTO',
|
||||
title: 'Tiempo de tamizaje a tratamiento',
|
||||
...CACU_DAYS,
|
||||
},
|
||||
{
|
||||
measure: 'CACU_DIAS_DIAGNOSTICO_TRATAMIENTO',
|
||||
title: 'Tiempo de diagnóstico a tratamiento',
|
||||
...CACU_DAYS,
|
||||
},
|
||||
],
|
||||
opportunity: [
|
||||
{
|
||||
kind: 'readings',
|
||||
title: 'Tiempos de la ruta del tamizaje',
|
||||
note: 'Mediana en días; las marcas son el primer y el tercer cuartil.',
|
||||
modes: [
|
||||
{
|
||||
kind: 'days',
|
||||
label: 'Acumulado desde la toma',
|
||||
steps: [
|
||||
{ label: 'Resultado de citología', measure: 'CACU_EU_TIEMPO_REPORTE' },
|
||||
{ label: 'Resultado de colposcopía', measure: 'CACU_DIAS_TOMA_COLPOSCOPIA' },
|
||||
{ label: 'Resultado de biopsia', measure: 'CACU_DIAS_TOMA_BIOPSIA' },
|
||||
{ label: 'Diagnóstico', measure: 'CACU_DIAS_TOMA_DIAGNOSTICO' },
|
||||
],
|
||||
},
|
||||
{
|
||||
kind: 'days',
|
||||
label: 'Por pasos',
|
||||
caption: 'Cada paso mide a sus propias pacientes: las medianas no se suman.',
|
||||
steps: [
|
||||
{ label: 'Toma a resultado de citología', measure: 'CACU_EU_TIEMPO_REPORTE' },
|
||||
{ label: 'Resultado a colposcopía', measure: 'CACU_DIAS_RESULTADO_COLPOSCOPIA' },
|
||||
{ label: 'Colposcopía a biopsia', measure: 'CACU_DIAS_COLPOSCOPIA_BIOPSIA' },
|
||||
{ label: 'Biopsia a diagnóstico', measure: 'CACU_DIAS_BIOPSIA_DIAGNOSTICO' },
|
||||
],
|
||||
},
|
||||
{
|
||||
kind: 'days-by',
|
||||
label: 'Por CIE-10',
|
||||
caption: 'Días de la toma al diagnóstico, por el código de la nota que lo fecha.',
|
||||
measure: 'CACU_TIEMPO_DIAGNOSTICO_CIE10',
|
||||
stratum: 'diagnosis_code',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
clinical: [
|
||||
{
|
||||
kind: 'columns',
|
||||
title: 'Resultados de citología, VPH y biopsia',
|
||||
sections: [
|
||||
{
|
||||
kind: 'readings',
|
||||
title: 'Distribución de resultados citológicos',
|
||||
note: 'Pacientes, por su última muestra válida del periodo.',
|
||||
modes: [
|
||||
{
|
||||
kind: 'counts',
|
||||
label: 'General',
|
||||
measure: 'CACU_EU7',
|
||||
catalog: CYTOLOGY.categories,
|
||||
},
|
||||
{
|
||||
kind: 'figure',
|
||||
label: 'Por escenario clínico',
|
||||
measure: 'CACU_EU7',
|
||||
figure: 'scenarios',
|
||||
catalog: CYTOLOGY.categories,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
kind: 'readings',
|
||||
title: 'Resultados de VPH por genotipo',
|
||||
note: 'Reportes, por fecha de toma.',
|
||||
modes: [{ kind: 'counts', label: 'General', measure: 'CACU_VPH_GENOTIPO', catalog: HPV }],
|
||||
},
|
||||
{
|
||||
kind: 'readings',
|
||||
title: 'Resultados de biopsia cervical',
|
||||
note: 'Reportes, por fecha de reporte.',
|
||||
modes: [
|
||||
{
|
||||
kind: 'counts',
|
||||
label: 'General',
|
||||
measure: 'CACU_BIOPSIA_RESULTADOS',
|
||||
catalog: BIOPSY.categories,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
kind: 'readings',
|
||||
title: 'Pacientes evaluadas por resultado de VPH',
|
||||
headline: 'CACU_VPH',
|
||||
note: 'Una vez cada paciente, por su última muestra con resultado.',
|
||||
modes: [
|
||||
{ kind: 'figure', label: 'Total', measure: 'CACU_VPH', figure: 'donut' },
|
||||
{
|
||||
kind: 'positives',
|
||||
label: 'Por grupo de edad',
|
||||
measure: 'CACU_VPH',
|
||||
stratum: 'age_group',
|
||||
order: ['<25', '25-34', '35-44', '45-54', '55-64', '65+', 'no_data'],
|
||||
},
|
||||
{
|
||||
kind: 'positives',
|
||||
label: 'Por estatus de seguimiento',
|
||||
measure: 'CACU_VPH',
|
||||
stratum: 'follow_up_status',
|
||||
order: ['pre_colposcopy', 'post_colposcopy', 'post_treatment', 'case'],
|
||||
},
|
||||
{
|
||||
kind: 'signs',
|
||||
label: 'Por genotipo',
|
||||
measure: 'CACU_VPH',
|
||||
strata: ['hpv_16', 'hpv_18'],
|
||||
},
|
||||
{
|
||||
kind: 'positives',
|
||||
label: 'Por tamizaje',
|
||||
measure: 'CACU_VPH',
|
||||
stratum: 'round',
|
||||
order: ['initial', 'subsequent', 'no_data'],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
kind: 'choice',
|
||||
title: 'Tasa de confirmación histopatológica',
|
||||
choices: [
|
||||
{
|
||||
label: 'Colposcopía',
|
||||
section: ppv(
|
||||
'CACU_VPP_COLPOSCOPIA',
|
||||
'Valor predictivo positivo de la colposcopía',
|
||||
'Pacientes con colposcopía en el periodo; biopsia solicitada en los 60 días siguientes.',
|
||||
),
|
||||
},
|
||||
{
|
||||
label: 'Biopsia',
|
||||
section: ppv(
|
||||
'CACU_VPP_BIOPSIA',
|
||||
'Valor predictivo positivo de la biopsia',
|
||||
'Pacientes con biopsia reportada, por fecha de solicitud.',
|
||||
{
|
||||
kind: 'counts',
|
||||
label: 'Solicitudes',
|
||||
caption: 'Solicitudes de biopsia registradas, según su resultado.',
|
||||
measure: 'CACU_BIOPSIA_SOLICITUD_CONFIRMACION',
|
||||
catalog: REQUESTS,
|
||||
},
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
+119
-155
@@ -1,3 +1,7 @@
|
||||
import type { Mode } from './bars';
|
||||
import { CACU } from './pages-cacu';
|
||||
import type { RouteStep } from './durations';
|
||||
|
||||
/** A domain's Indicadores page as the old app showed it (tests/fixtures/reference/<domain>/ui):
|
||||
* the timeliness cards with their own words, then the clinical sections and their figures.
|
||||
* Measures are named by their code (`Measure.name`). */
|
||||
@@ -17,8 +21,33 @@ export interface Kpi {
|
||||
value?: string;
|
||||
note?: string;
|
||||
}
|
||||
/** A card read one mode at a time; `headline` is the measure its score comes from. */
|
||||
export interface ReadingsCard {
|
||||
kind: 'readings';
|
||||
title: string;
|
||||
headline?: string;
|
||||
/** what the headline proportion counts, in the plural (default: pacientes) */
|
||||
unit?: string;
|
||||
note?: string;
|
||||
modes: Mode[];
|
||||
}
|
||||
export type Section =
|
||||
| { kind: 'route'; title: string; steps: { label: string; measure: string }[] }
|
||||
| ReadingsCard
|
||||
/** A screening route as one compact card: a bar per step with its median, observations and
|
||||
* quartiles. `sample` reads each step from the sample (its own measure, never a sum of
|
||||
* medians); `step` reads each from the previous step. A reading with no steps is not offered. */
|
||||
| { kind: 'route'; title: string; sample: RouteStep[]; step: RouteStep[] }
|
||||
/** Cards side by side; the last one alone when odd. */
|
||||
| { kind: 'columns'; title: string; sections: ReadingsCard[] }
|
||||
/** One section at a time. */
|
||||
/** `card`: the title, the tabs and the chosen reading in one card (the reading's own title is
|
||||
* left out: its tab names it) */
|
||||
| {
|
||||
kind: 'choice';
|
||||
title: string;
|
||||
choices: { label: string; section: ReadingsCard }[];
|
||||
card?: boolean;
|
||||
}
|
||||
| { kind: 'figures'; title?: string; figures: FigureSpec[] }
|
||||
| {
|
||||
kind: 'boxes';
|
||||
@@ -80,42 +109,6 @@ export interface Catalog {
|
||||
const OLIVE = '#A8C243';
|
||||
const ROSE = '#C24269';
|
||||
|
||||
/** Bethesda results as the old app grouped and coloured them. */
|
||||
const CYTOLOGY: Catalog = {
|
||||
groups: [
|
||||
{ id: 'normal', label: 'Sin anomalía', color: OLIVE },
|
||||
{ id: 'abnormal', label: 'Anormal', color: ROSE },
|
||||
],
|
||||
categories: [
|
||||
{ code: 'NILM', label: 'Normal', color: '#A8C243', group: 'normal' },
|
||||
{ code: 'ASC-US', label: 'ASC-US', color: '#92324F', group: 'abnormal' },
|
||||
{ code: 'LSIL', label: 'LIEBG', color: '#AA3A5C', group: 'abnormal' },
|
||||
{ code: 'ASC-H', label: 'ASC-H', color: '#C24269', group: 'abnormal' },
|
||||
{ code: 'HSIL', label: 'LIEAG', color: '#C54C71', group: 'abnormal' },
|
||||
{ code: 'CIS', label: 'Carcinoma in situ', color: '#C9577A', group: 'abnormal' },
|
||||
],
|
||||
};
|
||||
|
||||
/** Biopsy grades: below high grade, and high grade or worse (what confirmation counts). */
|
||||
const BIOPSY: Catalog = {
|
||||
groups: [
|
||||
{ id: 'low', label: 'Menor que LIEAG', color: OLIVE },
|
||||
{ id: 'high', label: 'LIEAG o más', color: ROSE },
|
||||
],
|
||||
categories: [
|
||||
{ code: 'normal', label: 'Normal', color: '#7E9232', group: 'low' },
|
||||
{ code: 'LSIL', label: 'LIEBG (CIN 1)', color: '#B2C958', group: 'low' },
|
||||
{ code: 'HSIL', label: 'LIEAG (CIN 2 y 3)', color: '#92324F', group: 'high' },
|
||||
{ code: 'CIS', label: 'Carcinoma in situ', color: '#C24269', group: 'high' },
|
||||
{ code: 'carcinoma', label: 'Carcinoma invasor', color: '#C9577A', group: 'high' },
|
||||
],
|
||||
faded: ['normal', 'LSIL'],
|
||||
};
|
||||
|
||||
const CACU_DAYS = {
|
||||
value: '{median} días (mediana)',
|
||||
note: '{obs} citologías; primer cuartil: {q1} días; tercer cuartil: {q3} días.',
|
||||
};
|
||||
const CAMA_DAYS = {
|
||||
value: '{median} días (mediana)',
|
||||
note: '{obs} mastografías; Q1 a Q3: {q1} a {q3} días.',
|
||||
@@ -134,17 +127,22 @@ const BIRADS: Catalog = {
|
||||
{ code: '6', label: 'BI-RADS 6', color: '#7A3496', group: '' },
|
||||
],
|
||||
};
|
||||
const BREAST_BIOPSY: Catalog = {
|
||||
groups: [
|
||||
{ id: 'benign', label: 'No maligno', color: '#42C29C' },
|
||||
{ id: 'malignant', label: 'Maligno', color: ROSE },
|
||||
],
|
||||
categories: [
|
||||
{ code: 'benign', label: 'Benigno', color: OLIVE, group: 'benign' },
|
||||
{ code: 'in_situ', label: 'Carcinoma in situ', color: '#9C42C2', group: 'malignant' },
|
||||
{ code: 'invasive', label: 'Carcinoma invasor', color: '#5C42C2', group: 'malignant' },
|
||||
],
|
||||
};
|
||||
|
||||
/** A breast biopsy's grades, and what stands in their place when there is none. */
|
||||
const BIOPSY_GRADES = [
|
||||
{ code: 'benign', label: 'Benigno', color: '#A8C243' },
|
||||
{ code: 'in_situ', label: 'Carcinoma in situ', color: '#9C42C2' },
|
||||
{ code: 'invasive', label: 'Carcinoma invasor', color: '#5C42C2' },
|
||||
];
|
||||
/** What «Sin biopsia» says, whatever the contract's category is called. */
|
||||
const NO_BIOPSY_MEANS =
|
||||
'«Sin biopsia»: no existe una biopsia vinculada según los datos disponibles.';
|
||||
const INSTITUTIONAL = '#A8C243';
|
||||
const NEUTRAL = '#C9CDD2';
|
||||
const NO_RESULT = [
|
||||
{ code: 'no_biopsy', label: 'Sin biopsia', color: '#C9CDD2' },
|
||||
{ code: 'no_data', label: 'Sin dato', color: '#8C949C' },
|
||||
];
|
||||
|
||||
export const PAGES: Record<string, Page> = {
|
||||
tea: {
|
||||
@@ -250,9 +248,9 @@ export const PAGES: Record<string, Page> = {
|
||||
},
|
||||
{
|
||||
measure: 'CAMA_TASA_DETECCION_HISTOPATOLOGICA',
|
||||
title: 'Tasa de confirmación histopatológica',
|
||||
title: 'Tasa de detección histopatológica',
|
||||
value: '{pct} %',
|
||||
note: '{num} de {den} biopsias con riesgo a carcinoma.',
|
||||
note: '{num} de {den} biopsias con grado conocido presentan carcinoma (in situ o invasor).',
|
||||
},
|
||||
{
|
||||
measure: 'CAMA_EU38A',
|
||||
@@ -272,21 +270,27 @@ export const PAGES: Record<string, Page> = {
|
||||
],
|
||||
opportunity: [
|
||||
{
|
||||
kind: 'boxes',
|
||||
kind: 'route',
|
||||
title: 'Tiempo de tamizaje a diagnóstico',
|
||||
subtitles: true,
|
||||
cards: [
|
||||
// from the mammography: only the two measures that start at it
|
||||
sample: [
|
||||
{ label: 'Interpretación radiológica', measure: 'CAMA_EU38A' },
|
||||
{
|
||||
measure: 'CAMA_EU38A',
|
||||
title: 'Tiempo de toma de mastografía a interpretación radiológica',
|
||||
label: 'Diagnóstico (tiempo total de tamizaje a diagnóstico)',
|
||||
measure: 'CAMA_DIAS_TOMA_DIAGNOSTICO',
|
||||
},
|
||||
],
|
||||
step: [
|
||||
{ label: 'Toma de mastografía a interpretación radiológica', measure: 'CAMA_EU38A' },
|
||||
{
|
||||
label: 'Interpretación radiológica a diagnóstico',
|
||||
measure: 'CAMA_DIAS_RESULTADO_DIAGNOSTICO',
|
||||
title: 'Tiempo de interpretación radiológica a diagnóstico',
|
||||
},
|
||||
{ title: 'Tiempo de interpretación radiológica a resultado de biopsia' },
|
||||
{ title: 'Tiempo de diagnóstico a tratamiento' },
|
||||
{ measure: 'CAMA_DIAS_TOMA_DIAGNOSTICO', title: 'Tiempo de tamizaje a diagnóstico' },
|
||||
{
|
||||
label: 'Interpretación radiológica a resultado de biopsia',
|
||||
measure: 'CAMA_DIAS_RESULTADO_BIOPSIA',
|
||||
},
|
||||
{ label: 'Diagnóstico a tratamiento' },
|
||||
],
|
||||
},
|
||||
],
|
||||
@@ -311,122 +315,82 @@ export const PAGES: Record<string, Page> = {
|
||||
],
|
||||
},
|
||||
{
|
||||
kind: 'figures',
|
||||
kind: 'readings',
|
||||
title: 'Resultado histopatológico por categoría BI-RADS',
|
||||
figures: [
|
||||
note: 'Pacientes: su mastografía BI-RADS 4, 5 o 6 más grave y su biopsia más grave reportada, por fecha del examen. El porcentaje maligno se calcula solo sobre las pacientes con biopsia con grado.',
|
||||
modes: [
|
||||
{
|
||||
kind: 'rates',
|
||||
title: 'Por categoría BI-RADS, {p}',
|
||||
kind: 'outcomes',
|
||||
label: 'Por categoría BI-RADS',
|
||||
heading: 'Resultados por paciente',
|
||||
caption: NO_BIOPSY_MEANS,
|
||||
measure: 'CAMA_HISTOPATOLOGIA_BIRADS',
|
||||
stratum: 'birads',
|
||||
rows: BIRADS.categories,
|
||||
colored: true,
|
||||
positive: ['in_situ', 'invasive'],
|
||||
axis: 'Porcentaje con resultado maligno',
|
||||
results: [...BIOPSY_GRADES, ...NO_RESULT],
|
||||
malignant: ['in_situ', 'invasive'],
|
||||
},
|
||||
{
|
||||
kind: 'donut',
|
||||
title: 'Resultado de la biopsia, {p}',
|
||||
kind: 'counts',
|
||||
label: 'Todas las categorías',
|
||||
heading: 'Resultados por paciente',
|
||||
caption: `Todas las categorías BI-RADS juntas. ${NO_BIOPSY_MEANS}`,
|
||||
measure: 'CAMA_HISTOPATOLOGIA_BIRADS',
|
||||
catalog: BREAST_BIOPSY,
|
||||
center: 'con resultado',
|
||||
catalog: [...BIOPSY_GRADES, ...NO_RESULT],
|
||||
percent: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
kind: 'card',
|
||||
measure: 'CAMA_CONFIRMACION_BIRADS45',
|
||||
title: 'Tasa de confirmación histopatológica',
|
||||
value: '{pct} %',
|
||||
note: '{num} de {den} mastografías BI-RADS 4 y 5 con reporte de biopsia.',
|
||||
},
|
||||
],
|
||||
},
|
||||
cacu: {
|
||||
anchor: 'CACU_EU7',
|
||||
kpis: [
|
||||
{
|
||||
measure: 'CACU_EU7',
|
||||
title: 'Pacientes evaluadas',
|
||||
value: '{n} pacientes',
|
||||
note: 'Pacientes con citología tomada en el periodo.',
|
||||
},
|
||||
{
|
||||
measure: 'CACU_EU_TIEMPO_REPORTE',
|
||||
title: 'Tiempo desde la toma de muestra al resultado',
|
||||
...CACU_DAYS,
|
||||
},
|
||||
{
|
||||
measure: 'CACU_DIAS_TOMA_DIAGNOSTICO',
|
||||
title: 'Tiempo de tamizaje a diagnóstico',
|
||||
...CACU_DAYS,
|
||||
},
|
||||
{
|
||||
measure: 'CACU_DIAS_TOMA_TRATAMIENTO',
|
||||
title: 'Tiempo de tamizaje a tratamiento',
|
||||
...CACU_DAYS,
|
||||
},
|
||||
{
|
||||
measure: 'CACU_DIAS_DIAGNOSTICO_TRATAMIENTO',
|
||||
title: 'Tiempo de diagnóstico a tratamiento',
|
||||
...CACU_DAYS,
|
||||
},
|
||||
],
|
||||
clinical: [
|
||||
{
|
||||
kind: 'route',
|
||||
title: 'Tiempos de la ruta del tamizaje',
|
||||
steps: [
|
||||
{ label: 'Resultado de citología', measure: 'CACU_EU_TIEMPO_REPORTE' },
|
||||
{ label: 'Resultado de colposcopía', measure: 'CACU_DIAS_TOMA_COLPOSCOPIA' },
|
||||
{ label: 'Resultado de biopsia', measure: 'CACU_DIAS_TOMA_BIOPSIA' },
|
||||
{ label: 'Diagnóstico', measure: 'CACU_DIAS_TOMA_DIAGNOSTICO' },
|
||||
],
|
||||
},
|
||||
{
|
||||
kind: 'figures',
|
||||
title: 'Distribución de resultados citológicos',
|
||||
figures: [
|
||||
kind: 'choice',
|
||||
title: 'Confirmación histopatológica',
|
||||
card: true,
|
||||
choices: [
|
||||
{
|
||||
kind: 'donut',
|
||||
title: 'Distribución de resultados, {p}',
|
||||
measure: 'CACU_EU7',
|
||||
catalog: CYTOLOGY,
|
||||
center: 'pacientes',
|
||||
label: 'Resultado de biopsias',
|
||||
section: {
|
||||
kind: 'readings',
|
||||
title: 'Resultado de biopsias',
|
||||
headline: 'CAMA_TASA_DETECCION_HISTOPATOLOGICA',
|
||||
unit: 'biopsias',
|
||||
note: 'Biopsias con resultado reportado, por fecha del reporte (no son pacientes ni mastografías). La tasa divide los carcinomas (in situ o invasor) entre biopsias con grado conocido. Los porcentajes de la distribución incluyen todas las biopsias reportadas, también «Sin dato» (sin grado), por lo que sus denominadores pueden ser distintos.',
|
||||
modes: [
|
||||
{
|
||||
kind: 'counts',
|
||||
label: 'Biopsias reportadas',
|
||||
heading: 'Biopsias reportadas',
|
||||
measure: 'CAMA_BIOPSIAS',
|
||||
catalog: [...BIOPSY_GRADES, NO_RESULT[1]],
|
||||
percent: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
kind: 'scenario-bars',
|
||||
title: 'TOTAL por escenario clínico, {p}',
|
||||
measure: 'CACU_EU7',
|
||||
catalog: CYTOLOGY,
|
||||
stratum: 'follow_up_status',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
kind: 'figures',
|
||||
title: 'Tasa de confirmación histopatológica',
|
||||
figures: [
|
||||
{
|
||||
kind: 'rates',
|
||||
title: 'Por resultado de la citología, {p}',
|
||||
measure: 'CACU_CONFIRMACION_CITOLOGIA',
|
||||
stratum: 'result',
|
||||
rows: CYTOLOGY.categories.filter((c) => ['ASC-H', 'HSIL', 'CIS'].includes(c.code)),
|
||||
positive: ['HSIL', 'CIS', 'carcinoma'],
|
||||
axis: 'Verdaderos positivos (valor predictivo positivo)',
|
||||
},
|
||||
{
|
||||
kind: 'donut',
|
||||
title: 'Resultado de la biopsia, {p}',
|
||||
measure: 'CACU_CONFIRMACION_CITOLOGIA',
|
||||
catalog: BIOPSY,
|
||||
center: 'con biopsia',
|
||||
label: 'Mastografías con biopsia',
|
||||
section: {
|
||||
kind: 'readings',
|
||||
title: 'Mastografías con biopsia',
|
||||
headline: 'CAMA_CONFIRMACION_BIRADS45',
|
||||
unit: 'mastografías',
|
||||
note: 'Mastografías BI-RADS 4, 4A, 4B, 4C o 5 con reporte, por fecha del examen: cuántas tienen un reporte de biopsia. Mide el seguimiento, no el resultado de la biopsia; no es equivalente a la tasa de detección.',
|
||||
modes: [
|
||||
{
|
||||
kind: 'split',
|
||||
label: 'Con y sin biopsia',
|
||||
measure: 'CAMA_CONFIRMACION_BIRADS45',
|
||||
yes: 'Con reporte de biopsia',
|
||||
no: 'Sin reporte de biopsia',
|
||||
colors: [INSTITUTIONAL, NEUTRAL],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
cacu: CACU,
|
||||
};
|
||||
|
||||
/** One panel of Trazabilidad (tests/fixtures/reference/<domain>/ui, tab "Trazabilidad"): a
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
import { Component, computed, input, signal } from '@angular/core';
|
||||
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
||||
import { Loading } from '../loading';
|
||||
import { Figure, Plot } from '../plot';
|
||||
import { bars, Mode } from './bars';
|
||||
import { Reading } from './measures';
|
||||
|
||||
/** A card read one mode at a time: its title, its headline, the toggle and the bars. */
|
||||
@Component({
|
||||
selector: 'app-readings',
|
||||
host: { '[class.cama]': 'camaStyle()' },
|
||||
imports: [Loading, MatButtonToggleModule, Plot],
|
||||
template: `
|
||||
@if (!hideTitle()) {
|
||||
<h3 class="title">{{ title() }}</h3>
|
||||
}
|
||||
@if (headline()) {
|
||||
<p class="headline">{{ headline() }}</p>
|
||||
}
|
||||
@if (note()) {
|
||||
<p class="state">{{ note() }}</p>
|
||||
}
|
||||
@if (modes().length > 1) {
|
||||
<mat-button-toggle-group
|
||||
[attr.aria-label]="title()"
|
||||
[value]="mode().label"
|
||||
(change)="chosen.set($event.value)"
|
||||
>
|
||||
@for (m of modes(); track m.label) {
|
||||
<mat-button-toggle [value]="m.label">{{ m.label }}</mat-button-toggle>
|
||||
}
|
||||
</mat-button-toggle-group>
|
||||
}
|
||||
@if (mode().heading) {
|
||||
<h4 class="heading">{{ mode().heading }}</h4>
|
||||
}
|
||||
@if (mode().caption) {
|
||||
<p class="state">{{ mode().caption }}</p>
|
||||
}
|
||||
@if (loading()) {
|
||||
<app-loading what="la figura" [figure]="true" />
|
||||
} @else if (figure(); as f) {
|
||||
<app-plot [figure]="f" [height]="300" />
|
||||
} @else if (table(); as t) {
|
||||
<table [attr.aria-label]="mode().label">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
@for (h of t.head; track h) {
|
||||
<th>{{ h }}</th>
|
||||
}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (row of t.rows; track row.label) {
|
||||
<tr>
|
||||
<th scope="row">
|
||||
{{ row.label }}
|
||||
@if (row.none) {
|
||||
<span class="none">{{ row.none }}</span>
|
||||
} @else {
|
||||
<span class="track" [class.parts]="!!row.segments" aria-hidden="true">
|
||||
@if (row.segments; as parts) {
|
||||
@for (p of parts; track $index) {
|
||||
<span
|
||||
class="bar"
|
||||
[style.width.%]="p.width"
|
||||
[style.background]="p.color"
|
||||
[attr.title]="p.title"
|
||||
></span>
|
||||
}
|
||||
} @else {
|
||||
<span
|
||||
class="bar"
|
||||
[style.width.%]="row.width"
|
||||
[style.background]="row.color"
|
||||
></span>
|
||||
}
|
||||
@for (m of row.marks; track $index) {
|
||||
<span class="mark" [style.left.%]="m"></span>
|
||||
}
|
||||
</span>
|
||||
}
|
||||
</th>
|
||||
@for (c of row.cells; track $index) {
|
||||
<td>{{ c }}</td>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
@if (t.legend; as legend) {
|
||||
<p class="legend">
|
||||
@for (l of legend; track l.label) {
|
||||
<span><i [style.background]="l.color"></i>{{ l.label }}</span>
|
||||
}
|
||||
</p>
|
||||
}
|
||||
} @else {
|
||||
<p class="state">Sin datos en el periodo.</p>
|
||||
}
|
||||
`,
|
||||
styles: `
|
||||
:host {
|
||||
display: block;
|
||||
min-width: 0;
|
||||
}
|
||||
:host(.cama) {
|
||||
overflow-x: auto;
|
||||
}
|
||||
.title {
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
:host(.cama) .title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.heading {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
margin: 12px 0 4px;
|
||||
}
|
||||
.headline {
|
||||
font-weight: 500;
|
||||
}
|
||||
:host(.cama) .headline {
|
||||
margin: 8px 0;
|
||||
}
|
||||
:host(.cama) .state {
|
||||
color: var(--color-text-secondary);
|
||||
font-size: 13px;
|
||||
margin: 8px 0;
|
||||
}
|
||||
mat-button-toggle-group {
|
||||
flex-wrap: wrap;
|
||||
margin: 4px 0;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
:host(.cama) table {
|
||||
font-size: 13px;
|
||||
}
|
||||
:host(.cama) thead th {
|
||||
font-weight: 500;
|
||||
}
|
||||
th,
|
||||
td {
|
||||
font-weight: 400;
|
||||
padding: 4px 6px;
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
th[scope='row'] {
|
||||
text-align: left;
|
||||
white-space: normal;
|
||||
width: 60%;
|
||||
}
|
||||
.track {
|
||||
background: rgba(0, 0, 0, 0.06);
|
||||
display: block;
|
||||
height: 8px;
|
||||
position: relative;
|
||||
}
|
||||
.bar {
|
||||
background: #a8c243;
|
||||
display: block;
|
||||
height: 100%;
|
||||
}
|
||||
.parts {
|
||||
display: flex;
|
||||
}
|
||||
.none {
|
||||
color: rgba(0, 0, 0, 0.6);
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
}
|
||||
.legend {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
font-size: 12px;
|
||||
gap: 4px 16px;
|
||||
margin: 8px 0 0;
|
||||
}
|
||||
.legend i {
|
||||
display: inline-block;
|
||||
height: 10px;
|
||||
margin-right: 6px;
|
||||
width: 10px;
|
||||
}
|
||||
.mark {
|
||||
background: #333;
|
||||
height: 12px;
|
||||
position: absolute;
|
||||
top: -2px;
|
||||
width: 2px;
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class Readings {
|
||||
readonly title = input.required<string>();
|
||||
readonly headline = input('');
|
||||
readonly note = input('');
|
||||
/** the card around it names it already (tabs inside one card) */
|
||||
readonly hideTitle = input(false);
|
||||
readonly camaStyle = input(false);
|
||||
readonly modes = input.required<Mode[]>();
|
||||
readonly loading = input(false);
|
||||
/** A measure's reading in the applied period, and the figure of a mode that has one. */
|
||||
readonly read = input.required<(measure: string) => Reading | undefined>();
|
||||
readonly draw = input.required<(mode: Mode) => Figure | undefined>();
|
||||
|
||||
protected readonly chosen = signal('');
|
||||
protected readonly mode = computed(
|
||||
() => this.modes().find((m) => m.label === this.chosen()) ?? this.modes()[0],
|
||||
);
|
||||
protected readonly table = computed(() => bars(this.mode(), this.read()));
|
||||
protected readonly figure = computed(() =>
|
||||
this.mode().kind === 'figure' ? this.draw()(this.mode()) : undefined,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
import { Component, input, signal } from '@angular/core';
|
||||
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { Loading } from '../loading';
|
||||
import { DurationRow, durationMax } from './durations';
|
||||
|
||||
/** A screening route as one compact card: a bar per step with its median, its observations
|
||||
* and its quartiles, read step by step or cumulatively from the sample. A step that is not
|
||||
* published, or has no measurements in the period, keeps its row and says so. */
|
||||
@Component({
|
||||
selector: 'app-route-card',
|
||||
imports: [Loading, MatButtonToggleModule, MatCardModule],
|
||||
template: `
|
||||
<mat-card appearance="outlined">
|
||||
<mat-card-content>
|
||||
<div class="head">
|
||||
<h3>{{ title() }}</h3>
|
||||
@if (sample().length && step().length) {
|
||||
<mat-button-toggle-group
|
||||
aria-label="Lectura de los tiempos"
|
||||
[value]="mode()"
|
||||
(change)="mode.set($event.value)"
|
||||
>
|
||||
<mat-button-toggle value="step">Por pasos</mat-button-toggle>
|
||||
<mat-button-toggle value="sample">Acumulado desde la toma</mat-button-toggle>
|
||||
</mat-button-toggle-group>
|
||||
}
|
||||
</div>
|
||||
@if (loading()) {
|
||||
<app-loading what="los tiempos" [figure]="true" />
|
||||
} @else {
|
||||
@let rows = mode() === 'sample' ? sample() : step();
|
||||
@let max = scale(rows);
|
||||
<p class="state">
|
||||
@if (mode() === 'sample') {
|
||||
Mediana de días desde la toma de la mastografía hasta cada etapa; cada medida se
|
||||
calcula por separado.
|
||||
} @else {
|
||||
Cada barra es la mediana de su paso, desde cero y por separado; los pasos pueden
|
||||
corresponder a poblaciones diferentes, por lo que las medianas no se suman.
|
||||
}
|
||||
Las marcas indican el primer y tercer cuartil.
|
||||
@if (max) {
|
||||
Escala: 0 a {{ max }} días.
|
||||
}
|
||||
</p>
|
||||
<table [attr.aria-label]="title()">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ mode() === 'sample' ? 'Etapa' : 'Paso' }}</th>
|
||||
<th>Mediana</th>
|
||||
<th>Observaciones</th>
|
||||
<th>Q1–Q3</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (row of rows; track row.label) {
|
||||
<tr [attr.data-status]="row.status">
|
||||
<th scope="row">
|
||||
{{ row.label }}
|
||||
@if (row.status === 'value') {
|
||||
<span class="track" aria-hidden="true">
|
||||
<span
|
||||
class="bar"
|
||||
[style.width.%]="max ? (100 * row.median!) / max : 0"
|
||||
></span>
|
||||
@if (row.low !== undefined && row.high !== undefined) {
|
||||
<span
|
||||
class="mark"
|
||||
[style.left.%]="max ? (100 * row.low) / max : 0"
|
||||
></span>
|
||||
<span
|
||||
class="mark"
|
||||
[style.left.%]="max ? (100 * row.high) / max : 0"
|
||||
></span>
|
||||
}
|
||||
</span>
|
||||
} @else {
|
||||
<span class="none">
|
||||
{{
|
||||
row.status === 'empty'
|
||||
? 'Sin mediciones en el periodo'
|
||||
: 'Indicador no publicado'
|
||||
}}
|
||||
</span>
|
||||
}
|
||||
</th>
|
||||
<td>{{ row.status === 'value' ? row.median + ' días' : '—' }}</td>
|
||||
<td>{{ row.observations ?? '—' }}</td>
|
||||
<td>
|
||||
{{
|
||||
row.low === undefined || row.high === undefined
|
||||
? '—'
|
||||
: row.low + '–' + row.high
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
`,
|
||||
styles: `
|
||||
:host {
|
||||
display: block;
|
||||
margin-top: 24px;
|
||||
}
|
||||
.head {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-3);
|
||||
justify-content: space-between;
|
||||
}
|
||||
h3 {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
margin: 0;
|
||||
}
|
||||
.state {
|
||||
color: var(--color-text-secondary);
|
||||
font-size: 13px;
|
||||
margin: 8px 0;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
font-size: 13px;
|
||||
width: 100%;
|
||||
}
|
||||
th {
|
||||
font-weight: 500;
|
||||
text-align: left;
|
||||
}
|
||||
th[scope='row'] {
|
||||
padding: 5px 0;
|
||||
}
|
||||
td,
|
||||
thead th:not(:first-child) {
|
||||
font-variant-numeric: tabular-nums;
|
||||
padding-left: 12px;
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.track {
|
||||
background: #eef1f3;
|
||||
display: block;
|
||||
height: 8px;
|
||||
margin-top: 3px;
|
||||
position: relative;
|
||||
}
|
||||
.bar {
|
||||
background: #42a77e;
|
||||
display: block;
|
||||
height: 100%;
|
||||
}
|
||||
.mark {
|
||||
background: #17324d;
|
||||
height: 14px;
|
||||
position: absolute;
|
||||
top: -3px;
|
||||
width: 2px;
|
||||
}
|
||||
.none {
|
||||
color: var(--color-text-secondary);
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
margin-top: 3px;
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class RouteCard {
|
||||
readonly title = input.required<string>();
|
||||
/** The rows from the sample, and the rows step by step. */
|
||||
readonly sample = input.required<DurationRow[]>();
|
||||
readonly step = input.required<DurationRow[]>();
|
||||
readonly loading = input(false);
|
||||
|
||||
protected readonly mode = signal<'sample' | 'step'>('step');
|
||||
protected readonly scale = durationMax;
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
import { Component, computed, input, signal } from '@angular/core';
|
||||
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import type { Measure } from 'fhir/r4';
|
||||
import { Mode } from './bars';
|
||||
import { scenarioBars } from './figures';
|
||||
import { detail, donut, formatScore, name, Reading, scoring } from './measures';
|
||||
import type { ReadingsCard, Section } from './pages';
|
||||
import { Readings } from './readings';
|
||||
|
||||
/** The applied period's readings and the measures they are of. */
|
||||
export interface Source {
|
||||
loading: boolean;
|
||||
reading: (measure: string) => Reading | undefined;
|
||||
measure: (name: string) => Measure | undefined;
|
||||
}
|
||||
type Shown = Extract<Section, { kind: 'readings' | 'columns' | 'choice' }>;
|
||||
|
||||
/** A card of readings, several side by side, or one of several at a time. */
|
||||
@Component({
|
||||
selector: 'app-section',
|
||||
imports: [MatButtonToggleModule, MatCardModule, Readings],
|
||||
template: `
|
||||
@let s = section();
|
||||
@if (s.kind === 'readings') {
|
||||
<mat-card appearance="outlined">
|
||||
<mat-card-content>
|
||||
<app-readings
|
||||
[title]="s.title"
|
||||
[camaStyle]="hasCamaHeading(s)"
|
||||
[headline]="headlineOf(s)"
|
||||
[note]="s.note ?? ''"
|
||||
[modes]="s.modes"
|
||||
[loading]="of().loading"
|
||||
[read]="of().reading"
|
||||
[draw]="draw()"
|
||||
/>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
} @else if (s.kind === 'choice' && s.card) {
|
||||
@let open = chosen() || s.choices[0].label;
|
||||
<mat-card appearance="outlined" class="choice-card">
|
||||
<mat-card-content>
|
||||
<h3 class="title">{{ s.title }}</h3>
|
||||
<mat-button-toggle-group
|
||||
[attr.aria-label]="s.title"
|
||||
[value]="open"
|
||||
(change)="chosen.set($event.value)"
|
||||
>
|
||||
@for (c of s.choices; track c.label) {
|
||||
<mat-button-toggle [value]="c.label">{{ c.label }}</mat-button-toggle>
|
||||
}
|
||||
</mat-button-toggle-group>
|
||||
@for (c of s.choices; track c.label) {
|
||||
@if (c.label === open) {
|
||||
<app-readings
|
||||
[title]="c.section.title"
|
||||
[hideTitle]="true"
|
||||
[camaStyle]="true"
|
||||
[headline]="headlineOf(c.section)"
|
||||
[note]="c.section.note ?? ''"
|
||||
[modes]="c.section.modes"
|
||||
[loading]="of().loading"
|
||||
[read]="of().reading"
|
||||
[draw]="draw()"
|
||||
/>
|
||||
}
|
||||
}
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
} @else {
|
||||
<h2>{{ s.title }}</h2>
|
||||
@if (s.kind === 'columns') {
|
||||
<div class="columns">
|
||||
@for (inner of s.sections; track $index) {
|
||||
<app-section [section]="inner" [of]="of()" />
|
||||
}
|
||||
</div>
|
||||
} @else {
|
||||
@let open = chosen() || s.choices[0].label;
|
||||
<mat-button-toggle-group
|
||||
[attr.aria-label]="s.title"
|
||||
[value]="open"
|
||||
(change)="chosen.set($event.value)"
|
||||
>
|
||||
@for (c of s.choices; track c.label) {
|
||||
<mat-button-toggle [value]="c.label">{{ c.label }}</mat-button-toggle>
|
||||
}
|
||||
</mat-button-toggle-group>
|
||||
@for (c of s.choices; track c.label) {
|
||||
@if (c.label === open) {
|
||||
<app-section [section]="c.section" [of]="of()" />
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
styles: `
|
||||
:host {
|
||||
display: block;
|
||||
margin-top: 24px;
|
||||
min-width: 0;
|
||||
}
|
||||
.title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
.choice-card app-readings {
|
||||
margin-top: 8px;
|
||||
}
|
||||
.columns {
|
||||
display: grid;
|
||||
column-gap: 16px;
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr));
|
||||
}
|
||||
.columns > :last-child:nth-child(odd) {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class ReadingsSection {
|
||||
readonly section = input.required<Shown>();
|
||||
readonly of = input.required<Source>();
|
||||
protected readonly chosen = signal('');
|
||||
|
||||
protected hasCamaHeading(s: ReadingsCard): boolean {
|
||||
return s.modes.some((mode) => !!mode.heading);
|
||||
}
|
||||
|
||||
/** A reading card's headline: its measure's score and its counts, in its own units. */
|
||||
protected headlineOf(s: ReadingsCard): string {
|
||||
const code = s.headline;
|
||||
const measure = code && this.of().measure(code);
|
||||
const r = code && this.of().reading(code);
|
||||
if (!measure || !r) return '';
|
||||
const words = detail(measure, r, s.unit);
|
||||
return scoring(measure) === 'cohort' ? words : `${formatScore(measure, r)} · ${words}`;
|
||||
}
|
||||
protected readonly draw = computed(() => (mode: Mode) => {
|
||||
if (mode.kind !== 'figure') return undefined;
|
||||
const r = this.of().reading(mode.measure);
|
||||
const measure = this.of().measure(mode.measure);
|
||||
if (!measure || !r?.populations['initial-population']) return undefined;
|
||||
if (mode.figure === 'donut') return donut(measure, r);
|
||||
const categories = (mode.catalog ?? []).map((c) => ({ ...c, group: '' }));
|
||||
return scenarioBars(r, { groups: [], categories }, 'follow_up_status', name);
|
||||
});
|
||||
}
|
||||
@@ -85,15 +85,18 @@
|
||||
|
||||
<ng-template #sectionView let-section let-period="period">
|
||||
@switch (section.kind) {
|
||||
@case ('readings')
|
||||
@case ('columns')
|
||||
@case ('choice') {
|
||||
<app-section [section]="section" [of]="of()" />
|
||||
}
|
||||
@case ('route') {
|
||||
<h3 class="route-title">{{ section.title }}</h3>
|
||||
@if (reports.isLoading()) {
|
||||
<app-loading what="los tiempos de la ruta" [figure]="true" />
|
||||
} @else if (routeOf(section); as fig) {
|
||||
<app-plot [figure]="fig" [height]="300" />
|
||||
} @else {
|
||||
<p class="state">Sin tiempos publicados en el periodo.</p>
|
||||
}
|
||||
<app-route-card
|
||||
[title]="section.title"
|
||||
[sample]="stepRows(section, 'sample')"
|
||||
[step]="stepRows(section, 'step')"
|
||||
[loading]="reports.isLoading()"
|
||||
/>
|
||||
}
|
||||
@case ('tea-summary') {
|
||||
@if (teaSummary(); as t) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import { MatSelectModule } from '@angular/material/select';
|
||||
import type { Measure, MeasureReport } from 'fhir/r4';
|
||||
import { Fhir, resources } from '../fhir';
|
||||
import { Figure, Plot } from '../plot';
|
||||
import { DurationRow, durationRows } from './durations';
|
||||
import { LAYOUTS } from './layout';
|
||||
import {
|
||||
ageShare,
|
||||
@@ -17,7 +18,6 @@ import {
|
||||
fill,
|
||||
nestedDonut,
|
||||
rateDots,
|
||||
routeFigure,
|
||||
scenarioBars,
|
||||
shareDonut,
|
||||
} from './figures';
|
||||
@@ -38,6 +38,8 @@ import {
|
||||
strataBars,
|
||||
} from './measures';
|
||||
import { Loading } from '../loading';
|
||||
import { RouteCard } from './route-card';
|
||||
import { ReadingsSection, Source } from './section';
|
||||
|
||||
/** The period's indicators: the timeliness KPIs, the screening route, and a card per
|
||||
* clinical measure with its figures. */
|
||||
@@ -52,6 +54,8 @@ import { Loading } from '../loading';
|
||||
MatCardModule,
|
||||
MatSelectModule,
|
||||
Plot,
|
||||
ReadingsSection,
|
||||
RouteCard,
|
||||
],
|
||||
templateUrl: './tab-indicadores.html',
|
||||
styleUrl: './tab-indicadores.scss',
|
||||
@@ -193,6 +197,15 @@ export class TabIndicadores {
|
||||
}
|
||||
protected readonly name = name;
|
||||
|
||||
protected stepRows(section: Section, mode: 'sample' | 'step'): DurationRow[] {
|
||||
if (section.kind !== 'route') return [];
|
||||
return durationRows(
|
||||
section[mode],
|
||||
(code) => this.rd(code),
|
||||
(code) => this.byName().has(code),
|
||||
);
|
||||
}
|
||||
|
||||
/** A measure's reading in the applied period, by code. */
|
||||
protected rd(code: string): Reading | undefined {
|
||||
return this.loaded()?.get(code);
|
||||
@@ -264,12 +277,15 @@ export class TabIndicadores {
|
||||
protected measureTitle(code: string | undefined): string {
|
||||
return (code && this.byName().get(code)?.title) || '';
|
||||
}
|
||||
/** A clinical section's route or figures, drawn from the applied period's reports. */
|
||||
protected routeOf(section: Section): Figure | undefined {
|
||||
if (section.kind !== 'route') return undefined;
|
||||
const steps = section.steps.map((s) => ({ label: s.label, r: this.rd(s.measure) }));
|
||||
return steps.some((s) => s.r?.score !== undefined) ? routeFigure(steps) : undefined;
|
||||
}
|
||||
/** What a section of readings is drawn from. */
|
||||
protected readonly of = computed<Source>(() => {
|
||||
const found = this.loaded();
|
||||
return {
|
||||
loading: this.reports.isLoading(),
|
||||
reading: (code) => found?.get(code),
|
||||
measure: (code) => this.byName().get(code),
|
||||
};
|
||||
});
|
||||
protected figureOf(spec: FigureSpec): Figure | undefined {
|
||||
const r = this.rd(spec.measure);
|
||||
if (!r || !(r.populations['initial-population'] ?? 0)) return undefined;
|
||||
|
||||
@@ -10,6 +10,30 @@
|
||||
name="cutoff"
|
||||
/>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" subscriptSizing="dynamic">
|
||||
<mat-label>Edad mínima</mat-label>
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
min="0"
|
||||
max="120"
|
||||
[ngModel]="ageFrom()"
|
||||
(ngModelChange)="setAge(ageFrom, $event)"
|
||||
name="ageFrom"
|
||||
/>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" subscriptSizing="dynamic">
|
||||
<mat-label>Edad máxima</mat-label>
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
min="0"
|
||||
max="120"
|
||||
[ngModel]="ageTo()"
|
||||
(ngModelChange)="setAge(ageTo, $event)"
|
||||
name="ageTo"
|
||||
/>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" subscriptSizing="dynamic">
|
||||
<mat-label>Ventana de meses</mat-label>
|
||||
<mat-select [value]="window()" (selectionChange)="window.set($event.value)">
|
||||
@@ -51,7 +75,26 @@
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<button
|
||||
mat-stroked-button
|
||||
type="button"
|
||||
[disabled]="saving() || !applied()"
|
||||
(click)="save('xlsx')"
|
||||
>
|
||||
Exportar Excel
|
||||
</button>
|
||||
<button
|
||||
mat-stroked-button
|
||||
type="button"
|
||||
[disabled]="saving() || !applied()"
|
||||
(click)="save('pdf')"
|
||||
>
|
||||
Exportar PDF
|
||||
</button>
|
||||
</form>
|
||||
@if (saveError()) {
|
||||
<p class="muted" role="alert">{{ saveError() }}</p>
|
||||
}
|
||||
|
||||
@if (error()) {
|
||||
<p class="muted" role="alert">
|
||||
@@ -72,8 +115,9 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Paciente</th>
|
||||
<th>Grupo de edad</th>
|
||||
<th>Edad</th>
|
||||
<th>Estatus de seguimiento</th>
|
||||
<th>Etapas</th>
|
||||
<th>Última citología</th>
|
||||
<th>Último resultado de VPH</th>
|
||||
<th>Última biopsia</th>
|
||||
@@ -87,24 +131,34 @@
|
||||
@for (row of rows(); track row.patient.id) {
|
||||
<tr>
|
||||
<td>
|
||||
<a [routerLink]="['/indicadores', domain(), 'pacientes', row.patient.id]">{{
|
||||
row.name ?? row.patient.id!.slice(0, 10)
|
||||
}}</a>
|
||||
<a
|
||||
[routerLink]="['/indicadores', domain(), 'pacientes', row.patient.id]"
|
||||
[queryParams]="{ corte: applied(), citologia: row.cytology?.date }"
|
||||
>{{ row.name ?? row.patient.id!.slice(0, 10) }}</a
|
||||
>
|
||||
@if (row.curp) {
|
||||
<div class="muted curp">{{ row.curp }}</div>
|
||||
}
|
||||
</td>
|
||||
<td>{{ row.ageGroup }}</td>
|
||||
<td>
|
||||
{{ row.age ?? 'No disponible' }}
|
||||
<small>Grupo: {{ row.ageGroup }}</small>
|
||||
</td>
|
||||
<td>{{ name(row.status) }}</td>
|
||||
<td>
|
||||
<app-stages [stages]="row.stages" />
|
||||
<button
|
||||
mat-button
|
||||
type="button"
|
||||
[attr.aria-expanded]="opened() === row.patient.id"
|
||||
(click)="toggle(row)"
|
||||
>
|
||||
Detalle
|
||||
</button>
|
||||
</td>
|
||||
<td>
|
||||
@if (row.cytology; as c) {
|
||||
{{
|
||||
c.result
|
||||
? name(c.result)
|
||||
: c.adequacy === 'unsatisfactory'
|
||||
? 'Insatisfactoria'
|
||||
: 'Pendiente'
|
||||
}}
|
||||
{{ result(c) }}
|
||||
<small>Fecha: {{ c.date }}</small>
|
||||
<small>Calidad: {{ c.adequacy ? name(c.adequacy) : '—' }}</small>
|
||||
} @else {
|
||||
@@ -154,10 +208,15 @@
|
||||
<td>{{ latest(row) ?? 'No disponible' }}</td>
|
||||
<td class="num">{{ row.daysToDiagnosis ?? 'No disponible' }}</td>
|
||||
</tr>
|
||||
@if (opened() === row.patient.id) {
|
||||
<tr class="stage-detail">
|
||||
<td colspan="11"><app-stages [stages]="row.stages" [detail]="true" /></td>
|
||||
</tr>
|
||||
}
|
||||
} @empty {
|
||||
@if (page() && !loading()) {
|
||||
<tr>
|
||||
<td colspan="10" class="muted">No hay registros para los filtros aplicados.</td>
|
||||
<td colspan="11" class="muted">No hay registros para los filtros aplicados.</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { Component, computed, inject, input, resource, signal } from '@angular/core';
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
inject,
|
||||
input,
|
||||
resource,
|
||||
signal,
|
||||
WritableSignal,
|
||||
} from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
@@ -8,7 +16,10 @@ import { MatSelectModule } from '@angular/material/select';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import type { Bundle } from 'fhir/r4';
|
||||
import { Fhir } from '../fhir';
|
||||
import { Row, rows, windowStart } from './follow-up';
|
||||
import { saveExcel, savePdf } from '../export';
|
||||
import { Stages } from '../paciente/stages';
|
||||
import { cytologyResult, followUpSheet } from './follow-up-sheet';
|
||||
import { bornFor, Row, rows, windowStart } from './follow-up';
|
||||
import { PatientSearch, patientSearch } from './patient-search';
|
||||
import { Loading } from '../loading';
|
||||
import { name } from './measures';
|
||||
@@ -29,6 +40,7 @@ const STATUSES = ['case', 'pre_colposcopy', 'post_colposcopy', 'post_treatment']
|
||||
MatInputModule,
|
||||
MatSelectModule,
|
||||
RouterLink,
|
||||
Stages,
|
||||
],
|
||||
templateUrl: './tab-riesgos.html',
|
||||
styleUrl: './tab-riesgos.scss',
|
||||
@@ -45,30 +57,37 @@ export class TabRiesgos {
|
||||
protected readonly size = signal(20);
|
||||
/** "Buscar paciente": her name, CURP or record number, as applied. */
|
||||
protected readonly search = signal('');
|
||||
/** Completed years at the cut-off (none: no limit). */
|
||||
protected readonly ageFrom = signal<number | null>(null);
|
||||
protected readonly ageTo = signal<number | null>(null);
|
||||
protected readonly saving = signal(false);
|
||||
protected readonly saveError = signal('');
|
||||
/** Whose stages are shown in full. */
|
||||
protected readonly opened = signal<string | undefined>(undefined);
|
||||
/** A page the user moved to (`next`/`previous`), else the first. */
|
||||
private readonly moved = signal<Bundle | undefined>(undefined);
|
||||
|
||||
protected readonly statuses = STATUSES;
|
||||
protected readonly name = name;
|
||||
protected readonly result = cytologyResult;
|
||||
|
||||
/** The list as it is asked for, whatever the page. */
|
||||
private readonly query = computed(() => ({
|
||||
'follow-up-window': this.window(),
|
||||
...patientSearch(this.search()),
|
||||
birthdate: bornFor(this.cutoff(), this.ageFrom(), this.ageTo()),
|
||||
'follow-up-cutoff': this.cutoff() || undefined,
|
||||
'follow-up-status': this.status() || undefined,
|
||||
'risk-horizon': this.horizon(),
|
||||
_sort: this.sort(),
|
||||
_revinclude: ['DiagnosticReport:subject', 'RiskAssessment:subject'],
|
||||
'_include:iterate': 'DiagnosticReport:result',
|
||||
}));
|
||||
private readonly first = resource({
|
||||
params: () => ({
|
||||
domain: this.domain(),
|
||||
'follow-up-window': this.window(),
|
||||
...patientSearch(this.search()),
|
||||
'follow-up-cutoff': this.cutoff() || undefined,
|
||||
'follow-up-status': this.status() || undefined,
|
||||
'risk-horizon': this.horizon(),
|
||||
_sort: this.sort(),
|
||||
_count: this.size(),
|
||||
}),
|
||||
loader: ({ params: { domain, ...params } }) => {
|
||||
params: () => ({ domain: this.domain(), query: this.query(), size: this.size() }),
|
||||
loader: ({ params: { domain, query, size } }) => {
|
||||
this.moved.set(undefined);
|
||||
return this.fhir.search(domain, 'Patient', {
|
||||
...params,
|
||||
_revinclude: ['DiagnosticReport:subject', 'RiskAssessment:subject'],
|
||||
'_include:iterate': 'DiagnosticReport:result',
|
||||
});
|
||||
return this.fhir.search(domain, 'Patient', { ...query, _count: size });
|
||||
},
|
||||
});
|
||||
protected readonly loading = signal(false);
|
||||
@@ -113,6 +132,42 @@ export class TabRiesgos {
|
||||
this.first.reload();
|
||||
}
|
||||
|
||||
/** Ages are told at the cut-off: the one shown becomes the one asked for. */
|
||||
protected setAge(age: WritableSignal<number | null>, years: number | null): void {
|
||||
if (!this.cutoff()) this.cutoff.set(this.applied());
|
||||
age.set(years);
|
||||
}
|
||||
|
||||
/** The whole list, not the page shown, as a file. */
|
||||
protected async save(kind: 'xlsx' | 'pdf'): Promise<void> {
|
||||
this.saving.set(true);
|
||||
this.saveError.set('');
|
||||
try {
|
||||
const cutoff = this.applied();
|
||||
const asked = { ...this.query(), 'follow-up-cutoff': cutoff, _count: 200 };
|
||||
const pages = await this.fhir.all(this.domain(), 'Patient', asked);
|
||||
const start = windowStart(cutoff, this.window());
|
||||
const all = pages.flatMap((p) => rows(p, start, cutoff, this.horizon()));
|
||||
const sheet = followUpSheet(all, [
|
||||
['Ventana consultada', `${start} al ${cutoff}`],
|
||||
['Estatus de seguimiento', this.status() ? name(this.status()) : 'Todos'],
|
||||
['Edad mínima', `${this.ageFrom() ?? 'Sin límite'}`],
|
||||
['Edad máxima', `${this.ageTo() ?? 'Sin límite'}`],
|
||||
['Búsqueda', this.search() || 'Ninguna'],
|
||||
['Horizonte de la probabilidad (años)', `${this.horizon()}`],
|
||||
]);
|
||||
if (kind === 'xlsx') await saveExcel(sheet, 'seguimiento-cacu');
|
||||
else await savePdf([sheet], 'seguimiento-cacu', true);
|
||||
} catch {
|
||||
this.saveError.set('No se generó el archivo.');
|
||||
} finally {
|
||||
this.saving.set(false);
|
||||
}
|
||||
}
|
||||
protected toggle(row: Row): void {
|
||||
this.opened.set(this.opened() === row.patient.id ? undefined : row.patient.id);
|
||||
}
|
||||
|
||||
protected has(relation: 'next' | 'previous'): boolean {
|
||||
return !!this.page()?.link?.some((l) => l.relation === relation);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,12 @@
|
||||
<dt>Fecha de nacimiento</dt>
|
||||
<dd>{{ p.birthDate ?? 'Sin dato' }}</dd>
|
||||
</div>
|
||||
@if (stages()) {
|
||||
<div>
|
||||
<dt>Edad</dt>
|
||||
<dd>{{ age() ?? 'Sin dato' }}</dd>
|
||||
</div>
|
||||
}
|
||||
<div>
|
||||
<dt>Sexo</dt>
|
||||
<dd>
|
||||
@@ -101,6 +107,20 @@
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
}
|
||||
@if (stages(); as s) {
|
||||
<mat-card appearance="outlined" class="wide" data-section="etapas">
|
||||
<mat-card-header><mat-card-title>Etapas del tamizaje</mat-card-title></mat-card-header>
|
||||
<mat-card-content>
|
||||
<app-stages [stages]="s" [detail]="true" />
|
||||
<button mat-stroked-button type="button" [disabled]="saving()" (click)="save()">
|
||||
Exportar PDF
|
||||
</button>
|
||||
@if (saveError()) {
|
||||
<p class="muted" role="alert">{{ saveError() }}</p>
|
||||
}
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
}
|
||||
<mat-card appearance="outlined">
|
||||
<mat-card-header><mat-card-title>Historial médico</mat-card-title></mat-card-header>
|
||||
<mat-card-content>
|
||||
@@ -169,6 +189,7 @@
|
||||
><mat-card-title>Riesgos y recomendaciones</mat-card-title></mat-card-header
|
||||
>
|
||||
<mat-card-content>
|
||||
<app-risk-scales [scales]="scales()" />
|
||||
@if (models().length) {
|
||||
<table class="plain">
|
||||
<thead>
|
||||
|
||||
@@ -19,7 +19,11 @@ import { readReport$Json } from '../api/fn/models/read-report-json';
|
||||
import type { Domain } from '../api/models/domain';
|
||||
import { code, EXT, ext, Fhir, label, resources } from '../fhir';
|
||||
import { scenarioFigure } from '../gobernanza/figures';
|
||||
import { ageGroup, CAMA_AGE_GROUPS, camaRows, CURP } from '../indicadores/follow-up';
|
||||
import { savePdf } from '../export';
|
||||
import { recordSheets } from './record-sheets';
|
||||
import { riskScales, RiskScales } from './risk-scales';
|
||||
import { route, Stages } from './stages';
|
||||
import { ageAt, ageGroup, CAMA_AGE_GROUPS, camaRows, CURP } from '../indicadores/follow-up';
|
||||
import { LABELS, name, PRIORITY } from '../indicadores/measures';
|
||||
import {
|
||||
BIOMARKER_NAMES,
|
||||
@@ -60,6 +64,8 @@ function shown(o: Observation): string {
|
||||
MatIconModule,
|
||||
RouterLink,
|
||||
Plot,
|
||||
RiskScales,
|
||||
Stages,
|
||||
],
|
||||
templateUrl: './paciente.html',
|
||||
styleUrl: './paciente.scss',
|
||||
@@ -72,6 +78,8 @@ export class Paciente {
|
||||
/** The follow-up list she was opened from: its window (months) and cut-off. */
|
||||
readonly ventana = input<string>();
|
||||
readonly corte = input<string>();
|
||||
/** CaCu: the day of the cytology the list showed of her. */
|
||||
readonly citologia = input<string>();
|
||||
|
||||
private readonly data = resource({
|
||||
params: () => ({ domain: this.domain(), id: this.id() }),
|
||||
@@ -119,6 +127,50 @@ export class Paciente {
|
||||
})),
|
||||
].sort((a, b) => b.date.localeCompare(a.date));
|
||||
});
|
||||
private readonly cutoff = computed(() => this.corte() ?? new Date().toLocaleDateString('sv'));
|
||||
protected readonly age = computed(() => ageAt(this.patient()?.birthDate, this.cutoff()));
|
||||
/** CaCu: the route of the cytology she was opened at, else of her latest, by the cut-off. */
|
||||
protected readonly stages = computed(() => {
|
||||
const cytologies = (this.data.value()?.reports ?? []).filter(
|
||||
(r) => code(r.code) === 'cervical_cytology',
|
||||
);
|
||||
const shown = cytologies.find((r) => r.effectiveDateTime === this.citologia()) ?? cytologies[0];
|
||||
return this.domain() === 'cacu' ? route(shown, this.cutoff()) : undefined;
|
||||
});
|
||||
protected readonly scales = computed(() =>
|
||||
this.domain() === 'cacu' ? riskScales(this.models()) : [],
|
||||
);
|
||||
protected readonly saving = signal(false);
|
||||
protected readonly saveError = signal('');
|
||||
/** CaCu: her record as a PDF. */
|
||||
protected async save(): Promise<void> {
|
||||
this.saving.set(true);
|
||||
this.saveError.set('');
|
||||
try {
|
||||
const { name: who, curp, numbers } = this.identity();
|
||||
const facts: [string, string | undefined][] = [
|
||||
['Nombre', who],
|
||||
['CURP', curp],
|
||||
['Expedientes', numbers.join(', ')],
|
||||
['Fecha de nacimiento', this.patient()?.birthDate],
|
||||
['Edad', this.age()?.toString()],
|
||||
['Estatus de seguimiento', this.status()],
|
||||
['Fecha de corte', this.cutoff()],
|
||||
];
|
||||
const sheets = recordSheets(
|
||||
facts,
|
||||
this.stages() ?? [],
|
||||
this.history(),
|
||||
this.tests(),
|
||||
this.scales(),
|
||||
);
|
||||
await savePdf(sheets, 'expediente-cacu');
|
||||
} catch {
|
||||
this.saveError.set('No se generó el archivo.');
|
||||
} finally {
|
||||
this.saving.set(false);
|
||||
}
|
||||
}
|
||||
protected readonly tests = computed(() => {
|
||||
const d = this.data.value();
|
||||
if (!d) return [];
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import type { Sheet } from '../export';
|
||||
import type { RiskScale } from './risk-scales';
|
||||
import { Stage, STATES } from './stages';
|
||||
|
||||
const NONE = 'No disponible';
|
||||
const percent = (p: number) => `${(100 * p).toFixed(2)} %`;
|
||||
|
||||
interface Event {
|
||||
date: string;
|
||||
kind: string;
|
||||
text: string;
|
||||
}
|
||||
interface Test {
|
||||
date: string;
|
||||
kind: string;
|
||||
reported?: string;
|
||||
results: string[];
|
||||
}
|
||||
|
||||
/** A patient's record as the tables of her PDF, in the page's order. */
|
||||
export function recordSheets(
|
||||
facts: [string, string | undefined][],
|
||||
stages: Stage[],
|
||||
history: Event[],
|
||||
tests: Test[],
|
||||
scales: RiskScale[],
|
||||
): Sheet[] {
|
||||
return [
|
||||
{
|
||||
title: 'Datos de la paciente',
|
||||
head: ['Dato', 'Valor'],
|
||||
rows: facts.map(([k, v]) => [k, v || NONE]),
|
||||
},
|
||||
{
|
||||
title: 'Etapas del tamizaje',
|
||||
head: ['Etapa', 'Estado', 'Fecha'],
|
||||
rows: stages.map((s) => [s.label, STATES[s.state], s.day ?? '']),
|
||||
},
|
||||
{
|
||||
title: 'Historial médico',
|
||||
head: ['Fecha', 'Tipo', 'Detalle'],
|
||||
rows: history.map((h) => [h.date, h.kind, h.text]),
|
||||
},
|
||||
{
|
||||
title: 'Pruebas y resultados',
|
||||
head: ['Toma', 'Estudio', 'Reporte', 'Resultados'],
|
||||
rows: tests.map((t) => [t.date, t.kind, t.reported ?? 'Pendiente', t.results.join(' · ')]),
|
||||
},
|
||||
{
|
||||
title: 'Riesgos',
|
||||
head: ['Riesgo', 'Probabilidad', 'IC 95 %'],
|
||||
rows: scales.map(({ label, risk }) => [
|
||||
label,
|
||||
risk ? percent(risk.p) : NONE,
|
||||
risk?.low === undefined ? NONE : `${percent(risk.low)} a ${percent(risk.high!)}`,
|
||||
]),
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { Component, input } from '@angular/core';
|
||||
|
||||
interface Prediction {
|
||||
years: number;
|
||||
p: number;
|
||||
low?: number;
|
||||
high?: number;
|
||||
}
|
||||
export interface RiskScale {
|
||||
label: string;
|
||||
risk?: Prediction;
|
||||
}
|
||||
|
||||
/** Each model's risk at its index visit and at five years; none where it gives no such horizon. */
|
||||
export function riskScales(models: { text: string; predictions: Prediction[] }[]): RiskScale[] {
|
||||
return models.flatMap((m) =>
|
||||
[0, 5].map((years) => ({
|
||||
label: `${m.text}, riesgo ${years ? 'a 5 años' : 'inmediato'}`,
|
||||
risk: m.predictions.find((p) => p.years === years),
|
||||
})),
|
||||
);
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-risk-scales',
|
||||
imports: [DecimalPipe],
|
||||
template: `
|
||||
@for (s of scales(); track s.label) {
|
||||
<div class="scale">
|
||||
<span>{{ s.label }}</span>
|
||||
<div class="line">
|
||||
@if (s.risk; as r) {
|
||||
<span class="mark" [style.left.%]="r.p * 100"></span>
|
||||
}
|
||||
</div>
|
||||
@if (s.risk; as r) {
|
||||
<strong>{{ r.p * 100 | number: '1.1-2' }} %</strong>
|
||||
@if (r.low !== undefined) {
|
||||
<span>
|
||||
IC 95 %: {{ r.low * 100 | number: '1.1-2' }}–{{ r.high! * 100 | number: '1.1-2' }} %
|
||||
</span>
|
||||
}
|
||||
} @else {
|
||||
<strong>No disponible</strong>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
`,
|
||||
styles: `
|
||||
.scale {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.line {
|
||||
background: linear-gradient(to right, #a8c243, #c24269);
|
||||
flex: 1 1 200px;
|
||||
height: 8px;
|
||||
position: relative;
|
||||
}
|
||||
.mark {
|
||||
background: #333;
|
||||
height: 16px;
|
||||
position: absolute;
|
||||
top: -4px;
|
||||
width: 3px;
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class RiskScales {
|
||||
readonly scales = input.required<RiskScale[]>();
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { EXT } from '../fhir';
|
||||
import { route } from './stages';
|
||||
|
||||
const ext = (name: string, value: object) => ({ url: EXT + name, ...value });
|
||||
const cytology = (...extension: object[]): any => ({ effectiveDateTime: '2026-01-10', extension });
|
||||
|
||||
describe('the route of a cytology', () => {
|
||||
it('says what is recorded, inferred, pending and unknown, by the cut-off', () => {
|
||||
const report = cytology(
|
||||
ext('colposcopy-date', { valueDate: '2026-02-01' }),
|
||||
ext('biopsy-request-date', { valueDate: '2026-02-01' }),
|
||||
ext('biopsy-date', { valueDate: '2026-03-01' }),
|
||||
ext('biopsy-link', { valueCode: 'recorded' }),
|
||||
);
|
||||
const states = (cutoff: string) => route(report, cutoff).map((s) => s.state);
|
||||
expect(states('2026-12-31')).toEqual([
|
||||
'recorded',
|
||||
'unknown',
|
||||
'inferred',
|
||||
'recorded',
|
||||
'unknown',
|
||||
]);
|
||||
expect(states('2026-02-15')[3]).toBe('pending');
|
||||
expect(states('2026-01-15').slice(2)).toEqual(['unknown', 'unknown', 'unknown']);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,121 @@
|
||||
import { Component, computed, input } from '@angular/core';
|
||||
import type { DiagnosticReport } from 'fhir/r4';
|
||||
import { ext } from '../fhir';
|
||||
|
||||
/** A step of the route that a cytology starts. A day with no state is unknown. */
|
||||
export interface Stage {
|
||||
label: string;
|
||||
day?: string;
|
||||
state: 'recorded' | 'inferred' | 'pending' | 'unknown';
|
||||
}
|
||||
|
||||
export const STATES: Record<Stage['state'], string> = {
|
||||
recorded: 'Registrada',
|
||||
inferred: 'Inferida por fechas',
|
||||
pending: 'Pendiente',
|
||||
unknown: 'Sin dato',
|
||||
};
|
||||
|
||||
/** The route of one cytology, as its report says it, by `cutoff`. */
|
||||
export function route(cytology: DiagnosticReport | undefined, cutoff: string): Stage[] {
|
||||
const by = (day?: string) => (day && day.slice(0, 10) <= cutoff ? day.slice(0, 10) : undefined);
|
||||
const at = (name: string) => by(ext(cytology, name)?.valueDate);
|
||||
const step = (label: string, day: string | undefined, known: Stage['state']): Stage => ({
|
||||
label,
|
||||
day,
|
||||
state: day ? known : 'unknown',
|
||||
});
|
||||
const linked = ext(cytology, 'biopsy-link')?.valueCode === 'recorded' ? 'recorded' : 'inferred';
|
||||
const biopsy = step('Reporte de biopsia', at('biopsy-date'), linked);
|
||||
if (!biopsy.day && at('biopsy-request-date')) biopsy.state = 'pending';
|
||||
return [
|
||||
step('Toma de muestra', by(cytology?.effectiveDateTime), 'recorded'),
|
||||
step('Resultado de citología', at('report-date'), 'recorded'),
|
||||
step('Colposcopía', at('colposcopy-date'), 'inferred'),
|
||||
biopsy,
|
||||
step('Diagnóstico', at('diagnosis-date'), 'inferred'),
|
||||
];
|
||||
}
|
||||
|
||||
/** Whole days between two days; none when either is missing or they are out of order. */
|
||||
export function between(from?: string, to?: string): number | undefined {
|
||||
if (!from || !to || to < from) return undefined;
|
||||
return Math.round((Date.parse(to) - Date.parse(from)) / 86_400_000);
|
||||
}
|
||||
|
||||
/** The stages as a line of dots; `detail` adds each one's state, day and days elapsed. */
|
||||
@Component({
|
||||
selector: 'app-stages',
|
||||
template: `
|
||||
<ol [class.detail]="detail()">
|
||||
@for (s of shown(); track s.label) {
|
||||
<li [title]="s.label + ': ' + s.text">
|
||||
<span class="dot" [class]="s.state"></span>
|
||||
@if (detail()) {
|
||||
<strong>{{ s.label }}</strong>
|
||||
<span>{{ s.text }}</span>
|
||||
@if (s.day) {
|
||||
<span>{{ s.day }}</span>
|
||||
}
|
||||
@if (s.previous !== undefined) {
|
||||
<span>{{ s.previous }} días desde la etapa anterior</span>
|
||||
}
|
||||
@if (s.sample !== undefined) {
|
||||
<span>{{ s.sample }} días desde la toma</span>
|
||||
}
|
||||
}
|
||||
</li>
|
||||
}
|
||||
</ol>
|
||||
`,
|
||||
styles: `
|
||||
ol {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
ol.detail {
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
}
|
||||
.detail li {
|
||||
display: flex;
|
||||
flex: 1 1 120px;
|
||||
flex-direction: column;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
.dot {
|
||||
border: 2px solid #9aa3ab;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
height: 12px;
|
||||
width: 12px;
|
||||
}
|
||||
.recorded {
|
||||
background: #6a8000;
|
||||
border-color: #6a8000;
|
||||
}
|
||||
.inferred {
|
||||
background: #a8c243;
|
||||
border-color: #6a8000;
|
||||
}
|
||||
.pending {
|
||||
border-color: #c24269;
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class Stages {
|
||||
readonly stages = input.required<Stage[]>();
|
||||
readonly detail = input(false);
|
||||
protected readonly shown = computed(() => {
|
||||
const all = this.stages();
|
||||
return all.map((s, i) => ({
|
||||
...s,
|
||||
text: STATES[s.state],
|
||||
previous: i ? between(all[i - 1].day, s.day) : undefined,
|
||||
sample: i > 1 ? between(all[0].day, s.day) : undefined,
|
||||
}));
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user