The benchmarking module compares each indicator’s historical average against a user-defined reference value. Every benchmark record specifies a criterio that controls the direction of the comparison — eitherDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/davi-huanuco/python-matriz-correlacion/llms.txt
Use this file to discover all available pages before exploring further.
"Mayor es mejor" (higher is better) or "Menor es mejor" (lower is better). This affects how the gap, compliance rate, and pass/fail status are calculated.
All calculation functions below live in benchmarking_view.py.
Criteria logic
Mayor es mejor — higher is better
Mayor es mejor — higher is better
Use this criterion when a higher indicator value is the goal (e.g. service availability percentage, resolution rate).
A positive brecha means the indicator is above target.
| Calculation | Formula |
|---|---|
| Brecha | promedio − referencia |
| Cumplimiento | (promedio / referencia) × 100 |
| Estado: Cumple | promedio >= referencia |
| Estado: Por debajo | promedio < referencia |
Menor es mejor — lower is better
Menor es mejor — lower is better
Use this criterion when a lower indicator value is the goal (e.g. response time, error rate, cost).
A positive brecha means the indicator is below the reference (which is favorable).
| Calculation | Formula |
|---|---|
| Brecha | referencia − promedio |
| Cumplimiento | (referencia / promedio) × 100 |
| Estado: Cumple | promedio <= referencia |
| Estado: Por debajo | promedio > referencia |
Functions
calcular_promedio
valores, ignoring null entries. Returns None if there are no numeric values at all.
The values from an indicator’s
valores dict (e.g. indicador["valores"].values()). May contain null entries for months with no data.calcular_brecha
None if either promedio or referencia is None.
The indicator’s computed average, as returned by
calcular_promedio.The benchmark’s
valor_referencia."Mayor es mejor" or "Menor es mejor".calcular_cumplimiento
None when:
promedioisNonereferenciaisNoneor0(avoids division by zero)criteriois"Menor es mejor"andpromediois0(avoids division by zero)
"{value:.2f}%".
The indicator’s computed average.
The benchmark’s
valor_referencia."Mayor es mejor" or "Menor es mejor".calcular_estado
"Cumple", "Por debajo", and "Sin datos".
The indicator’s computed average. If
None, returns "Sin datos".The benchmark’s
valor_referencia. If None, returns "Sin datos"."Mayor es mejor" or "Menor es mejor".| Return value | Meaning |
|---|---|
"Cumple" | The indicator meets or exceeds the benchmark for the given criterion. |
"Por debajo" | The indicator does not meet the benchmark. |
"Sin datos" | Either promedio or referencia is None; no comparison is possible. |
formatear_numero
"-" when valor is None, and a two-decimal string (e.g. "78.50") otherwise. This function is used for all numeric cells in the benchmarking table — promedio, referencia, and brecha — so that missing values appear consistently as "-".
The numeric value to format. Pass
None to get "-".Cumplimiento uses a separate inline format in
crear_tabla_benchmarks — f"{cumplimiento:.2f}%" — to append the percent sign. It still falls back to "-" when cumplimiento is None.