|
| 1 | +"""Centralized HTML table configurations for reports. |
| 2 | +
|
| 3 | +Provides: |
| 4 | +- TABLE_CONFIGURATIONS: Riesgos module table metadata. |
| 5 | +- AGEDYS_TABLE_CONFIGURATIONS: Agedys module table metadata. |
| 6 | +
|
| 7 | +Each entry maps an internal table key to a dict with: |
| 8 | + title: str |
| 9 | + columns: list of {header, field, optional format} |
| 10 | +
|
| 11 | +This avoids duplication across managers and enables future generic renderers. |
| 12 | +""" |
| 13 | +from __future__ import annotations |
| 14 | + |
| 15 | +# Riesgos table configurations (moved from riesgos_manager.py) |
| 16 | +TABLE_CONFIGURATIONS = { |
| 17 | + "accepted_risks_unmotivated": { |
| 18 | + "title": "Riesgos Aceptados sin Motivación", |
| 19 | + "columns": [ |
| 20 | + {"header": "Proyecto", "field": "Nemotecnico"}, |
| 21 | + {"header": "Código", "field": "CodigoRiesgo"}, |
| 22 | + {"header": "Descripción", "field": "Descripcion"}, |
| 23 | + {"header": "Causa raíz", "field": "CausaRaiz"}, |
| 24 | + {"header": "Fecha Aceptación", "field": "FechaAceptacion", "format": "date"}, |
| 25 | + {"header": "Resp. Calidad", "field": "UsuarioCalidad"}, |
| 26 | + {"header": "Días", "field": "Dias", "format": "days"}, |
| 27 | + ], |
| 28 | + }, |
| 29 | + "accepted_risks_rejected": { |
| 30 | + "title": "Riesgos Aceptados Rechazados", |
| 31 | + "columns": [ |
| 32 | + {"header": "Proyecto", "field": "Nemotecnico"}, |
| 33 | + {"header": "Código", "field": "CodigoRiesgo"}, |
| 34 | + {"header": "Descripción", "field": "Descripcion"}, |
| 35 | + {"header": "Causa raíz", "field": "CausaRaiz"}, |
| 36 | + {"header": "Fecha Aceptación", "field": "FechaAceptacion", "format": "date"}, |
| 37 | + {"header": "Resp. Calidad", "field": "UsuarioCalidad"}, |
| 38 | + {"header": "Días", "field": "Dias", "format": "days"}, |
| 39 | + ], |
| 40 | + }, |
| 41 | + "retired_risks_unmotivated": { |
| 42 | + "title": "Riesgos Retirados sin Motivación", |
| 43 | + "columns": [ |
| 44 | + {"header": "Proyecto", "field": "Nemotecnico"}, |
| 45 | + {"header": "Código", "field": "CodigoRiesgo"}, |
| 46 | + {"header": "Descripción", "field": "Descripcion"}, |
| 47 | + {"header": "Causa raíz", "field": "CausaRaiz"}, |
| 48 | + {"header": "Fecha Retirada", "field": "FechaRetirada", "format": "date"}, |
| 49 | + {"header": "Resp. Calidad", "field": "UsuarioCalidad"}, |
| 50 | + {"header": "Días", "field": "Dias", "format": "days"}, |
| 51 | + ], |
| 52 | + }, |
| 53 | + "retired_risks_rejected": { |
| 54 | + "title": "Riesgos Retirados Rechazados", |
| 55 | + "columns": [ |
| 56 | + {"header": "Proyecto", "field": "Nemotecnico"}, |
| 57 | + {"header": "Código", "field": "CodigoRiesgo"}, |
| 58 | + {"header": "Descripción", "field": "Descripcion"}, |
| 59 | + {"header": "Causa raíz", "field": "CausaRaiz"}, |
| 60 | + {"header": "Fecha Retirada", "field": "FechaRetirada", "format": "date"}, |
| 61 | + {"header": "Resp. Calidad", "field": "UsuarioCalidad"}, |
| 62 | + {"header": "Días", "field": "Dias", "format": "days"}, |
| 63 | + ], |
| 64 | + }, |
| 65 | + "editions_ready_for_publication": { |
| 66 | + "title": "Ediciones Listas para Publicación", |
| 67 | + "columns": [ |
| 68 | + {"header": "Proyecto", "field": "Nemotecnico"}, |
| 69 | + {"header": "Últ Ed", "field": "UltimaEdicion"}, |
| 70 | + {"header": "Fecha Edición", "field": "FechaEdicion", "format": "date"}, |
| 71 | + {"header": "Fecha Publicación", "field": "FechaPublicacion", "format": "date"}, |
| 72 | + {"header": "Responsable Técnico", "field": "ResponsableTecnico"}, |
| 73 | + {"header": "Resp. Calidad", "field": "ResponsableCalidad"}, |
| 74 | + {"header": "Días", "field": "Dias", "format": "days"}, |
| 75 | + ], |
| 76 | + }, |
| 77 | + "accepted_risks_pending_approval": { |
| 78 | + "title": "Riesgos Aceptados Pendientes de Aprobación", |
| 79 | + "columns": [ |
| 80 | + {"header": "Proyecto", "field": "Nemotecnico"}, |
| 81 | + {"header": "Código", "field": "CodigoRiesgo"}, |
| 82 | + {"header": "Descripción", "field": "Descripcion"}, |
| 83 | + {"header": "Causa raíz", "field": "CausaRaiz"}, |
| 84 | + {"header": "Fecha Aceptación", "field": "FechaAceptacion", "format": "date"}, |
| 85 | + {"header": "Resp. Calidad", "field": "UsuarioCalidad"}, |
| 86 | + {"header": "Días", "field": "Dias", "format": "days"}, |
| 87 | + ], |
| 88 | + }, |
| 89 | + "retired_risks_pending_approval": { |
| 90 | + "title": "Riesgos Retirados Pendientes de Aprobación", |
| 91 | + "columns": [ |
| 92 | + {"header": "Proyecto", "field": "Nemotecnico"}, |
| 93 | + {"header": "Código", "field": "CodigoRiesgo"}, |
| 94 | + {"header": "Descripción", "field": "Descripcion"}, |
| 95 | + {"header": "Causa raíz", "field": "CausaRaiz"}, |
| 96 | + {"header": "Fecha Retirada", "field": "FechaRetirada", "format": "date"}, |
| 97 | + {"header": "Resp. Calidad", "field": "UsuarioCalidad"}, |
| 98 | + {"header": "Días", "field": "Dias", "format": "days"}, |
| 99 | + ], |
| 100 | + }, |
| 101 | + "materialized_risks_pending_decision": { |
| 102 | + "title": "Riesgos Materializados Pendientes de Decisión", |
| 103 | + "columns": [ |
| 104 | + {"header": "Proyecto", "field": "Nemotecnico"}, |
| 105 | + {"header": "Código", "field": "CodigoRiesgo"}, |
| 106 | + {"header": "Descripción", "field": "Descripcion"}, |
| 107 | + {"header": "Causa raíz", "field": "CausaRaiz"}, |
| 108 | + {"header": "Fecha Materialización", "field": "FechaMaterializacion", "format": "date"}, |
| 109 | + {"header": "Resp. Calidad", "field": "UsuarioCalidad"}, |
| 110 | + {"header": "Días", "field": "Dias", "format": "days"}, |
| 111 | + ], |
| 112 | + }, |
| 113 | + "editions_with_expired_dates": { |
| 114 | + "title": "Ediciones con Fechas Caducadas", |
| 115 | + "columns": [ |
| 116 | + {"header": "Proyecto", "field": "Nemotecnico"}, |
| 117 | + {"header": "Últ Ed", "field": "UltimaEdicion"}, |
| 118 | + {"header": "Fecha Máx.Próx Ed.", "field": "FechaMaximaProximaEdicion", "format": "date"}, |
| 119 | + {"header": "Resp. Calidad", "field": "ResponsableCalidad"}, |
| 120 | + {"header": "Días", "field": "Dias", "format": "days"}, |
| 121 | + ], |
| 122 | + }, |
| 123 | + "active_editions": { |
| 124 | + "title": "Ediciones Activas", |
| 125 | + "columns": [ |
| 126 | + {"header": "Proyecto", "field": "Nemotecnico"}, |
| 127 | + {"header": "Últ Ed", "field": "Edicion"}, |
| 128 | + {"header": "Fecha Edición", "field": "FechaEdicion", "format": "date"}, |
| 129 | + {"header": "Fecha Publicación", "field": "FechaPublicacion", "format": "date"}, |
| 130 | + {"header": "Responsable Técnico", "field": "ResponsableTecnico"}, |
| 131 | + {"header": "Estado", "field": "Estado"}, |
| 132 | + ], |
| 133 | + }, |
| 134 | + "closed_editions_last_month": { |
| 135 | + "title": "Ediciones Cerradas en los Últimos 30 Días", |
| 136 | + "columns": [ |
| 137 | + {"header": "Proyecto", "field": "Nemotecnico"}, |
| 138 | + {"header": "Últ Ed", "field": "Edicion"}, |
| 139 | + {"header": "Fecha Edición", "field": "FechaEdicion", "format": "date"}, |
| 140 | + {"header": "Fecha Publicación", "field": "FechaPublicacion", "format": "date"}, |
| 141 | + {"header": "Fecha Cierre", "field": "FechaCierre", "format": "date"}, |
| 142 | + {"header": "Responsable Técnico", "field": "ResponsableTecnico"}, |
| 143 | + {"header": "Días desde Cierre", "field": "DiasDesdeCierre"}, |
| 144 | + ], |
| 145 | + }, |
| 146 | + "risks_to_reclassify": { |
| 147 | + "title": "Riesgos que hay que Asignar un Código de Biblioteca", |
| 148 | + "columns": [ |
| 149 | + {"header": "Proyecto", "field": "Nemotecnico"}, |
| 150 | + {"header": "Código", "field": "CodigoRiesgo"}, |
| 151 | + {"header": "Descripción", "field": "Descripcion"}, |
| 152 | + {"header": "Causa raíz", "field": "CausaRaiz"}, |
| 153 | + {"header": "Fecha para retific.", "field": "FechaRiesgoParaRetipificar", "format": "date"}, |
| 154 | + {"header": "Resp. Calidad", "field": "UsuarioCalidad"}, |
| 155 | + ], |
| 156 | + }, |
| 157 | + "mitigation_actions_reschedule": { |
| 158 | + "title": "Riesgos con Acciones de Mitigación para Replanificar", |
| 159 | + "columns": [ |
| 160 | + {"header": "Proyecto", "field": "Nemotecnico"}, |
| 161 | + {"header": "Código Riesgo", "field": "CodigoRiesgo"}, |
| 162 | + {"header": "Descripción", "field": "Descripcion"}, |
| 163 | + {"header": "Causa Raíz", "field": "CausaRaiz"}, |
| 164 | + {"header": "Disparador", "field": "DisparadorDelPlan"}, |
| 165 | + {"header": "Acción", "field": "Accion"}, |
| 166 | + {"header": "Fecha Inicio", "field": "FechaInicio", "format": "date"}, |
| 167 | + {"header": "Fecha Fin Prevista", "field": "FechaFinPrevista", "format": "date"}, |
| 168 | + {"header": "Resp. Calidad", "field": "UsuarioCalidad"}, |
| 169 | + ], |
| 170 | + }, |
| 171 | + "contingency_actions_reschedule": { |
| 172 | + "title": "Riesgos con Acciones de Contingencia para Replanificar", |
| 173 | + "columns": [ |
| 174 | + {"header": "Proyecto", "field": "Nemotecnico"}, |
| 175 | + {"header": "Código Riesgo", "field": "CodigoRiesgo"}, |
| 176 | + {"header": "Descripción", "field": "Descripcion"}, |
| 177 | + {"header": "Causa Raíz", "field": "CausaRaiz"}, |
| 178 | + {"header": "Disparador", "field": "DisparadorDelPlan"}, |
| 179 | + {"header": "Acción", "field": "Accion"}, |
| 180 | + {"header": "Fecha Inicio", "field": "FechaInicio", "format": "date"}, |
| 181 | + {"header": "Fecha Fin Prevista", "field": "FechaFinPrevista", "format": "date"}, |
| 182 | + {"header": "Resp. Calidad", "field": "UsuarioCalidad"}, |
| 183 | + ], |
| 184 | + }, |
| 185 | + "editions_need_publication": { |
| 186 | + "title": "Ediciones que necesitan propuesta de publicación", |
| 187 | + "columns": [ |
| 188 | + {"header": "Proyecto", "field": "Nemotecnico"}, |
| 189 | + {"header": "Últ Ed", "field": "Edicion"}, |
| 190 | + {"header": "Fecha Máx.Próx Ed.", "field": "FechaMaxProximaPublicacion", "format": "date"}, |
| 191 | + {"header": "Propuesta para Publicación", "field": "FechaPreparadaParaPublicar", "format": "date"}, |
| 192 | + {"header": "Resp. Calidad", "field": "UsuarioCalidad"}, |
| 193 | + {"header": "Faltan (días)", "field": "Dias", "format": "css_days"}, |
| 194 | + ], |
| 195 | + }, |
| 196 | + "editions_with_rejected_proposals": { |
| 197 | + "title": "Ediciones con propuestas de publicación rechazadas", |
| 198 | + "columns": [ |
| 199 | + {"header": "Proyecto", "field": "Nemotecnico"}, |
| 200 | + {"header": "Últ Ed", "field": "Edicion"}, |
| 201 | + {"header": "Fecha Máx.Próx Ed.", "field": "FechaMaxProximaPublicacion", "format": "date"}, |
| 202 | + {"header": "Propuesta para Publicación", "field": "FechaPreparadaParaPublicar", "format": "date"}, |
| 203 | + {"header": "Fecha Rechazo", "field": "PropuestaRechazadaPorCalidadFecha", "format": "date"}, |
| 204 | + {"header": "Motivo Rechazo", "field": "PropuestaRechazadaPorCalidadMotivo"}, |
| 205 | + {"header": "Resp. Calidad", "field": "UsuarioCalidad"}, |
| 206 | + ], |
| 207 | + }, |
| 208 | +} |
| 209 | + |
| 210 | +# Agedys table configurations (new) |
| 211 | +AGEDYS_TABLE_CONFIGURATIONS = { |
| 212 | + # Placeholder structure: populate with real Agedys table configs if standardized |
| 213 | + # Example: |
| 214 | + # "dpds_sin_visado_calidad": { |
| 215 | + # "title": "DPDs sin visado calidad", |
| 216 | + # "columns": [ |
| 217 | + # {"header": "Proyecto", "field": "CODPROYECTOS"}, |
| 218 | + # {"header": "Código", "field": "CODIGO"}, |
| 219 | + # {"header": "Descripción", "field": "Descripcion"}, |
| 220 | + # ], |
| 221 | + # }, |
| 222 | +} |
| 223 | + |
| 224 | +__all__ = ["TABLE_CONFIGURATIONS", "AGEDYS_TABLE_CONFIGURATIONS"] |
0 commit comments