{
  "title": "OpenStreetMap relation and Wikidata links for the communes and wilayas",
  "source": "OpenStreetMap administrative relations (admin_level=8 for communes, admin_level=4 for wilayas) and their tags, via Overpass",
  "endpoint": "https://overpass-api.de/api/interpreter",
  "capture": "research/_commune-centres/osm-2026-09-29/admin-relations.json",
  "linkage": "research/_commune-centres/osm-seat-reference.json",
  "generator": "scripts/add-osm-links.mjs",
  "generated": "2026-09-29",
  "timestamp_osm_base": "2026-09-29T12:54:47Z",
  "licence": "ODbL 1.0, (c) OpenStreetMap contributors",
  "license": "ODbL-1.0",
  "provenance_notes": [
    "The license is the SPDX expression \"ODbL-1.0\" although the package declares \"SEE LICENSE IN LICENSE\": every value this file describes, `osm_relation_id` and the `wikidata` item, is an OpenStreetMap relation id or that relation's own `wikidata` tag, so this part alone is wholly ODbL 1.0, (c) OpenStreetMap contributors, as LICENSE states."
  ],
  "attribution": "https://www.openstreetmap.org/copyright",
  "tiers": "Two. The first tier is the 2026-09-29 commune-centre capture, whose Overpass query asks for boundary=administrative AND admin_level=8. The second tier is the three communes that query could not see: OpenStreetMap holds their relations with the right ref:ONS code but non-standard tags, so they are fetched by id into research/_osm-links/relations.json and listed under second_tier below with the tag defect that hid each one.",
  "join": "First tier: the linkage scripts/audit-commune-centres.mjs decided, a commune relation joined on its ref:ONS tag, then on a pre-2019-reform ONS code resolved inside the mother wilaya's carved-out communes, then on six reviewed per-relation pins. Five of those pins are spelling gaps: the relation carries the documented pre-reform ONS code and this dataset spells the name differently. The sixth, commune 4401 Ain-Defla, is the one record in the dataset whose relation carries no ONS code at all; it was pinned on the relation's name together with being the single w44 relation still unclaimed once every other w44 commune had been joined on its code, and its admin_centre node falling inside wilaya 44. Second tier: an ONS-code match on a relation the first capture's tag filter excluded. A wilaya relation is joined on its ref tag. Every record but 4401 is linked on an ONS code carried by the relation itself; 4401 is linked by name confirmed by elimination, and no record is linked by a name alone.",
  "wikidata": "The Q item is the relation's own wikidata tag, read as published and never looked up or guessed. A relation with no wikidata tag leaves the field null. There is one exclusion, listed under wikidata_excluded below: where the second-source guard proved a relation's tag names a different place, the field is null rather than carrying an item that answers the wrong place. Nothing is ever substituted, only refused.",
  "carriers": [
    "data/communes_w1_w23.json",
    "data/communes_w24_w48.json",
    "data/communes_w49_w69.json",
    "data/wilayas.json",
    "data/algeria.json"
  ],
  "second_tier_capture": "research/_osm-links/relations.json",
  "second_tier_timestamp_osm_base": "2026-10-02T10:16:05Z",
  "total_communes": 1541,
  "total_wilayas": 69,
  "coverage": {
    "communes_with_relation": 1540,
    "communes_with_wikidata": 1538,
    "wilayas_with_relation": 69,
    "wilayas_with_wikidata": 69
  },
  "second_tier": [
    {
      "code_commune": 630,
      "wilaya_code": 6,
      "name_fr": "Souk Oufella",
      "name_ar": "سوق اوفلا",
      "osm_relation_id": 4069543,
      "wikidata": "Q3087355",
      "osm_name": "Souk Oufella",
      "tag_defect": [
        "no boundary tag"
      ],
      "reason": "the relation carries ref:ONS 630 but no boundary tag, so the 2026-09-29 capture's boundary=administrative + admin_level=8 filter excluded it; fetched by id and linked on the ONS-code match. The tagging is an OpenStreetMap defect owed upstream, not a reason to leave the record unlinked"
    },
    {
      "code_commune": 1634,
      "wilaya_code": 16,
      "name_fr": "Bir Touta",
      "name_ar": "بئر توتة",
      "osm_relation_id": 540555,
      "wikidata": "Q4917124",
      "osm_name": "Birtouta",
      "tag_defect": [
        "no boundary tag",
        "no admin_level tag"
      ],
      "reason": "the relation carries ref:ONS 1634 but no boundary tag and no admin_level tag, so the 2026-09-29 capture's boundary=administrative + admin_level=8 filter excluded it; fetched by id and linked on the ONS-code match. The tagging is an OpenStreetMap defect owed upstream, not a reason to leave the record unlinked"
    },
    {
      "code_commune": 2110,
      "wilaya_code": 21,
      "name_fr": "Collo",
      "name_ar": "القل",
      "osm_relation_id": 6407308,
      "wikidata": "Q2983525",
      "osm_name": "Collo",
      "tag_defect": [
        "admin_level=11"
      ],
      "reason": "the relation carries ref:ONS 2110 but admin_level=11, so the 2026-09-29 capture's boundary=administrative + admin_level=8 filter excluded it; fetched by id and linked on the ONS-code match. The tagging is an OpenStreetMap defect owed upstream, not a reason to leave the record unlinked"
    }
  ],
  "communes_without_relation": [
    {
      "code_commune": 4703,
      "wilaya_code": 47,
      "name_fr": "Dhayet Bendhahoua",
      "name_ar": "ضاية بن ضحوة",
      "reason": "no relation carrying ref:ONS 4703 is a commune: the only one is the Dayet Ben Dahoua daira, relation 6823963 at admin_level=6, which is a different place and covers more than this commune. Both fields stay null rather than linking a daira to a commune"
    }
  ],
  "communes_without_wikidata": [
    {
      "code_commune": 4401,
      "wilaya_code": 44,
      "name_fr": "Ain-Defla",
      "osm_relation_id": 21037899,
      "reason": "the relation carries no wikidata tag"
    }
  ],
  "wikidata_excluded": [
    {
      "code_commune": 3424,
      "wilaya_code": 34,
      "name_fr": "Tefreg",
      "name_ar": "تفرق",
      "osm_relation_id": 4421860,
      "excluded_item": "Q3517130",
      "correct_item": "Q7674990",
      "found_by": "test/osm-wikidata-second-source.test.mjs, the Wikidata P31 check",
      "decided": "Owner, 2026-10-02",
      "reason": "the relation's wikidata tag names Achabou (Q3517130), a village inside this commune, not the commune: Wikidata types it as a village and describes it as being in Tafreg commune. The commune's own item is Q7674990, a commune of Algeria. An OpenStreetMap edit is owed on the relation; until it lands the field is null, because publishing the village item would answer a different place, and substituting Q7674990 would be resolving an item ourselves, which this dataset does not do"
    }
  ]
}
