Skip to content

๐Ÿ‡ง๐Ÿ‡ท br-anac โ€‹

CountryBrazil
Registration prefixPP- / PR- / PT- / PS- / PU-
Data sourcehttps://sistemas.anac.gov.br/dadosabertos/Aeronaves/RAB/dados_aeronaves.json
FormatJSON API (fixed URL, full register dump)
Run frequencyWeekly (Wednesday, 08:10 UTC)
Depends on Mictronics for ICAO hexYes โ€” this runner does not publish ICAO hex addresses; registrations (formatted from MARCA) are resolved via RediSearch against Mictronics records (idx:aircraft:mictronics). Must run after the mictronics runner.

How it works โ€‹

The full Registro Aeronรกutico Brasileiro (RAB) JSON dump is downloaded from a fixed URL (utf-8-sig decoded). Records are filtered to active registrations only โ€” rows with a cancellation date (DTCANC) set, or whose CDINTERDICAO starts with R or M, are excluded. The MARCA field (e.g. PPAJH) is reformatted into a hyphenated registration (PP-AJH). Registrations are resolved to icao_hex in batches of 100 via RediSearch against the Mictronics index, then a type sanity check compares tokens from DSMODELO against the existing Mictronics record, rejecting the match only when both sides have tokens and none overlap. CDCLS is a compact 3-character code ({landing}{engine count}{propulsion}, or the literal RPA for drones) decoded into aircraft.type, aircraft.category, and the powerplant count/type. The embedded PROPRIETARIOSJSON owner list uses a non-standard /"" escape sequence for embedded quotes that is un-escaped before json.loads; only the first owner's name is kept, and placeholder values like Indisponรญvel are treated as absent. Unlike the other runners in this batch, writes to Redis here are per-record (not pipelined). 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.

Whenever a record has an aircraft.type_designator, aircraft:type:{type_designator} is looked up in Redis (populated by the mictronics runner) and, if found, its manufacturer_model and wake_turbulence_category are each set directly on this record (independently โ€” a type entry with only one of the two still sets that one) โ€” unconditionally, regardless of whether Mictronics also has values for the same hex. This runner's own type_designator is sourced directly from ANAC and is authoritative; merge_aircraft.lua's "registry wins over mictronics" precedence rule guarantees these values take priority at read time either way. The lookup is not a hard dependency โ€” a missing reference table entry, or the table not existing yet, leaves the record exactly as it would have been without this step.

Columns โ€‹

Source columnImportedNotes
MARCAโœ…Reformatted to hyphenated registration (e.g. PPAJH โ†’ PP-AJH); used as the Mictronics lookup key
DTCANCโœ…Used only as a filter (non-empty = inactive, row skipped); not stored
CDINTERDICAOโœ…Used only as a filter (R/M prefix = inactive, row skipped); not stored
CDCLSโœ…Decoded into aircraft.type, aircraft.category, aircraft.powerplant.count, aircraft.powerplant.type
NMFABRICANTEโœ…โ†’ aircraft.manufacturer
DSMODELOโœ…โ†’ aircraft.model; also used for the type sanity check against Mictronics
CDTIPOICAOโœ…โ†’ aircraft.type_designator; also used to look up aircraft:type:{type_designator} in Redis, setting aircraft.manufacturer_model and aircraft.wake_turbulence_category when found
NRSERIEโœ…โ†’ aircraft.serial_number
NRASSENTOSโœ…โ†’ aircraft.seats
NRANOFABRICACAOโœ…โ†’ aircraft.manufactured_date (4-digit year โ†’ YYYY-01-01T00:00:00Z)
PROPRIETARIOSJSONโœ…โ†’ registrant.names[0]; embedded JSON with a non-standard quote escape; placeholder names (e.g. Indisponรญvel) are filtered
CDPROPOSITOCAVEโŒPresent in source; not read by this runner
CDTIPOโŒPresent in source; not read by this runner
CFOPERACIONALโŒPresent in source; not read by this runner
DSCATEGORIAHOMOLOGACAOโŒPresent in source; not read by this runner
DSGRAVAMEโŒPresent in source; not read by this runner
DSMOTIVOCANCโŒPresent in source; not read by this runner
DTVALIDADECAโŒPresent in source; not read by this runner
DTVALIDADECVAโŒPresent in source; not read by this runner
DT_MATRICULAโŒPresent in source; not read by this runner
NRCERTMATRICULAโŒPresent in source; not read by this runner
NRPASSAGEIROSMAXโŒPresent in source; not read by this runner
NRPMDโŒPresent in source; not read by this runner
NRTRIPULACAOMINโŒPresent in source; not read by this runner
OPERADORESJSONโŒPresent in source; not read by this runner
QTMOTORโŒPresent in source; not read by this runner
TPCAโŒPresent in source; not read by this runner
TPMOTORโŒPresent in source; not read by this runner
TPOPERADORโŒPresent in source; not read by this runner
TPPOUSOโŒPresent in source; not read by this runner

See specs/data-dictionary.yaml (br-anac 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 A4A09D | python3 -m json.tool --sort-keys --no-ensure-ascii
json
{
    "aircraft": {
        "category": "Land",
        "manufactured_date": "2014-01-01T00:00:00Z",
        "manufacturer": "HAWKER BEECHCRAFT",
        "manufacturer_model": "BEECH 58 Baron",
        "model": "G58",
        "powerplant": {
            "count": 2,
            "type": "Piston"
        },
        "seats": 6,
        "serial_number": "TH-2398",
        "type": "Airplane",
        "type_designator": "BE58",
        "wake_turbulence_category": "Light"
    },
    "icao_hex": "A4A09D",
    "military": false,
    "registrant": {
        "names": [
            "CEILA SILVA LEMOS"
        ]
    },
    "registration": "PR-JOK",
    "source": "br-anac"
}
bash
docker run --rm --network host redis:latest redis-cli EVAL "$(cat ./shared/lua/merge_aircraft.lua)" 0 E47F21 | python3 -m json.tool --sort-keys --no-ensure-ascii
json
{
    "aircraft": {
        "category": "Land",
        "manufactured_date": "2005-01-01T00:00:00Z",
        "manufacturer": "BOEING COMPANY",
        "manufacturer_model": "BOEING 767-300",
        "model": "767-316F",
        "powerplant": {
            "count": 2,
            "type": "Turbo-jet"
        },
        "seats": 6,
        "serial_number": "34245",
        "type": "Airplane",
        "type_designator": "B763",
        "wake_turbulence_category": "Heavy"
    },
    "icao_hex": "E47F21",
    "military": false,
    "registrant": {
        "names": [
            "LAN CARGO S.A."
        ]
    },
    "registration": "PR-ABD",
    "source": "br-anac"
}

Configuration โ€‹

Reads settings.json (mounted at /app/settings.json):

ParameterRequiredDefaultNotes
redis.hostโœ…โ€”Redis connection host
redis.portโŒ6379
mqtt.hostโŒโ€”Omit the whole mqtt block to skip completion-stats publishing entirely
mqtt.portโŒ1883
mqtt.usernameโŒโ€”Optional MQTT auth; omit for an anonymous broker
mqtt.passwordโŒโ€”
redis_ttl_daysโŒ14TTL applied to each aircraft:registry:{icao_hex} key written by this runner

MQTT โ€‹

Published once, at the end of a run, to SkyFollower/runner/br-anac/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_br_anac_{name}/config for each of the three stats above.