# PoWA data dictionary

Files in a PoWA release (`release/powa-<version>/`, built by `powa_build_release()`). Every place is keyed by
its **PoWcode** (`docs/powcodes.md`), a permanent identifier such as `NZ-CAN-4M7QXK`.

Conventions:

- Years are integers (CE).
- Coordinates are WGS84 / EPSG:4326 decimal degrees.
- Empty cells mean *not known*, never zero or false.
- Controlled values are listed under each field.

## pow-places.csv — one row per place

| Field | Type | Description |
|---|---|---|
| `powcode` | text | Permanent identifier: `{country}-{region}-{5 random}{check}`. A place with no ISO region has `ZZZ`. |
| `name` | text | Preferred name: the name most source records use (on a tie, the latest). |
| `denomination` | text | Most common known denomination across the records. See *Denominations*. |
| `status` | text | `active`, `closed`, `demolished`, `converted`, `relocated` or `unknown`. Taken from evidence only (see *Status*). |
| `status_year` | integer | Year of the status event, or of the listing showing the place active. |
| `first_attested`, `last_attested` | integer | Earliest and latest year of the sources that record the place. |
| `locality`, `district` | text | Locality and territorial authority as given by the sources, after normalisation. |
| `region` | text | ISO 3166-2 region containing the location point (e.g. `NZ-CAN`). |
| `latitude`, `longitude` | number | Location point. Empty when no location is known. |
| `location_precision` | text | How close the point is: `building` (about 50 m), `address`, `intersection`, `street`, `locality`, `none`. |
| `location_method` | text | Where the point came from. See *Location methods*. |
| `location_needs_review` | boolean | The location has an open review flag. |
| `names` | text | Every recorded name with its year span, e.g. `St Mark's (1966-1996); St Mark's Anglican Church (2019)`. |
| `denominations` | text | Every recorded denomination with its year span. |
| `events` | text | Dated history: `year type` pairs (construction, opening, consecration, rebuilding, relocation, conversion, closure, demolition). |
| `status_basis` | text | The evidence for `status`: a listing, a dated claim from a source, or web research with its URL. |
| `sources` | integer | Number of distinct sources recording the place. |
| `records` | integer | Number of source records linked to the place. |
| `conflicts` | text | Disagreements between sources (e.g. two construction years), as `topic: detail`. |
| `website` | text | The place's official website (or its parish's page about it), if one was found and checked. See *Links*. |
| `wikipedia` | text | Wikipedia article about the place. |
| `openstreetmap` | text | OpenStreetMap feature for the place. |
| `wikidata` | text | Wikidata item for the place. |
| `heritage_listing` | text | Heritage New Zealand List entry. |
| `summary` | text | 2–4 sentence summary. See *Summaries*. |
| `summary_source` | text | `model` (written by a language model from the facts above) or `template` (single-record places). |

## pow-places.jsonl — one JSON object per line

The full profile of each place, nested. It holds the fields above, plus:

- **`names`, `denominations`, `site_types`, `addresses`:** arrays of `{value, first_year, last_year, records}`.
- **`attested`:** `{first_year, last_year, years[], records, undated_records}`.
- **`events`:** array of `{type, year, value, source, source_year}`. `value` is the short wording of the
  claim. For web events, `source` is `Web: <site>` and the URL is given.
- **`status`:** `{value, year, basis[]}`.
- **`location`:** `{latitude, longitude, precision, method, confidence, needs_review}`.
- **`sources`:** array of `{title, year, records}`.
- **`records`:** array of `{source, cite, year, name, address}`, one per source record as printed in the
  source. `cite` is the APA in-text citation of its source, e.g. `Hamilton & Hamilton, 2008`.
- **`references`:** the place's reference list in APA 7th edition: array of `{kind, short, apa, apa_html}`
  plus `key` and `title` for printed sources (`kind` `source`) or `url` for web pages (`web`) and the
  OpenStreetMap feature the location came from (`osm`). Sorted alphabetically.
