尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證Rastreo de la financiación de los partidos políticos españoles
翻譯準備中
取自儲存庫 README
正在載入完整 README。 以下為已儲存的摘錄。
Seguir el Dinero — Spanish party-funding tracker A transparency portal for the money behind Spanish political parties: the public state subsidies they receive (pulled live from the official national subsidies database), the private donations they declare, the foundations attached to them, the officeholders they put in post, and how the parliamentary groups voted on the laws that affect minorities. Available in Spanish, English and Catalan. Six documents, each with one job. Start with the one that matches your question. [README 설치·사용 부분 발췌] Quick start檢視完整 README ↗
A transparency portal for the money behind Spanish political parties: the public state subsidies they receive (pulled live from the official national subsidies database), the private donations they declare, the foundations attached to them, the officeholders they put in post, and how the parliamentary groups voted on the laws that affect minorities.
Available in Spanish, English and Catalan.
Six documents, each with one job. Start with the one that matches your question.
| Document | Answers |
|---|---|
| README.md (this file) | What the project is, how to run it, where things live |
AGENTS.md | How it is built: architecture, data flow, endpoint gotchas, honesty rules |
NEXT-STEPS.md | What is planned, with enough detail to pick any item up cold |
PLAN-CONTEXT-LAYER.md | Design for the wages / poverty / housing layer, with verified sources |
PLAN-VISUAL.md | Design critique, the WCAG 2.1 AA audit, and the plan to make the site visual |
CHANGELOG.md | What changed, why, the source behind each figure, and what was left out |
| Layer | Source | Freshness |
|---|---|---|
| State subsidies to parties | BDNS / SNPSAP REST API | Live, refreshed daily |
| Private donations to parties | Tribunal de Cuentas report nº 1573 (2020) | Fixed snapshot, lagged 1–2 years |
| Party-linked foundations | Tribunal de Cuentas report nº 1.642 (2021–22) | Fixed snapshot, lagged |
| Public salaries of officeholders | Registro de Altos Cargos / transparencia.gob.es | Rebuilt from a CSV export |
| Key roll-call votes | Congreso de los Diputados open data | Rebuilt on demand |
| Sitting deputies and their economic interests | Congreso de los Diputados open data and deputy pages | Rebuilt on demand |
| Deputies' asset declarations | Congreso scans, transcribed here and checked against RTVE or a second reading | First XV filing (2023), transcribed in batches |
| Portraits | Wikipedia / Wikimedia Commons | Rebuilt on demand |
| Politician social presence | Curated registry + Bluesky public API | Live per request |
| Rights, housing and poverty news | Curated RSS/Atom registry (lib/news-sources.mjs) | Live, 30-minute cache |
Read /metodologia in the app before drawing conclusions. In short:
scripts/fetch-votes.mjs with the tally expected on the official
record; the fetcher refuses to publish a vote whose tally does not match. Each item is labelled
by type, because a "proposición no de Ley" or a motion is a non-binding position, not the
passage of a law. A person has a position only if their vote is on record — never inferred from
their party.motion for animationsnpm install
npm run dev
Open http://localhost:3000 — it redirects to /es. Also try /en and /ca. Every dataset the
app needs is committed under data/, so a clean checkout renders fully without running anything
else.
Pull fresh subsidy data from BDNS into the local snapshot:
curl http://localhost:3000/api/refresh
If you have set CRON_SECRET locally (in .env.local), the endpoint is protected and the
call above returns 401. Pass the secret instead:
curl -H "Authorization: Bearer $CRON_SECRET" http://localhost:3000/api/refresh
Each of these regenerates one file under data/ and is safe to re-run. They are separate from
npm run build on purpose: they hit third-party sources, and none of them should run during a
deploy.
| Command | Writes | Notes |
|---|---|---|
npm run build:salaries -- <csv> | data/salaries.json | Officeholder pay from the transparency CSV export |
npm run build:votes | data/votes.json | Pinned roll calls; aborts if a tally does not match the official record |
npm run discover:votes -- XV | nothing | Shortlists candidate votes for a human to review |
npm run build:photos | data/photos.json | Wikimedia portraits; skips anything not freely licensed. Re-run to top up after throttling |
npm run build:foundations -- <pdf> | data/foundations.json | Python, needs pip install pypdf; aborts unless the extracted sums reconcile with the report's own totals |
npm run build:deputies | data/deputies.json, data/interests.json | Congreso roster, deputy pages and interests open data; caches each first asset-declaration PDF locally; aborts unless every roster entry matches exactly one deputy page |
npm run check:deputies | nothing | The deputy-to-register join; exits non-zero on a missing or stale alias, a party-family disagreement or a slug collision |
npm run build:declarations | data/declarations.json | Publishes only transcriptions that pass a check, and lists the rest |
npm run check:declarations | nothing | Re-runs the checks on every published declaration |
npm run check:feeds | nothing | Health-checks every news feed; exits non-zero on a dead, unparseable or stale source |
Run npm run check:feeds after editing lib/news-sources.mjs. A feed can answer HTTP 200 and
still have published nothing for two years, so the check reports the age of each source's newest
item rather than its status code.
Do not run
npm run buildwhilenpm run devis running. The two share.nextand the production build corrupts the dev server's chunks (Cannot find module './586.js'). Stop dev, delete.next, then build.
BDNS /api/partidospoliticos/busqueda
│ (lib/bdns.ts)
▼
GET /api/refresh ──► lib/store.ts ──► Vercel KV (production)
└──► data/subsidies.json (local dev, committed seed)
│
▼
lib/data.ts (read + cache) ──► lib/normalize.ts (aggregate) ──► app/[locale]/* (render)
The browser never calls BDNS directly — pages read the stored snapshot, so rendering is fast
and free of CORS and rate-limit problems. data/subsidies.json is committed so the app works
on a clean checkout before any refresh has run.
The other layers are static: a build script writes a JSON file under data/, a lib/*.ts module
loads and caches it, and lib/people.ts joins them into one profile per officeholder. Names are
folded through the single shared implementation in lib/name-key.mjs — if the app and a build
script folded names differently, portrait and social lookups would silently miss.
Locale lives in the URL (/es, /en, /ca), which keeps pages statically generated.
middleware.ts redirects unprefixed paths, choosing the locale from the locale cookie,
then Accept-Language, then the Spanish default.lib/locales.ts holds the locale constants only, so the edge middleware does not pull in the
translation tables.lib/i18n.ts holds the dictionaries and getDict(locale).lib/format.ts.Party names, official job titles and cited report titles stay in their original language on purpose — they are proper names, not UI copy.
Import the repository at vercel.com. Next.js is auto-detected; keep the default build settings.
Storage tab → create an Upstash for Redis / KV store and connect it to the project. This
sets KV_REST_API_URL and KV_REST_API_TOKEN, which lib/store.ts picks up automatically.
Without it the daily refresh cannot persist, because Vercel's filesystem is read-only.
Settings → Environment Variables → add CRON_SECRET with a long random value:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
Set this. Without it, /api/refresh is an unauthenticated public write endpoint.
Redeploy so the new environment variables take effect.
The daily cron (/api/refresh, 06:00) is declared in vercel.json and appears automatically
under Settings → Cron Jobs. Verify the whole chain with:
curl -H "Authorization: Bearer $CRON_SECRET" https://YOUR-APP.vercel.app/api/refresh
A healthy response reports "storage":{"configured":"kv","writtenTo":"kv"}.
| Path | Page |
|---|---|
/[locale] | Portal: headline figures, how each group voted, rights and housing news |
/[locale]/financiacion | Money: subsidies dashboard and the party-linked foundations layer |
/[locale]/politicos | Every officeholder and sitting deputy: search, party facets, paging |
/[locale]/politicos/declaraciones | What each sitting deputy declared to Congress, side by side, in alphabetical order |
/[locale]/politico/[slug] | One person: pay, party funding, declarations to Congress, recorded ballots, social, news |
/[locale]/party/[nif] | One party: public and private money, faces, ledger, news |
/[locale]/votaciones | Key votes: result, per-group breakdown, deputy search |
/[locale]/metodologia | Methodology, legal caveats, and the full news-source registry |
/sueldos, /caras and /politician/[slug] are permanent redirects to /politicos; the pages
were merged. See next.config.ts.
API routes: /api/refresh (BDNS pull, cron-protected), /api/news, /api/bluesky.
| Path | Role |
|---|---|
lib/bdns.ts | BDNS API client — endpoint, organ list, pagination |
lib/store.ts | Snapshot persistence: Vercel KV in production, filesystem in dev |
lib/data.ts | Load, cache and invalidate the aggregated snapshot |
lib/normalize.ts | Parse beneficiario into NIF, classify subsidy kind, aggregate, filter |
lib/parties.ts | Canonical NIF → party registry (name, colour, bloc) |
lib/people.ts | The join: one profile per officeholder and sitting deputy from every dataset |
lib/name-key.mjs | Shared accent-folded name keys — single source of truth for every join |
lib/politicians.ts | Curated politicians with verified Bluesky handles |
lib/donations.ts | Private donations 2020, transcribed from Tribunal de Cuentas report 1573 |
lib/foundations.ts + scripts/extract-foundations.py | Party-linked foundations from report 1.642 |
lib/salaries.ts + scripts/build-salaries.mjs | Officeholder pay: load, search, party join |
lib/votes.ts + scripts/fetch-votes.mjs | Pinned roll-call votes and per-deputy positions |
lib/deputies.ts + scripts/fetch-deputies.mjs | Sitting deputies, their filings, and the interests open data |
lib/deputy-join.mjs + scripts/check-deputies.mjs | The deputy-to-register join (aliases, party families) and its guard |
lib/declarations.ts + scripts/build-declarations.mjs | Asset declarations and interests: types, loaders, and the checked build |
lib/declaration-totals.mjs + scripts/check-declarations.mjs | The totals rule shared by the page and the checks |
scripts/declaration-transcription.md | The instructions every transcription reader follows |
The full news-source registry, including the feeds deliberately excluded and the reason for each,
is listed in the app at /metodologia and in lib/news-sources.mjs.
scripts/discover-votes.mjs| Finds candidate votes for review (publishes nothing) |
lib/photos.ts + scripts/fetch-photos.mjs | Freely-licensed portraits with attribution |
lib/news.ts | Feed fetching and merging: RSS and Atom, staleness guards, per-source cap |
lib/news-sources.mjs + scripts/check-feeds.mjs | The feed registry and its health check |
lib/i18n.ts, lib/locales.ts | Dictionaries and locale constants |
middleware.ts | Locale redirects |
components/Sidebar.tsx | Left rail navigation and the mobile menu |
components/Dashboard.tsx | Overview: totals, filters, ranked bars |
components/StanceByGroup.tsx | Per-group ballots, labelled by how each group voted |
components/Declarations.tsx | Profile section: asset declaration, economic interests, caveat |
components/NewsFeed.tsx | News panel: topic mode (registry) or query mode (search) |