Finland: water_bodies bypasses the R94 casing rule — the ten biggest lakes ship in capitals #133

Closed
opened 2026-08-15 18:50:14 +00:00 by art-bot · 1 comment
Collaborator

Found reviewing #130 (issue #113). #113 makes R94 casing "one shared rule" in the
fi_paikannimi_cased staging pass, read by places, railways and stations.
There is a fifth consumer of the same register that it does not cover.

water_bodies (conf/fimap.yaml) joins fi_paikannimi for lake and watercourse
names (kohdeluokka 36201/36301) and takes teksti raw:

SELECT p.teksti
FROM fi_paikannimi p
WHERE p.kohdeluokka IN (36201, 36301)

Ten all-caps names are on the map today, and they are the biggest lakes in the
country, because size is what earns a label at all:

SAIMAA, PÄIJÄNNE, PIELINEN, NÄSIJÄRVI, KALLAVESI, KEITELE, PUULA,
KIANTAJÄRVI, SUONTEE, ALA-KEITELE

SELECT DISTINCT name FROM map_water_bodies_14
WHERE country='fi' AND name = upper(name) AND name <> lower(name);

This is older than #113 — the layer never had the initcap idiom either — but it is
what "one shared rule" has to mean to be true.

The change

Two kohdeluokka in the staging pass's WHERE, and the layer reading name:

-  WHERE p.kohdeluokka IN (48111, 48112, 48120, 48130, 14201)
+  WHERE p.kohdeluokka IN (48111, 48112, 48120, 48130, 14201, 36201, 36301)

-      staging: [fi_jarvi, fi_virtavesialue, fi_paikannimi]
+      staging: [fi_jarvi, fi_virtavesialue, fi_paikannimi_cased]
-               n.teksti AS name
+               n.name AS name
-          SELECT p.teksti
-          FROM fi_paikannimi p
+          SELECT p.name
+          FROM fi_paikannimi_cased p

Already measured against the live register

The rule needs no extension to handle these — it was run over both series as they
stand:

  • 0 of 155 844 water-name rows come out all-caps under it.
  • All 25 all-caps names in 36201/36301 come back correct: the sea and gulf
    names via cased twins (BOTTNISKA VIKEN -> Bottniska viken, SKÄRGÅRDSHAVET ->
    Skärgårdshavet, HANGON ITÄINEN SELKÄ -> Hangon itäinen selkä), the lakes via
    the first-word rule (Saimaa, Päijänne, Pielinen), and ALA-KEITELE ->
    Ala-Keitele keeps its capital because Keitele is itself a register name — the
    hyphen-parts rule doing exactly what it was written for.

Why it is not in #130

It needs a water_bodies re-import to verify, and the importer re-fetches the MTK
sources first — 5.65 GB for fi_mtk_muut.gpkg, which exceeds the claude user's disk
quota on /stuff. The SQL is verified at source level; the layer is not. Shipping
the acceptance test without the import would have left it red.

Acceptance test to land with it

- name: "R94: no all-caps Finland water body labels, and Saimaa is named"
  timeout: 10
  requires: [map_water_bodies_14_<cc>]
  query: >
    SELECT NOT EXISTS (SELECT 1 FROM map_water_bodies_14
                       WHERE country = 'fi' AND name = upper(name) AND name <> lower(name))
       AND EXISTS (SELECT 1 FROM map_water_bodies_14
                   WHERE country = 'fi' AND name = 'Saimaa') AS passed,
           count(*) FILTER (WHERE name = upper(name) AND name <> lower(name)) AS allcaps
    FROM map_water_bodies_14 WHERE country = 'fi'

The presence half is not decoration: absence of all-caps names is also what a
layer whose name join silently broke looks like. Same reason #130's stations test
had to be strengthened.

R94's entry in docs/country-requirements.md already records this gap as the
lesson ("normalize once, in one place, for every series"); this issue closes it.