- **`links`:** array of `{kind, url, label}`; `kind` is `website`, `wikipedia`, `osm`, `wikidata` or `heritage`.
- **`conflicts`:** array of `{topic, detail}`.

Internal database identifiers and verbatim source excerpts are not included.

## pow-places.geojson

A FeatureCollection with a Point feature for every place that has coordinates. Its properties are the
`pow-places.csv` fields except `latitude` and `longitude`.

## sources.csv — the sources

| Field | Description |
|---|---|
| `key` | Source package (as in `sources/references.yml`). |
| `title` | Source title as catalogued in the database. |
| `year` | Year of the source, from its date, or else from its title or package name. |
| `kind` | `listing` (directory or phonebook) or `book` (history, guide or survey). |
| `reference` | APA 7th edition reference. |
| `in_text` | APA in-text citation. |
| `record_url` | Library catalogue record, where known. |
| `isbn` | ISBN or ISSN, where known. |
| `note` | Notes on the copy used (e.g. extracts only, unidentified volume). |
| `places` | Number of places with a record from this source. |
| `records` | Number of place records extracted from it and linked in this release. |

## references.json

What the website's Sources page shows: `printed` (each printed source with its reference as HTML),
`web` (websites cited, with the number of pages and places), `web_pages`, `links` (places with each kind
of link) and `datasets` (the reference datasets, with APA references).

## powcode-aliases.csv — codes that point elsewhere

Codes are never deleted or reused (`docs/powcodes.md`). This file lists codes that are not a place's
current code:

- `alias`: the place was merged into another, or its region was corrected. `current_powcode` is the
  place's code now.
- `retired`: the place was removed.

## Links

Links are matched to places from OpenStreetMap tags, Wikidata (by distance and name), the earlier web
research (Heritage New Zealand List entries) and a web search for official websites of active places.
Only links accepted by a rule or a reviewer, and still reachable when last checked, are released. See
docs/references.md.

## Controlled values

**Status** (`docs/profiles.md`). A place is never called closed only because it stops appearing in sources.

- `active`: listed in a directory or phonebook from 2018 on, or reported active by web research.
- `closed`, `demolished`, `converted`, `relocated`: a source or web research says so. The latest dated
  event wins.
- `unknown`: no evidence either way.

**Location methods** (`docs/geocoding.md`)

- `record_geocode`: an address, intersection, street or locality in the source records, matched to LINZ
  addresses or the NZ Gazetteer. It may be corroborated by an OpenStreetMap building.
- `llm_candidate`: a language model chose one of the offered candidates (an OSM place of worship, a LINZ
  street, a locality) using the records.
- `llm_estimate`: a model estimate, checked to lie within 15 km of the stated locality.
- `web_research`: an address from web research, matched to LINZ and accepted by a reviewer.
- `none`: not located.

**Denominations**: anglican, catholic, presbyterian, methodist, baptist, salvation_army, lutheran,
brethren, pentecostal, assemblies_of_god, seventh_day_adventist, latter_day_saints, jehovahs_witnesses,
congregational, church_of_christ, orthodox, ratana, ringatu, quaker, unitarian, christian_science,
other_christian, jewish, muslim, hindu, sikh, buddhist, bahai, other_religion, non_denominational, unknown.

**Site types**: worship_building, shared_venue_worship, institutional_chapel, marae_or_meeting_house,
office_or_administration, residence, community_service, cemetery_or_churchyard_only, other_or_unclear.

## How the data were made

Source pages were transcribed and records extracted by language models (a local model and Gemini via
OpenRouter), then normalised and linked across sources. Linkage decisions were partly reviewed. Locations
come from LINZ addresses, the NZ Gazetteer, OpenStreetMap and model inference. Web research added statuses,
dates and addresses, and the conflicting findings were reviewed before being applied. Summaries are
model-written from the facts only.

Errors remain. Fields marked for review, `conflicts`, and `location_precision` show where to be careful.
