feat(indicadores): panel de tasa de confirmación histopatológica, tiempos pareados y ficha técnica
Agrega el panel de tasa de confirmación histopatológica (cacu_confirmacion_citologia): tasas por resultado citológico de alto grado con su intervalo de Wilson a la izquierda, dona del grado de biopsia a la derecha y tabla de contingencia; la vista base es «LIEAG o más» y las pacientes sin biopsia aún no entran al denominador. Une en una sola figura los tiempos de toma a resultado (pedido por id, oculto en el catálogo) y de toma a diagnóstico. La pestaña Datos y definiciones muestra la ficha técnica y las reglas del kit en tablas; las notas de cada figura pasan a su Cómo leer, las tarjetas dejan solo valor, n y periodo, y el Cómo leer de EU7 muestra solo lo que publica el kit. Las transiciones animadas quedan fuera, como entrega aparte para el diseñador. CSO5.5
This commit is contained in:
@@ -4,6 +4,21 @@ import { catchError, of, Subject, switchMap } from 'rxjs';
|
||||
import { Dominio, IndicadorMetadatos } from './indicadores.models';
|
||||
import { IndicadoresService } from './indicadores.service';
|
||||
|
||||
const RULE_STATES: Record<string, string> = { provisional: 'Provisional', confirmado: 'Confirmado' };
|
||||
|
||||
// Readable rule value: lists separated by commas, objects by their label when they carry one.
|
||||
export function ruleValue(value: unknown): string {
|
||||
if (value === null || value === undefined) return 'Sin definir';
|
||||
if (Array.isArray(value)) return value.length ? value.map(ruleValue).join(', ') : 'Lista vacía';
|
||||
if (typeof value === 'boolean') return value ? 'Sí' : 'No';
|
||||
if (typeof value === 'number') return value.toLocaleString('es-MX');
|
||||
if (typeof value === 'object') {
|
||||
const label = (value as Record<string, unknown>)['etiqueta'];
|
||||
return typeof label === 'string' && label.trim() ? label : JSON.stringify(value);
|
||||
}
|
||||
return String(value);
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-indicador-metadata',
|
||||
styleUrl: './indicador-metadata.scss',
|
||||
@@ -17,10 +32,27 @@ import { IndicadoresService } from './indicadores.service';
|
||||
}
|
||||
@if (fichaFields.length) {
|
||||
<section aria-labelledby="metadata-ficha-title">
|
||||
<h4 id="metadata-ficha-title">Ficha metodológica</h4>
|
||||
<dl class="ficha-fields">@for (field of fichaFields; track field.key) {
|
||||
<div><dt>{{ field.label }}</dt><dd class="metadata-copy">{{ field.value }}</dd></div>
|
||||
}</dl>
|
||||
<h4 id="metadata-ficha-title">Ficha técnica</h4>
|
||||
<div class="table-scroll">
|
||||
<table class="ficha-table">
|
||||
<tbody>@for (field of fichaFields; track field.key) {
|
||||
<tr><th scope="row">{{ field.label }}</th><td class="metadata-copy">{{ field.value }}</td></tr>
|
||||
}</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
}
|
||||
@if (rules.length) {
|
||||
<section aria-labelledby="metadata-rules-title">
|
||||
<h4 id="metadata-rules-title">Reglas</h4>
|
||||
<div class="table-scroll" role="region" aria-label="Tabla de reglas del indicador" tabindex="0">
|
||||
<table class="rules-table">
|
||||
<thead><tr><th scope="col">Clave</th><th scope="col">Valor</th><th scope="col">Estado</th><th scope="col">Fuente</th></tr></thead>
|
||||
<tbody>@for (rule of rules; track rule.clave) {
|
||||
<tr><th scope="row"><code>{{ rule.clave }}</code></th><td>{{ rule.valor }}</td><td>{{ rule.estado }}</td><td class="metadata-copy">{{ rule.fuente }}</td></tr>
|
||||
}</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
}
|
||||
@if (references.length) {
|
||||
@@ -47,7 +79,7 @@ export class IndicadorMetadata implements OnChanges {
|
||||
loading = false;
|
||||
private readonly changeDetector = inject(ChangeDetectorRef);
|
||||
private readonly fichaLabels = [
|
||||
['codigo', 'Código'], ['para', 'Para'], ['unidad', 'Unidad'],
|
||||
['codigo', 'Código'], ['para', 'Para quién'], ['unidad', 'Unidad'],
|
||||
['pregunta', 'Pregunta'], ['definicion', 'Definición'], ['nota', 'Nota'],
|
||||
] as const;
|
||||
hasText(value: unknown): value is string { return typeof value === 'string' && value.trim().length > 0; }
|
||||
@@ -56,9 +88,17 @@ export class IndicadorMetadata implements OnChanges {
|
||||
const ficha = this.metadata?.ficha;
|
||||
return ficha ? this.fichaLabels.flatMap(([key, label]) => this.hasText(ficha[key]) ? [{ key, label, value: ficha[key]!.trim() }] : []) : [];
|
||||
}
|
||||
get rules() {
|
||||
return (this.metadata?.parametros ?? []).map(rule => ({
|
||||
clave: rule.clave,
|
||||
valor: ruleValue(rule.valor),
|
||||
estado: RULE_STATES[rule.estado] ?? rule.estado,
|
||||
fuente: this.hasText(rule.fuente) ? rule.fuente.trim() : '—',
|
||||
}));
|
||||
}
|
||||
get references() { return (this.metadata?.referencias ?? []).filter(ref => this.hasText(ref.etiqueta)); }
|
||||
get populations() { return (this.metadata?.poblaciones ?? []).filter(population => this.hasText(population.descripcion)); }
|
||||
get hasUsableMetadata() { return !!(this.description || this.fichaFields.length || this.references.length || this.populations.length); }
|
||||
get hasUsableMetadata() { return !!(this.description || this.fichaFields.length || this.rules.length || this.references.length || this.populations.length); }
|
||||
constructor() {
|
||||
this.requests.pipe(switchMap(() => this.service.metadatos(this.dominio, this.indicador).pipe(catchError(() => of(undefined)))), takeUntilDestroyed(inject(DestroyRef))).subscribe(value => { this.metadata = value; this.loading = false; this.changeDetector.markForCheck(); });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user