KSH settlement register – data model, build and matching

Storage of the settlement register and of address matches, the build and the matching scores, the permission keys and the background matching run.

Overview

The KSH settlement register (code, name, postcode, county, district, region, NUTS) and the matching of company addresses to it. The register is used to resolve county names in KSH data, by the property price report (county, NUTS) and by the company tiles.

Data model

Table names carry the installation's own prefix in the database.

TableRoleMain fields
ksh_settlementsettlement registercode, name, normalised and ASCII name, postcode, county, district, region, NUTS, status
address_kshaddress–settlement matchaddress, settlement, status, score, name hash
addressaddress master (read only)city

Process

  1. Save: the name is required; the ksh library builds a normalised and an ASCII name; with an empty code the code is A plus 12 characters of the SHA1 of the normalised name.
  2. Build (buildaddresses): upsert into the register from the distinct settlement names of the address master; county and NUTS are not overwritten; returns processed, new, updated and incomplete counts.
  3. Matching (match): info=1 returns a summary, processing runs in batches of 200 (start, limit). By the normalised city name: a match with NUTS is status 1 (score 100), without NUTS status 2 (70), no match status 4 (0); upsert into address_ksh.
  4. Incomplete row: empty county or NUTS; the count is shown in the list header.

Permissions

  • list (content scope: ksh_settlement / ksh_settlement_id rules), edit (form), save canSave(), status, delete, build, match, debug (last SQL of the list).

Background job

The cron/kshmatch entry point runs the same matching in batches of 500. It is a direct entry point, not part of the central job queue; no authentication check is visible in the controller.

Known limitations

  • Deletion is physical, without checking the address_ksh matches.
  • There is no endpoint for the statusdelete key.
  • The Hungarian caption of the name field reads "Kiegyenlítés" and the German menu item "Abrechnungen" — translation errors; the field holds the settlement name.