Found reviewing #130 (issue #113). #113 makes R94 casing "one shared rule" in the `fi_paikannimi_cased` staging pass, read by `places`, `railways` and `stations`. There is a fifth consumer of the same register that it does not cover. `water_bodies` (conf/fimap.yaml) joins `fi_paikannimi` for lake and watercourse names (kohdeluokka 36201/36301) and takes `teksti` raw: SELECT p.teksti FROM fi_paikannimi p WHERE p.kohdeluokka IN (36201, 36301) **Ten all-caps names are on the map today**, and they are the biggest lakes in the country, because size is what earns a label at all: SAIMAA, PÄIJÄNNE, PIELINEN, NÄSIJÄRVI, KALLAVESI, KEITELE, PUULA, KIANTAJÄRVI, SUONTEE, ALA-KEITELE SELECT DISTINCT name FROM map_water_bodies_14 WHERE country='fi' AND name = upper(name) AND name <> lower(name); This is older than #113 — the layer never had the initcap idiom either — but it is what "one shared rule" has to mean to be true. ## The change Two kohdeluokka in the staging pass's WHERE, and the layer reading `name`: - WHERE p.kohdeluokka IN (48111, 48112, 48120, 48130, 14201) + WHERE p.kohdeluokka IN (48111, 48112, 48120, 48130, 14201, 36201, 36301) - staging: [fi_jarvi, fi_virtavesialue, fi_paikannimi] + staging: [fi_jarvi, fi_virtavesialue, fi_paikannimi_cased] - n.teksti AS name + n.name AS name - SELECT p.teksti - FROM fi_paikannimi p + SELECT p.name + FROM fi_paikannimi_cased p ## Already measured against the live register The rule needs no extension to handle these — it was run over both series as they stand: * **0 of 155 844** water-name rows come out all-caps under it. * All **25** all-caps names in 36201/36301 come back correct: the sea and gulf names via cased twins (`BOTTNISKA VIKEN` -> Bottniska viken, `SKÄRGÅRDSHAVET` -> Skärgårdshavet, `HANGON ITÄINEN SELKÄ` -> Hangon itäinen selkä), the lakes via the first-word rule (Saimaa, Päijänne, Pielinen), and `ALA-KEITELE` -> Ala-Keitele keeps its capital because Keitele is itself a register name — the hyphen-parts rule doing exactly what it was written for. ## Why it is not in #130 It needs a `water_bodies` re-import to verify, and the importer re-fetches the MTK sources first — 5.65 GB for fi_mtk_muut.gpkg, which exceeds the claude user's disk quota on /stuff. The SQL is verified at source level; the layer is not. Shipping the acceptance test without the import would have left it red. ## Acceptance test to land with it - name: "R94: no all-caps Finland water body labels, and Saimaa is named" timeout: 10 requires: [map_water_bodies_14_<cc>] query: > SELECT NOT EXISTS (SELECT 1 FROM map_water_bodies_14 WHERE country = 'fi' AND name = upper(name) AND name <> lower(name)) AND EXISTS (SELECT 1 FROM map_water_bodies_14 WHERE country = 'fi' AND name = 'Saimaa') AS passed, count(*) FILTER (WHERE name = upper(name) AND name <> lower(name)) AS allcaps FROM map_water_bodies_14 WHERE country = 'fi' The presence half is not decoration: absence of all-caps names is also what a layer whose name join silently broke looks like. Same reason #130's stations test had to be strengthened. R94's entry in docs/country-requirements.md already records this gap as the lesson ("normalize once, in one place, for every series"); this issue closes it.
art-bot self-assigned this 2026-08-15 18:50:14 +00:00
Owner

Resolved by the #130 update — commit 676b753 on issue-113-fi-name-casing (PR #130) implements exactly the spec in this issue's body:

  • fi_paikannimi_cased WHERE gains 36201, 36301;
  • water_bodies now stages on fi_paikannimi_cased and reads p.name instead of p.teksti;
  • the acceptance test from the body lands on the water_bodies layer.

Verified against the live DB after the re-import (fetch no-op — the 5.65 GB MTK source was already on disk): 0 of 155 844 water-name rows all-caps, all 25 all-caps names in 36201/36301 come back correct, map_water_bodies_14 fi shows the ten lakes cased with Saimaa named and the row count unchanged (171 646), places/railways/stations untouched, fimap -acceptance all 15/15 and make acceptance green. See the PR comment for the full numbers.

Resolved by the #130 update — commit 676b753 on `issue-113-fi-name-casing` (PR #130) implements exactly the spec in this issue's body: - `fi_paikannimi_cased` WHERE gains `36201, 36301`; - `water_bodies` now stages on `fi_paikannimi_cased` and reads `p.name` instead of `p.teksti`; - the acceptance test from the body lands on the water_bodies layer. Verified against the live DB after the re-import (fetch no-op — the 5.65 GB MTK source was already on disk): 0 of 155 844 water-name rows all-caps, all 25 all-caps names in 36201/36301 come back correct, map_water_bodies_14 fi shows the ten lakes cased with Saimaa named and the row count unchanged (171 646), places/railways/stations untouched, fimap `-acceptance all` 15/15 and `make acceptance` green. See the PR comment for the full numbers.
art closed this issue 2026-08-16 00:05:48 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
art/ismap#133
No description provided.