feat: Enhance CSV cleaning service with new endpoints for CSV analysis and preview functionality. Introduce support for job management linked to extraction batches, and update the cleaning rules structure. Add new utility functions for handling CSV data and improve documentation for clarity on usage and available endpoints.
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
"""Limpieza de CSV con análisis inteligente local y reglas configurables.
|
||||
|
||||
API pública (estable):
|
||||
- ``analyze_dataframe`` — resumen por columna
|
||||
- ``CLEANING_RULES`` / ``register_rule`` / ``get_rule`` — catálogo de reglas
|
||||
- ``apply_rules`` — aplica reglas por columna
|
||||
- ``load_csv`` / ``load_csv_bytes`` / ``detect_delimiter`` — I/O
|
||||
|
||||
Para agregar una regla nueva, ver ``rules/registry.py`` y ``rules/builtins.py``.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from .analyze import analyze_dataframe, sample_dataframe_rows
|
||||
from .apply import apply_rules
|
||||
from .cop_mod import (
|
||||
DEFAULT_MODERADORA_BY_YEAR,
|
||||
merge_moderadora_config,
|
||||
normalize_moderadora_by_year_dict,
|
||||
)
|
||||
from .documents import homologate_doc_type, split_doc_tipo_y_numero_texto
|
||||
from .io import detect_delimiter, load_csv, load_csv_bytes
|
||||
from .models import (
|
||||
TYPE_BOOLEAN,
|
||||
TYPE_CATEGORICAL,
|
||||
TYPE_DATE,
|
||||
TYPE_DECIMAL,
|
||||
TYPE_EMPTY,
|
||||
TYPE_INTEGER,
|
||||
TYPE_MIXED,
|
||||
TYPE_TEXT,
|
||||
ColumnSummary,
|
||||
)
|
||||
from .notas import extract_autorizacion_nota, extract_paciente_documento_nota
|
||||
from .rules import CLEANING_RULES, get_rule, register_rule
|
||||
from .type_inference import applicable_rule_ids_for_type
|
||||
|
||||
__all__ = [
|
||||
"CLEANING_RULES",
|
||||
"ColumnSummary",
|
||||
"DEFAULT_MODERADORA_BY_YEAR",
|
||||
"TYPE_BOOLEAN",
|
||||
"TYPE_CATEGORICAL",
|
||||
"TYPE_DATE",
|
||||
"TYPE_DECIMAL",
|
||||
"TYPE_EMPTY",
|
||||
"TYPE_INTEGER",
|
||||
"TYPE_MIXED",
|
||||
"TYPE_TEXT",
|
||||
"analyze_dataframe",
|
||||
"applicable_rule_ids_for_type",
|
||||
"apply_rules",
|
||||
"detect_delimiter",
|
||||
"extract_autorizacion_nota",
|
||||
"extract_paciente_documento_nota",
|
||||
"get_rule",
|
||||
"homologate_doc_type",
|
||||
"load_csv",
|
||||
"load_csv_bytes",
|
||||
"merge_moderadora_config",
|
||||
"normalize_moderadora_by_year_dict",
|
||||
"register_rule",
|
||||
"sample_dataframe_rows",
|
||||
"split_doc_tipo_y_numero_texto",
|
||||
]
|
||||
Reference in New Issue
Block a user