Skip to content

Commit 6a5f7df

Browse files
authored
Merge pull request #7 from r33hab/site-redesign
Redesign the site as an instrument with a console of real API calls
2 parents ead7061 + 0013a2a commit 6a5f7df

21 files changed

Lines changed: 1698 additions & 364 deletions

File tree

‎.github/workflows/harvest.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
uv run norapi build
2222
uv run norapi enrich --workers 6
2323
uv run norapi check --curated-only
24+
uv run norapi samples
2425
- name: Commit the new registry if it changed
2526
run: |
2627
if git diff --quiet -- registry/; then

‎.stagecraft/log.json‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"used": ["Specimen"],
3+
"runs": [
4+
{
5+
"date": "2026-11-10",
6+
"direction": "Specimen",
7+
"motion": "Composed",
8+
"platform": "desktop-first",
9+
"signature": "the console replays five captured calls (registry/samples.json)",
10+
"previous": "Hallmark Cobalt (2026-10-15), see .hallmark/"
11+
}
12+
]
13+
}

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ All notable changes to this project are documented here. The format follows
66
## 2026-11-10
77
### Added
88
- Bank and payment APIs, each marked with who can get access and what it takes: the SpareBank 1 personal API (own accounts, BankID, no licence), Enable Banking, Neonomics and Tink as open banking aggregators, the PSD2 and partner portals of DNB, Nordea and Danske Bank (licence from Finanstilsynet and an eIDAS certificate, or an agreement), Vipps MobilePay ePayment, Login and Report (merchant or accounting partner agreement), BankID OpenID Connect (through a BankID partner), and Norges Bank's payment statistics file. Caveats spell out the licence and agreement requirements; PSD2 entries carry the `psd2` tag.
9+
- Front page console: five real calls (Enhetsregisteret, Kommuneinfo, grunnbeløpet, luftkvalitet, magasinfylling) replayed with the answer each API gave, captured by the new `norapi samples` command into `registry/samples.json` and refreshed by the weekly harvest. The same answer shows under the quick start on the API's own page. See ADR-0003.
910
- Twenty more curated APIs from counties, municipalities and smaller institutions, each probed live: NDLA's open APIs (search, articles, images, audio, concepts, learning paths, subject taxonomy, oEmbed) with their OpenAPI specs, Nasjonalmuseet's collection API (Linked Art and IIIF without a key), Norid RDAP for .no domains, the BIBSYS authority file (SRU), Nord Pool's day-ahead prices for NO1 to NO5, ReMidt's waste collection calendar (also Fosen), and the ArcGIS map servers of Bergen, Fredrikstad, IKT Agder (Arendal, Grimstad, Froland) and the Vestland, Trøndelag, Troms and Agder county municipalities.
1011
- `registry/retired.yaml`: harvested entries whose service a manual check found gone are left out of the registry, with the reason; the catalogue still lists them, so the weekly harvest would otherwise bring them back. Starts with Oslo's two HC-plasser WFS entries, whose host no longer resolves.
1112
### Changed
13+
- Site redesign: warm paper and near-black ink with one signal red, Geist and Geist Mono self-hosted (no Google Fonts request), a light and dark theme that follows the system with a toggle, numbered sections, the registry in numbers as a readout strip, provider and category counts as bars, and API pages with a framed fact sheet and the link check as status lights. Code, quick starts and answers share one dark console look. Passes axe (WCAG 2.2 AA), 24 px touch targets and no overflow down to 320 px.
1214
- The six NDLA APIs that Felles datakatalog lists under Vestland fylkeskommune (NDLA's host county) are curated under "NDLA (Vestland fylkeskommune)" with real endpoints and content licences instead of the catalogue's GPL code licence.
1315
- `sikt-bibsys-sru` also lists the catalogue's OAI-PMH endpoint.
1416
- `norges-bank-open-data` names the lending survey, liquidity, money market and settlement datasets and lists `/api/dataflow`; `ssb-statbank-api` names the bank deposit and interest rate tables.

‎Makefile‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
UV ?= uv
22

3-
.PHONY: setup lint test harvest build check search site mcp clean
3+
.PHONY: setup lint test harvest build enrich check samples refresh search site serve mcp clean
44

55
setup:
66
$(UV) sync
@@ -23,7 +23,10 @@ enrich: ## fetch OpenAPI documents, index their operations
2323
check: ## probe docs/spec/endpoint URLs of the curated entries
2424
$(UV) run norapi check --curated-only
2525

26-
refresh: harvest build enrich check ## the weekly run, by hand
26+
samples: ## run the front page's example calls, store the answers
27+
$(UV) run norapi samples
28+
29+
refresh: harvest build enrich check samples ## the weekly run, by hand
2730

2831
search: ## make search Q="kjøretøy"
2932
$(UV) run norapi search "$(Q)"

‎README.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
> wants to grow. If you know a Norwegian API that is missing, [suggest it](https://github.com/r33hAB/norapi/issues/new?template=nytt-api.yml).
3232
3333
<p align="center">
34-
<a href="https://r33hab.github.io/norapi/"><img src="docs/images/site.png" alt="The norapi front page: search field, the registry in numbers, and a grid of curated APIs" width="900"></a>
34+
<a href="https://r33hab.github.io/norapi/"><img src="docs/images/site.png" alt="The norapi front page: the search field next to a console replaying a real call to Enhetsregisteret and its answer, and the registry in numbers" width="900"></a>
3535
</p>
3636

3737
## Why
@@ -79,6 +79,7 @@ uv run norapi harvest # Felles datakatalog + Geonorge access -> d
7979
uv run norapi build # curated + harvested (+ cached specs) -> registry/
8080
uv run norapi enrich # OpenAPI documents -> specs.json + operations.json
8181
uv run norapi check --curated-only # probe docs, spec and endpoint URLs, record the verdicts
82+
uv run norapi samples # run the front page's five example calls, keep the answers -> samples.json
8283
uv run norapi site --out _site # the static site
8384
```
8485

@@ -147,10 +148,11 @@ src/norapi/
147148
build.py registry.json, llms.txt, FTS5 index
148149
search.py ranked search with filters, operation search
149150
check.py link checker
151+
samples.py the front page's example calls: run once a week, trimmed for display
150152
site.py static site generator
151153
cli.py / mcp_server.py
152-
registry/ curated YAML, access-review.yaml, retired.yaml, registry.json, llms.txt, specs.json, operations.json
153-
site/assets/ design tokens, stylesheet, client-side search, Open Graph image
154+
registry/ curated YAML, access-review.yaml, retired.yaml, registry.json, llms.txt, specs.json, operations.json, samples.json
155+
site/assets/ design tokens, stylesheet, self-hosted fonts (Geist, OFL), client-side search and console, Open Graph image
154156
tests/ unit tests on recorded fixtures, no network
155157
docs/adr/ decisions
156158
```
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# ADR-0003: The front page replays captured calls, never live ones
2+
3+
Date: 2026-11-10. Status: accepted.
4+
5+
## Context
6+
7+
The site's front page should show that the registry works, not only that it lists things: a
8+
real request to an API it lists, and the answer that came back. The site is static on GitHub
9+
Pages, and most of the APIs do not send CORS headers, ask for a client header, or rate-limit
10+
anonymous callers. A visitor's browser cannot be relied on to call them, and a page that fires
11+
requests at public-sector APIs on every view would be a poor neighbour.
12+
13+
## Decision
14+
15+
- `norapi samples` runs the first `curl` command in the quick start of five chosen entries
16+
(`SAMPLES` in `src/norapi/samples.py`), through the same public-only client as the link
17+
checker, and writes status, measured time, content type, size and a trimmed rendering of the
18+
body to `registry/samples.json`. The weekly harvest runs it after the link check.
19+
- The trimmed rendering keeps the API's key order, shows plain values before nested ones when it
20+
has to cut, and marks every cut with `…` and a count. The page says the answer was captured,
21+
and on which date.
22+
- A call that fails keeps its previous capture. A call whose entry has left the registry, or that
23+
did not answer 2xx, is not shown.
24+
- The site generator only reads the file. It never touches the network, so builds and tests stay
25+
offline and deterministic.
26+
- The console replays the calls in the browser (the command types, the wait is the measured
27+
time, the answer prints), pauses on hover, keyboard focus, a hidden tab or when scrolled away,
28+
and stops for good when the visitor picks a call. With reduced motion it is a static switcher.
29+
30+
## Consequences
31+
32+
- The answers on the page can be up to a week old; the date is printed next to them.
33+
- `samples.json` changes on every weekly run (timings, dates), so the harvest commit always
34+
touches it.
35+
- Picking other calls is a one-line change to `SAMPLES`; the call must be a plain GET in the
36+
entry's quick start that answers anonymously.

‎docs/concept.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Site concept
2+
3+
The design brief behind the web front door, kept so later changes stay in the same voice.
4+
5+
- **Concept:** the registry presents itself as an instrument. Every number on the page is
6+
counted from the registry, and the front page runs real calls against the APIs it lists.
7+
- **Carrier:** the console, dark in both themes. It is the hero, and the same component carries
8+
the quick start and the captured answer on each API page and the terminal band.
9+
- **Direction:** Specimen (mono labels, numbered sections, corner brackets, status lights, one
10+
signal red on warm paper), Composed motion, designed for desktop first with a full phone layout.
11+
- **Signature:** the console replays five captured calls: the command types, the wait is the
12+
response time measured at capture, the answer prints line by line (ADR-0003).
13+
14+
Rules that keep it honest: no invented numbers (counts come from `registry.json`, answers from
15+
`samples.json` with their capture date), no fade-ups on scroll, nothing that moves without a
16+
pause, and a static version under reduced motion.
17+
18+
Tokens live in `site/assets/tokens.css`; the stylesheet header in `style.css` repeats the brief.
19+
Type: Geist and Geist Mono, self-hosted (SIL OFL, `site/assets/fonts/OFL.txt`).

‎docs/images/site.png‎

22.7 KB
Loading

‎registry/samples.json‎

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
{
2+
"count": 5,
3+
"samples": [
4+
{
5+
"id": "brreg-enhetsregisteret",
6+
"label": "Søk i Enhetsregisteret",
7+
"command": "curl \"https://data.brreg.no/enhetsregisteret/api/enheter?navn=Digitaliseringsdirektoratet\"",
8+
"url": "https://data.brreg.no/enhetsregisteret/api/enheter?navn=Digitaliseringsdirektoratet",
9+
"status": 200,
10+
"reason": "OK",
11+
"ms": 268,
12+
"content_type": "application/json",
13+
"bytes": 5324,
14+
"captured_at": "2026-11-10T09:50:40+00:00",
15+
"lines": [
16+
"{",
17+
" \"_embedded\": {",
18+
" \"enheter\": [",
19+
" {",
20+
" \"antallAnsatte\": 487,",
21+
" \"epostadresse\": \"postmottak@digdir.no\",",
22+
" \"erIKonsern\": false,",
23+
" \"harRegistrertAntallAnsatte\": true,",
24+
" \"hjemmeside\": \"www.digdir.no\",",
25+
" \"konkurs\": false,",
26+
" \"maalform\": \"Bokmål\",",
27+
" \"navn\": \"DIGITALISERINGSDIREKTORATET\",",
28+
" \"organisasjonsnummer\": \"991825827\",",
29+
" \"overordnetEnhet\": \"932384469\",",
30+
"…"
31+
],
32+
"trimmed": true
33+
},
34+
{
35+
"id": "geonorge-kommuneinfo",
36+
"label": "Kommune for et punkt",
37+
"command": "curl \"https://ws.geonorge.no/kommuneinfo/v1/punkt?nord=59.91&ost=10.75&koordsys=4258\"",
38+
"url": "https://ws.geonorge.no/kommuneinfo/v1/punkt?nord=59.91&ost=10.75&koordsys=4258",
39+
"status": 200,
40+
"reason": "OK",
41+
"ms": 59,
42+
"content_type": "application/json",
43+
"bytes": 86,
44+
"captured_at": "2026-11-10T09:50:40+00:00",
45+
"lines": [
46+
"{",
47+
" \"fylkesnavn\": \"Oslo\",",
48+
" \"fylkesnummer\": \"03\",",
49+
" \"kommunenavn\": \"Oslo\",",
50+
" \"kommunenummer\": \"0301\"",
51+
"}"
52+
],
53+
"trimmed": false
54+
},
55+
{
56+
"id": "nav-grunnbelop",
57+
"label": "Grunnbeløpet",
58+
"command": "curl \"https://g.nav.no/api/v1/grunnbeløp\"",
59+
"url": "https://g.nav.no/api/v1/grunnbeløp",
60+
"status": 200,
61+
"reason": "OK",
62+
"ms": 311,
63+
"content_type": "application/json",
64+
"bytes": 177,
65+
"captured_at": "2026-11-10T09:50:41+00:00",
66+
"lines": [
67+
"{",
68+
" \"dato\": \"2026-05-01\",",
69+
" \"grunnbeløp\": 136549,",
70+
" \"grunnbeløpPerMåned\": 11379,",
71+
" \"gjennomsnittPerÅr\": 134419,",
72+
" \"omregningsfaktor\": 1.049086,",
73+
" \"virkningstidspunktForMinsteinntekt\": \"2026-06-01\"",
74+
"}"
75+
],
76+
"trimmed": false
77+
},
78+
{
79+
"id": "miljodir-luftkvalitet",
80+
"label": "Luftkvalitet i Oslo",
81+
"command": "curl \"https://api-luftmalinger.miljodirektoratet.no/public/aq/utd?areas=Oslo\"",
82+
"url": "https://api-luftmalinger.miljodirektoratet.no/public/aq/utd?areas=Oslo",
83+
"status": 200,
84+
"reason": "OK",
85+
"ms": 120,
86+
"content_type": "application/json",
87+
"bytes": 14823,
88+
"captured_at": "2026-11-10T09:50:41+00:00",
89+
"lines": [
90+
"[",
91+
" {",
92+
" \"id\": 19,",
93+
" \"zone\": \"Stor-Oslo\",",
94+
" \"municipality\": \"Oslo\",",
95+
" \"area\": \"Oslo\",",
96+
" \"station\": \"Kirkeveien\",",
97+
" \"type\": \"Veinær stasjon\",",
98+
" \"eoi\": \"NO0011A\",",
99+
" \"component\": \"PM10\",",
100+
" \"fromTime\": \"2026-11-10T09:00:00+01:00\",",
101+
" \"toTime\": \"2026-11-10T10:00:00+01:00\",",
102+
" \"value\": 8.623000000000001,",
103+
" \"unit\": \"µg/m³\",",
104+
"…"
105+
],
106+
"trimmed": true
107+
},
108+
{
109+
"id": "nve-magasinstatistikk",
110+
"label": "Fyllingsgrad i magasinene",
111+
"command": "curl \"https://biapi.nve.no/magasinstatistikk/api/Magasinstatistikk/HentOffentligDataSisteUke\"",
112+
"url": "https://biapi.nve.no/magasinstatistikk/api/Magasinstatistikk/HentOffentligDataSisteUke",
113+
"status": 200,
114+
"reason": "OK",
115+
"ms": 170,
116+
"content_type": "application/json",
117+
"bytes": 2455,
118+
"captured_at": "2026-11-10T09:50:41+00:00",
119+
"lines": [
120+
"[",
121+
" {",
122+
" \"dato_Id\": \"2026-11-01\",",
123+
" \"omrType\": \"EL\",",
124+
" \"omrnr\": 1,",
125+
" \"iso_aar\": 2026,",
126+
" \"iso_uke\": 44,",
127+
" \"fyllingsgrad\": 0.81551975,",
128+
" \"kapasitet_TWh\": 6.0032635,",
129+
" \"fylling_TWh\": 4.89578,",
130+
" \"neste_Publiseringsdato\": \"2026-11-11T13:00:00\",",
131+
" \"fyllingsgrad_forrige_uke\": 0.7783856,",
132+
" \"endring_fyllingsgrad\": 0.03713417",
133+
" },",
134+
"…"
135+
],
136+
"trimmed": true
137+
}
138+
]
139+
}

0 commit comments

Comments
 (0)