FastAPI orchestrator (health/sources/estimates/orders/jobs per docs/04), adaptive router (compliant methods only, no bypass tiers), pipeline (sourcing->extraction->structuring/dedup->fusion->QA with per-field provenance, drops < confidence target), live connectors GLEIF/Brreg/Companies House (PRH/CVR/Bolagsverket gated to level-0 until terms verified). sources.yaml registry. infra/docker-compose + Caddyfile for the VPS. FlareSolverr/stealth/proxy/fake-account paths intentionally NOT carried over (CLAUDE.md §1). py_compile clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
24 lines
925 B
Python
24 lines
925 B
Python
"""
|
|
Adaptive router — chooses among COMPLIANT methods only (docs/06).
|
|
Order of preference: official API > bulk > authorized public web > licensed.
|
|
There are NO bypass/stealth/proxy-rotation tiers here, by design (CLAUDE.md §1).
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
# market -> ordered list of source_ids to try (compliant connectors only)
|
|
MARKET_SOURCES: dict[str, list[str]] = {
|
|
"NO": ["brreg", "gleif"],
|
|
"GB": ["companies_house", "gleif"],
|
|
"FI": ["prh", "gleif"],
|
|
"DK": ["cvr", "gleif"],
|
|
"SE": ["gleif"], # Bolagsverket bulk is licensed; SE company core via GLEIF + licensed/partner
|
|
}
|
|
|
|
# Access rank: lower = preferred (cheapest compliant path first).
|
|
ACCESS_RANK = {"api": 0, "bulk": 1, "authorized_web": 2, "licensed": 3}
|
|
|
|
|
|
def plan_for_market(market: str) -> list[str]:
|
|
"""Return the ordered, compliant source plan for a market."""
|
|
return MARKET_SOURCES.get(market, ["gleif"])
|