Skip to content

Latvia ๐Ÿ‡ฑ๐Ÿ‡ป CAA Registry โ€‹

Namelv-caa-registry
CountryLatvia
Registration prefixYL-
Data sourcehttps://data.gov.lv/dati/lv/api/action/datastore_search (resource_id dbde00e6-8616-449a-8cac-ef748c6793f3)
FormatJSON API (data.gov.lv CKAN datastore)
Run frequencyWeekly (Tuesday, 16:10 UTC)
Depends on Mictronics for ICAO hexYes โ€” the Latvia CAA register does not publish ICAO hex (Mode S) addresses; registrations are resolved via RediSearch against Mictronics records (idx:aircraft:mictronics). Must run after the mictronics runner.

How it works โ€‹

The register is fetched in one request from the data.gov.lv CKAN datastore_search API against a fixed resource ID, with a page size large enough (limit=50000) to return the whole dataset in a single call. Records whose Registration_Mark does not start with YL- are discarded during parsing. Free-text fields (Model, Aircraft_Model_Category) have internal whitespace collapsed to single spaces. Construction_Year is a bare year, so it is stored as manufactured_date with a synthetic -01-01 day/month (only if it parses as an integer in the range 1900โ€“2100). Every written record explicitly sets military: false โ€” this register is exclusively civil, and the explicit value ensures a stale military: true flag (from Mictronics or a prior record on a reused hex) is corrected on re-registration.

Columns โ€‹

Source columnImportedNotes
_idโŒCKAN datastore internal row identifier; not read by this runner
Registration_Markโœ…YL-prefix filter; used as the Mictronics lookup key
Modelโœ…Whitespace-collapsed โ†’ aircraft.model
Construction_Yearโœ…Bare year โ†’ aircraft.manufactured_date as {year}-01-01; ignored if outside 1900โ€“2100
Serial_Noโœ…โ†’ aircraft.serial_number
Registered_onโŒPresent in source; not read by this runner
Aircraft_Model_Categoryโœ…Whitespace-collapsed โ†’ aircraft.type

See specs/data-dictionary.yaml (lv-caa-registry entry) for full column semantics and cross-source schema notes.

Example Output โ€‹

Read back the merged record for a given ICAO hex (combines this runner's data with Mictronics and any other sources that have written to the same key):

bash
docker run --rm --network host redis:latest redis-cli EVAL "$(cat ./shared/lua/merge_aircraft.lua)" 0 502C8D | python3 -m json.tool --sort-keys --no-ensure-ascii
json
{
    "aircraft": {
        "manufactured_date": "2005-01-01",
        "manufacturer": "CESSNA",
        "manufacturer_model": "CESSNA 172 Skyhawk",
        "model": "Cessna 172S",
        "serial_number": "172S9795",
        "type": "Aircraft",
        "type_designator": "C172"
    },
    "data_sources": [
        "mictronics",
        "lv-caa-registry"
    ],
    "icao_hex": "502C8D",
    "military": false,
    "registration": "YL-MBL"
}
bash
docker run --rm --network host redis:latest redis-cli EVAL "$(cat ./shared/lua/merge_aircraft.lua)" 0 502CCC | python3 -m json.tool --sort-keys --no-ensure-ascii
json
{
    "aircraft": {
        "manufactured_date": "2004-01-01",
        "manufacturer": "AIRBUS",
        "manufacturer_model": "AIRBUS A-321",
        "model": "A321-231",
        "serial_number": "2211",
        "type": "Aircraft",
        "type_designator": "A321"
    },
    "data_sources": [
        "mictronics",
        "lv-caa-registry"
    ],
    "icao_hex": "502CCC",
    "military": false,
    "registration": "YL-LCQ"
}

Configuration โ€‹

See Data Runners for the full list of environment variables every runner reads. This runner writes aircraft:registry:{icao_hex} with a fixed 14-day TTL (ENRICHMENT_TTL_SECONDS in shared/timing.py).

MQTT โ€‹

Published once, at the end of a run, to SkyFollower/runner/lv-caa-registry/statistic/{name} (all retained):

Topic suffixValueFormat
records_importede.g. 271Integer as string
last_run_ate.g. 2026-07-07T14:32:01.123456+00:00ISO 8601 UTC
last_run_statusSuccess or FailureString

Home Assistant autodiscovery configs are also published (retained) to homeassistant/sensor/SkyFollower_runner_lv_caa_registry_{name}/config for each of the three stats above.