feat: Introduce bot-digitador service for automated data entry in Integración Total. Add CLI and GUI interfaces for CSV processing, implement auto-start functionality on Windows, and enhance README with setup instructions and usage details. Include necessary configurations in docker-compose for service integration.

This commit is contained in:
erik
2026-08-09 21:26:56 -05:00
parent a3b4c7fc47
commit e9b766281a
74 changed files with 11177 additions and 115 deletions
+11 -1
View File
@@ -20,6 +20,7 @@ CLEANING_URL = os.getenv("CLEANING_URL", "http://cleaning:8002").rstrip("/")
POBLACION_APTA_URL = os.getenv("POBLACION_APTA_URL", "http://poblacion_apta:8003").rstrip("/")
COUNT_URL = os.getenv("COUNT_URL", "http://count-api:8080").rstrip("/")
BOT_DESCARGA_URL = os.getenv("BOT_DESCARGA_URL", "http://bot-descarga:8200").rstrip("/")
BOT_DIGITADOR_URL = os.getenv("BOT_DIGITADOR_URL", "http://bot-digitador:8210").rstrip("/")
# Timeouts: JSON ligero vs uploads OCR/conteo
_TIMEOUT_JSON = httpx.Timeout(connect=5.0, read=30.0, write=30.0, pool=5.0)
@@ -36,12 +37,13 @@ async def lifespan(app: FastAPI):
limits=httpx.Limits(max_connections=100, max_keepalive_connections=20),
)
_log.info(
"Gateway iniciado — extraction=%s cleaning=%s poblacion_apta=%s count=%s bot_descarga=%s",
"Gateway iniciado — extraction=%s cleaning=%s poblacion_apta=%s count=%s bot_descarga=%s bot_digitador=%s",
EXTRACTION_URL,
CLEANING_URL,
POBLACION_APTA_URL,
COUNT_URL,
BOT_DESCARGA_URL,
BOT_DIGITADOR_URL,
)
yield
await _http_client.aclose()
@@ -84,6 +86,7 @@ def _is_upload_path(path: str) -> bool:
or path.startswith("/poblacion-apta/jobs/from-csv")
or path.startswith("/poblacion-apta/jobs/from-cleaning")
or path.startswith("/bot-descarga/jobs")
or path.startswith("/bot-digitador/jobs")
)
@@ -105,6 +108,7 @@ async def health() -> dict[str, Any]:
poblacion_apta = await _safe_health(client, POBLACION_APTA_URL)
counting = await _safe_health(client, COUNT_URL)
bot_descarga = await _safe_health(client, BOT_DESCARGA_URL)
bot_digitador = await _safe_health(client, BOT_DIGITADOR_URL)
return {
"status": "ok" if extraction["ok"] and cleaning["ok"] and poblacion_apta["ok"] else "degraded",
"services": {
@@ -113,6 +117,7 @@ async def health() -> dict[str, Any]:
"poblacion_apta": poblacion_apta,
"counting": counting,
"bot_descarga": bot_descarga,
"bot_digitador": bot_digitador,
},
}
@@ -183,6 +188,11 @@ async def bot_descarga_proxy(path: str, request: Request) -> Response:
return await _proxy_request(request, f"{BOT_DESCARGA_URL}/{path}")
@app.api_route("/bot-digitador/{path:path}", methods=["GET", "POST", "PUT", "PATCH", "DELETE"])
async def bot_digitador_proxy(path: str, request: Request) -> Response:
return await _proxy_request(request, f"{BOT_DIGITADOR_URL}/{path}")
@app.api_route("/jobs", methods=["GET", "POST"])
async def jobs_root_proxy(request: Request) -> Response:
return await _proxy_request(request, f"{EXTRACTION_URL}/jobs")