refactor(indicadores): quitar la tabla de reglas de datos y definiciones

Las reglas de cálculo que publica el kit en `parametros` (clave, valor, estado y fuente) irán en un apéndice o manual técnico aparte, no en la pestaña «Datos y definiciones». Se quita la tabla «Reglas» y su formato de valores, y la pestaña conserva la ficha técnica, las referencias y las poblaciones. También se retiran el tipo y la validación estricta de `parametros` en el servicio: ya nadie los usa y una lista mal formada bloqueaba los metadatos completos. Si el servidor envía `parametros`, se ignoran.

CSO5.5
This commit is contained in:
2026-10-24 22:11:33 +00:00
parent 03e51c07cc
commit 12a0398903
6 changed files with 11 additions and 93 deletions
@@ -4,21 +4,6 @@ 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',
@@ -42,19 +27,6 @@ export function ruleValue(value: unknown): string {
</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) {
<section aria-labelledby="metadata-references-title">
<h4 id="metadata-references-title">Referencias</h4>
@@ -88,17 +60,9 @@ 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.rules.length || this.references.length || this.populations.length); }
get hasUsableMetadata() { return !!(this.description || this.fichaFields.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(); });
}