add import audit trail, live indicator recompute, reportes endpoints; production hardening

This commit is contained in:
Roberto Treviño Cervantes
2026-10-30 11:19:30 -06:00
parent 168edb30f5
commit 2b2c290f58
74 changed files with 4095 additions and 1782 deletions
+3 -3
View File
@@ -30,7 +30,7 @@ class CsvConnector(FileConnector):
def __init__(self, raw: bytes, *, delimiter: str | None = None, encoding: str | None = None):
self._encoding, text = _decode(raw, encoding)
if "\x00" in text:
raise ConnectorError("file looks binary, not a delimited text file")
raise ConnectorError("el archivo parece binario, no un texto delimitado")
self._delimiter = delimiter or _sniff_delimiter(text)
try:
self._df = pd.read_csv(
@@ -42,7 +42,7 @@ class CsvConnector(FileConnector):
skipinitialspace=True,
)
except Exception as exc: # pandas raises a variety of error types
raise ConnectorError(f"could not parse CSV: {exc}") from exc
raise ConnectorError(f"no se pudo leer el CSV: {exc}") from exc
self._df.columns = [str(c).strip() for c in self._df.columns]
def _dataframe(self) -> pd.DataFrame:
@@ -58,7 +58,7 @@ def _decode(raw: bytes, encoding: str | None) -> tuple[str, str]:
return candidate, raw.decode(candidate)
except (UnicodeDecodeError, LookupError):
continue
raise ConnectorError(f"could not decode CSV as {encoding or ' / '.join(_FALLBACK_ENCODINGS)}")
raise ConnectorError(f"no se pudo decodificar el CSV como {encoding or ' / '.join(_FALLBACK_ENCODINGS)}")
def _sniff_delimiter(text: str) -> str: