One shell with the current look: indicators, follow-up list and patient view from FHIR; /conectar canvas; /revision; Playwright page tests

This commit is contained in:
Roberto Treviño
2026-11-25 10:21:30 -06:00
parent 70b6d6c646
commit cd7bbaf11a
70 changed files with 5459 additions and 182 deletions
+64
View File
@@ -0,0 +1,64 @@
import { Component, input } from '@angular/core';
import type { Measure } from 'fhir/r4';
import { code, label } from '../fhir';
import { periodTypes, STRATA } from './measures';
const SCORING: Record<string, string> = {
proportion: 'Proporción',
'continuous-variable': 'Variable continua (mediana)',
cohort: 'Composición (conteo)',
};
const IMPROVEMENT: Record<string, string> = {
increase: 'Mejor si sube',
decrease: 'Mejor si baja',
};
const PERIODS: Record<string, string> = { semester: 'Semestral', month: 'Mensual' };
/** What each measure is: how it scores, which way is better, its periods and strata. */
@Component({
selector: 'app-tab-definiciones',
template: `
<table class="plain card">
<thead>
<tr>
<th>Indicador</th>
<th>Clave</th>
<th>Cálculo</th>
<th>Mejora</th>
<th>Periodos</th>
<th>Estratos</th>
</tr>
</thead>
<tbody>
@for (m of measures(); track m.id) {
<tr>
<td>{{ m.title }}</td>
<td>
<code>{{ m.name }}</code> v{{ m.version }}
</td>
<td>{{ scoring[code(m.scoring) ?? ''] }}</td>
<td>{{ improvement[code(m.improvementNotation) ?? ''] ?? '—' }}</td>
<td>{{ types(m) }}</td>
<td>{{ strata(m) }}</td>
</tr>
}
</tbody>
</table>
`,
styles: ':host { display: block; padding-top: 16px; overflow-x: auto; }',
})
export class TabDefiniciones {
readonly measures = input.required<Measure[]>();
protected readonly scoring = SCORING;
protected readonly improvement = IMPROVEMENT;
protected readonly code = code;
protected types(m: Measure): string {
return periodTypes(m)
.map((p) => PERIODS[p] ?? p)
.join(', ');
}
protected strata(m: Measure): string {
const names = (m.group?.[0]?.stratifier ?? []).map((s) => code(s.code) ?? label(s.code));
return names.map((n) => STRATA[n] ?? n).join(', ') || '—';
}
}