Files
0pt/services/api
admin ff11216813
masterplan-lock / check (push) Successful in 3s
masterplan-lock / check (pull_request) Successful in 10s
Security Scan (SIAX Cloud) / security (push) Successful in 14s
CI (SIAX Cloud) / security (push) Successful in 17s
CI (SIAX Cloud) / security (pull_request) Successful in 17s
CI (SIAX Cloud) / integration (push) Successful in 25s
CI (SIAX Cloud) / quality (push) Successful in 35s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 40s
CI (SIAX Cloud) / integration (pull_request) Successful in 49s
CI (SIAX Cloud) / quality (pull_request) Successful in 56s
feat(engine): fail-closed X-Internal-Token-gate + commit-kedja (GIT_SHA) i services/api
- X-Internal-Token skickades av edgen men verifierades ALDRIG — gate som
  raw-ASGI-middleware: INTERNAL_TOKEN satt => alla routes utom /health kräver
  exakt token, 401 (constant-time) annars. Ospecificerad token = inert (dev).
- Dockerfile: ARG GIT_SHA + OCI-label + /health.reporting revision
- compose var redan skriven för INTERNAL_TOKEN — motorn hade bara aldrig
  deployats med den
- tester: tests/test_internal_token_gate.py (3: off/public/401-pass) — hela
  services/api-sviten 62 passed, 2 skipped (dokumenterade known-gaps), 0 fail
2026-09-15 03:38:43 +02:00
..

0pt data engine (services/api)

The legal data motor (docs/06). FastAPI orchestrator + worker pipeline that turn compliant sources into delivered, provenance-tagged data. Runs on a VPS via ../../infra/docker-compose.yml — not on Vercel (long jobs).

Sourcing boundary (CLAUDE.md §1 — non-negotiable)

Per field × market, in strict order: official API/bulk → authorized public web (robots + rate limits) → licensed partner data → otherwise level 0 "ej tillgänglig". We never invent values.

Deliberately excluded (never add here): WAF/bot-detection bypass, FlareSolverr, stealth/undetected browsers, proxy/fingerprint rotation to evade bans, scraping behind login walls, automated fake-account creation. This is the honest-accuracy moat.

Layout

  • sources/connectors.py — compliant connectors (GLEIF, Brønnøysund, Companies House live; PRH/CVR/Bolagsverket gated on verified terms → level 0 until wired).
  • sources/sources.yaml — source registry (access/licence/cadence; VERIFY terms).
  • orchestrator/main.py — REST API (health, sources, estimates, orders, jobs) per docs/04.
  • workers/adaptive_router.py — picks the cheapest compliant method per market (api > bulk > authorized_web > licensed). No bypass tiers.
  • workers/pipeline.py — sourcing → extraction → structuring (dedup) → enrichment/fusion → QA (drops rows below the order's confidence target). Writes provenance per field.

Run locally

pip install -r requirements.txt
uvicorn orchestrator.main:app --reload          # API on :8000
python -m workers.run                            # run one demo job

Reconciliation note

Supersedes the earlier nordic-eu-data-platform backend: the compliant connectors + pipeline are migrated here; the FlareSolverr/stealth/proxy/fake-account paths and the test_bypass_chain/test_proxy_pool examples are intentionally not carried over.