Check and link company register numbers per country, offline (#935) #1022
No reviewers
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
security
tier
1
tier
2
tier
3
tier/4
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo!1022
Loading…
Reference in a new issue
No description provided.
Delete branch "935-register-links"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs #935 (the online half stays open, tracked in #1021)
What changed
The Company register number scheme (
register), inside the identifiers module and still offline:rel="noopener noreferrer external").Schemegainslink_by, a function from the value to an address, for a link that depends on the value; other schemes are unchanged.Not in this PR: the LEI cross-check. An LEI's first four characters name its issuing LOU and not a country, so nothing sound can be said offline; it needs GLEIF's
registeredAsand belongs to #1021.URLs checked against the live registers: NO, EE, BE (page titles read), GB, NL, FR (reachable). Dropped as unverifiable: Finland (
tietopalvelu.ytj.fideep link not documented anywhere I could find), Czechia (the ARES web?ico=parameter is undocumented; its REST API is not a page), Germany and Switzerland (no stable per-company address). DK is kept on the strength of the documenteddatacvr.virk.dk/enhed/virksomhed/<cvr>pattern; the site answers 403 to a script, so it was not opened here.Library check
python-stdnum (LGPL-2.1+, pure Python, maintained) covers FR, CZ, NO, FI and EE, but not Poland's KRS, and ships some two hundred formats for six short sums. I wrote the six as small pure functions with their sources named, and ran them against python-stdnum on 20,000 random numbers each: they agree (the Estonian first-digit rule and the SIRET's SIREN rule were taken from it after the first run disagreed). Czech IČO differs only on numbers starting with 9, which stdnum rejects as a DIČ rule and the IČO algorithm does not.
Tests
tests/test_register_numbers.py: valid and invalid numbers per country (including wrong length and the La Poste and Estonian second-pass cases), every link, the BRIS fallback, no link outside it, hostile numbers never reaching an address, the badge markup,linked(). Full unit suite green (19460 passed).Model use
Written with Claude Code, reviewed by the person who opens the PR.
🤖 Generated with Claude Code
2bd655da9369acb053ea69acb053ea5a2c922c7e