Skip to content

Inferi0r/restzetels

Repository files navigation

Restzetels dashboard

A small static site + serverless fetchers to visualize Dutch House of Representatives election results (ANP, NOS, and optional Kiesraad) with rest seat calculations.

Party Labels (per year)

Use your browser’s “View Page Source” (or prepend view-source:) on the ANP widget page to locate the embedded party label data used for mapping (long/short names, NOS short names, colors, etc.).

  • ANP widget links: often discoverable via AD.nl election pages (they embed the official ANP widgets). Open the page source and look for the ANP widget URL.

Serverless PHP functions (fetch layer)

Website hosting

Run locally (PHP built-in server)

  • cd into the project root
    • cd /Users/arcovink/Documents/restzetels
    • php -S 127.0.0.1:5000
    • Open http://127.0.0.1:5000/index.html

Repository notes

  • 2023 logic is the correctness baseline for seats/rest seats and data joins.
  • Year-specific assets (e.g., party labels and optional Kiesraad totals) can be added alongside the generic code to enable full feature parity for new years.

Google Analytics

Deployment notes

Build ID and instant refresh

We use a single build identifier to force fresh assets and a service worker upgrade per deploy.

  • Bump in one place: edit js/config.js and change BUILD_ID (e.g., 2025-11-01-02).
  • What it does:
    • Registers the service worker as sw.js?v=BUILD_ID, so the browser detects a new SW and upgrades.
    • The SW uses BUILD_ID to version caches (static-<BUILD_ID>, data-<BUILD_ID>, etc.).
    • The page auto‑reloads once when the new SW takes control, so visitors see the newest build immediately.
  • HTML caching at the edge:
    • _headers sets Cache-Control: no-store for / and all *.html, so Cloudflare won’t serve stale HTML shells.
    • Static assets can be long‑lived; the SW and (optional) URL query strings ensure fresh content after deploy.

Steps per deploy

  1. Update BUILD_ID in js/config.js.
  2. Deploy the site.
  3. Verify:
    • curl -I https://<host>/ should not show a long s-maxage on HTML (expect no-store/no-cache).
    • curl -I https://<host>/sw.js?v=BUILD_ID should be no-store.
  4. Load the site: it should auto‑refresh once and then run the new build.

About

Restzetels Nederlandse Verkiezingen

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors