Unifica EMPRESA/EMPRESA DE SEGUROS y ordena el consolidado segun Anexo 12#14
Merged
Merged
Conversation
…o 12 La descarga del consolidado tenia dos columnas de aseguradora (el marcador interno EMPRESA + la cruda EMPRESA DE SEGUROS) y un orden de campos arbitrario. - data_processor: nueva reordenar_consolidado_export(df) que, solo para la exportacion, unifica ambas columnas en una sola "EMPRESA DE SEGUROS" y ordena los campos segun el Anexo 12 oficial (ORDEN_ANEXO_12). Matching flexible (sin acentos, "_" ~ espacio); las columnas no listadas se anexan al final (nunca se descarta nada). No muta datos["midagri"]. - _consolidar_columnas_duplicadas: ahora tambien fusiona la cruda EMPRESA DE SEGUROS/SEGURO en el marcador EMPRESA, eliminando el duplicado interno. - dashboard: la descarga usa reordenar_consolidado_export y separa las hojas por "EMPRESA DE SEGUROS". - 6 tests nuevos del export (unificacion, orden, match flexible, no-descarte, no-mutacion). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Qué
En la descarga del consolidado (Dashboard):
EMPRESAy la crudaEMPRESA DE SEGUROS— en una sola columnaEMPRESA DE SEGUROS.Cómo
data_processor.reordenar_consolidado_export(df)(nueva): trabaja sobre una copia (no tocadatos["midagri"]). Une las columnas concombine_first, renombra aEMPRESA DE SEGUROS, y reordena conORDEN_ANEXO_12. El matching es flexible (ignora acentos y trata_≈ espacio), y las columnas no listadas se anexan al final — nunca se descarta una columna._consolidar_columnas_duplicadas: ahora también fusiona la crudaEMPRESA DE SEGUROS/EMPRESA DE SEGUROen el marcadorEMPRESA, eliminando el duplicado a nivel interno.pages/dashboard.py: la descarga aplica la función y separa las hojas porEMPRESA DE SEGUROS.Alcance
Solo afecta la exportación. El marcador interno
EMPRESA(RIMAC / LA POSITIVA) sigue intacto, así que el group-by del dashboard y los generadores Word/PPT no cambian. Verificado que ningún código leedf["EMPRESA DE SEGUROS"](los matches son labels de tablas Word, no accesos a columna).Tests
6 tests nuevos: unificación (con cruda y sin), orden Anexo 12, match flexible (acentos/guiones), no-descarte de columnas desconocidas, no-mutación del original. 57 tests verdes en total.
🤖 Generated with Claude Code