38 lines
1.4 KiB
Python
38 lines
1.4 KiB
Python
"""Data fetchers para AR-House.
|
|
|
|
Obtiene datos reales de fuentes oficiales ANTES de pasar el deal a los agentes Ollama.
|
|
Asi los agentes razonan sobre datos verificados (FEMA, HUD, NOAA, Census ACS) en vez de inventar.
|
|
|
|
Uso principal:
|
|
from data_fetchers.runner import fetch_all
|
|
data = fetch_all(deal, status_cb=...)
|
|
# data = {"geocode": {...}, "flood": {...}, "fmr": {...},
|
|
# "hurricanes": [...], "neighborhood": {...}, "fetch_errors": [...]}
|
|
|
|
Fail-soft: si algun fetcher falla, devuelve dict vacio en su campo y agrega a fetch_errors.
|
|
El pipeline NO se aborta.
|
|
|
|
Compliance: la clasificacion de vecindarios usa SOLO indicadores economicos objetivos
|
|
(income, owner-occupancy, education, vacancy, crime, days-on-market). NUNCA demografia
|
|
racial. Esto cumple con Fair Housing Act federal.
|
|
"""
|
|
|
|
# Cargar .env ANTES de los imports — buscando desde este archivo upwards.
|
|
# Asi los fetchers (Census, HUD, FBI) encuentran las API keys aunque el caller
|
|
# este corriendo desde otro CWD.
|
|
import os
|
|
from pathlib import Path
|
|
from dotenv import load_dotenv
|
|
|
|
_here = Path(__file__).resolve().parent # .../data_fetchers/
|
|
for _parent in [_here.parent] + list(_here.parents):
|
|
_candidate = _parent / ".env"
|
|
if _candidate.exists():
|
|
load_dotenv(_candidate)
|
|
break
|
|
|
|
from .runner import fetch_all
|
|
from .price_validator import validate_price
|
|
|
|
__all__ = ["fetch_all", "validate_price"]
|