/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * * `ryhti`: Suomen ympäristökeskus' Ryhti built-environment address CSV adapter, covering Finland * and Åland. * * Input is the comma-separated `open_address.csv.gz`, decompressed, that SYKE publishes for the * whole country at `https://paikkatiedot.ymparisto.fi/geoserver/www/open_address.csv.gz`. * The file quotes fields, so the reader is quote-aware: a split on `,` misaligns every column * and reports 460 distinct `municipality_number` values where 308 exist. * Which columns are quoted is a property of the edition rather than of the format. * The edition served on 2026-10-02, `last-modified` `Thu, 1 Oct 2026 05:20:03 GMT` and * `content-length` 351288399, quotes `address_number`, the two number-part columns, * `municipality_number`, `postal_code` and `location_srid`, leaving the header and * every name column bare. * * A row's country comes from `municipality_number` rather than from the caller. Åland is part of * Finland and its sixteen municipalities carry Finnish municipality numbers, so one national file * holds both jurisdictions and {@linkcode ALAND_MUNICIPALITIES} is what separates them. * * The street and the house number are read from the publisher's own part columns rather than from * its inline address text. * `address_name_fin` is the whole of `address_fin` or a space-delimited prefix of it, and the four * number-part columns reproduce the publisher's inline number. * Measured over the first 292,293 rows of the 2026-10-02 edition: 278,262 rows populate both * columns, 0 of them place `address_name_fin` anywhere but at the head of `address_fin`, and the * composed number equals the inline remainder byte for byte on all 265,830 numbered rows. * No row publishes inline address text with both name columns empty, * so reading the name columns loses no address. * * `address_number` is not a house number. It is a 1-based ordinal over the addresses sharing one * `building_key`, which is how a corner building's several frontages are numbered, and it holds nine * distinct values across the file. The adapter ignores it. * * The file is bilingual, and which column carries which language depends on the municipality. On * mainland Finland `address_name_fin` is the Finnish name and `address_name_swe` the Swedish one. On * Åland the `*_fin` columns, where populated at all, hold the **Swedish** name: `address_fin` reads * `Skogshyddsvägen 11`. * So the adapter prefers `*_swe` on Åland and `*_fin` on the mainland, and emits one row per * published record from the preferred language's columns. * `locale` names the language of the name it emitted rather than the language of the column that * name came from, which gives three values. * `fi-FI` is a mainland record named in `address_name_fin`. * `sv-FI` is a mainland record that populates `address_name_swe` alone, which is the form a * Swedish-speaking municipality publishes. * `sv-AX` is every Åland record, because the Swedish columns are the populated ones there and the * `*_fin` columns hold the Swedish name where they are populated at all. * A mainland record's Swedish name, where the record publishes both, is not emitted as a second * row: a record is one premise, and `CanonicalRow` carries one written surface. * * SYKE's metadata record `{DBD610F4-3392-44CD-B601-BAE8FA547A57}` grants CC BY 4.0 for its open data * and the register's two elected decisions for this file record `CC-BY-4.0` in their `spdx` field, so * the adapter records that license on every row. SYKE states the attribution it wants as * `Lähde: Syke Ryhti`, and the model card must carry it. * * The adapter streams with `CSVSpliterator.fromAsync`, so the 3.8M-row file never sits in memory. It * honors `opts.limit`, `opts.signal` and `opts.country`. */ import { type CorpusAdapter } from "#types"; /** * Registry id for this adapter. * * Stamped into every row it emits, so a corpus record can be traced back to the dataset it came from. */ export declare const RYHTI_ADAPTER_ID = "ryhti"; /** * The sixteen `municipality_number` values of Åland's municipalities. * * Every other number in the file belongs to a mainland Finnish municipality. * The file holds 308 distinct values, and these sixteen cover 32,518 of its 3,862,609 rows. * * The column is a zero-padded three-digit string, so a reader compares the padded form. */ export declare const ALAND_MUNICIPALITIES: ReadonlySet; /** * Every jurisdiction this adapter emits, checked against a caller's `--country`. */ export declare const RYHTI_COUNTRIES: readonly string[]; /** * The four columns that hold a house number, declared as one shape because * {@linkcode composeRyhtiHouseNumber} reads these four columns and derives the number from them. */ interface RyhtiNumberParts { number_part_of_address_number: string; number_part_of_address_number2: string; subdivision_letter_of_address_number: string; subdivision_letter_of_address_number2: string; } /** * The country a row belongs to, read from its municipality number. * * The comparison is against the zero-padded three-digit form the file publishes, * and a shorter value is padded rather than refused, so `35` reads as Brändö. */ export declare function countryOfFinnishMunicipality(municipalityNumber: string): string; /** * The house number, composed from the four part columns. * * SYKE splits `41a` into a number part and a subdivision letter, and a range such * as `184-183b` across a second pair of the same two columns. * The second pair is appended after a hyphen when either of its halves is populated. * * @returns The composed number, or an empty string for a row with no number at all, * which a caller treats as a named place rather than assigning it a number. */ export declare function composeRyhtiHouseNumber(record: Partial): string; export declare function createRyhtiAdapter(): CorpusAdapter; /** * The configured adapter instance registered with the corpus builder. */ export declare const ryhtiAdapter: CorpusAdapter; export {}; //# sourceMappingURL=adapter.d.ts.map