feat(core): preprocessing utilities — normalize_number, normalize_columns_map, decode_bytes (#411)#415
Draft
Gabrymi93 wants to merge 1 commit into
Draft
feat(core): preprocessing utilities — normalize_number, normalize_columns_map, decode_bytes (#411)#415Gabrymi93 wants to merge 1 commit into
Gabrymi93 wants to merge 1 commit into
Conversation
…umns_map, decode_bytes (#411)
Gabrymi93
marked this pull request as draft
July 15, 2026 17:18
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.
Sintesi
Nuovo modulo
toolkit/core/normalize.pycon utility di preprocessing centralizzate per normalizzare numeri in formato italiano, mappare colonne con regex e decodificare bytes con fallback multi-encoding.Rimpiazza 13 copie identiche nei candidate di dataset-incubator (elezioni-*, iva-regionale).
Contesto collegato
Closes #411
Cosa cambia
Impatto su contratti pubblici
Nessuno. Nuovo codice, nessuna modifica a funzioni esistenti.
Verifica
pytest -m pure_unitpassa (417 test)tests/test_normalize.py(45 test, markerpure_unit)Checklist PR
Cosa contiene
normalize_number(val, *, strip_dot_zero, empty_values) -> str | None— normalizza numeri formato italiano (1.234,56 → 1234.56, gestisce *** / - / N.D. → None, convalida output con_looks_like_number)normalize_columns_map(header, col_map) -> (list[str], list[int])— mappa colonne via regex con stripping di virgolette/whitespacedecode_bytes(data, encodings) -> str— decodifica multi-encoding con cp1252 prima di iso-8859-1 (€ corretto)decode_csv_bytes(data) -> str— wrapper specializzato per CSV