# RIS Mirror — Completeness Statement

This document states **what this mirror contains and what it deliberately
omits**, so that consumers can judge whether it is fit for their purpose. It is
a companion to the consumer specification in [`SPEC.md`](SPEC.md) (§6 there is
the short version; this file is the long one).

- **Source:** Austrian Rechtsinformationssystem (RIS), via the official OGD REST
  API `https://data.bka.gv.at/ris/api` (version `v2.6`).
- **Not authoritative, not legal advice.** This mirror reproduces RIS documents
  as published. The authentic texts are the *authentic* RIS applications (e.g.
  `BgblAuth`). Where the mirror and RIS disagree, RIS is correct.

---

## 1. What is included

- **Every document the OGD API returns** for each mirrored Application is
  stored, paginated to the end of the result set — metadata plus the content
  representations selected for the run (a run may restrict representations, e.g.
  XML only; each document's `metadata.json → contents[]` lists what was actually
  mirrored for it).
- **Consolidated law (`BrKons`, `LrKons`):** for every law that is **still in
  force**, the mirror keeps **all Fassungen** (time-sliced versions) of every
  paragraph — its complete version history, not only the current text.

## 2. What is omitted by design

- **Fully repealed consolidated laws.** A law with **no** in-force Fassung is not
  stored at all. Consequence: a consolidated law absent from the tree was
  repealed in its entirety. A law that is present carries its full history,
  including past (no-longer-valid) Fassungen.
- **Representations not selected for the run.** If a run mirrors a subset of
  content types, the unselected ones are absent; `metadata.json → contents[]` is
  the ground truth for what exists per document.

## 3. Boundaries inherited from the source

The mirror cannot contain more than the OGD API exposes:

- **API surface only.** Anything the OGD API at `data.bka.gv.at/ris/api` does not
  return is not here. RIS material reachable only through the human web site and
  not via the API is out of scope.
- **Source gaps pass through.** Missing or malformed metadata, absent
  representations, and RIS-side errors are reproduced as-is, not repaired.

## 4. Freshness & change model

- **The initial fill is gradual.** The first complete mirror of an Application is
  built incrementally across runs: each run resumes the bulk crawl where the last
  one stopped. **Until an Application finishes its initial crawl, its stored count
  is a lower bound that keeps growing** — not the final total. `status.json` (§5)
  flags exactly which Applications are still filling in (`state: "in-progress"`)
  versus done (`state: "complete"`).
- **Completion is verified.** The crawl pages through RIS search results sorted
  ascending by a date column, where the Application has one. Because RIS changes
  while a crawl runs for weeks, a document can move past a page boundary. So after
  the last page, the crawl walks all pages again and fetches what is missing. An
  Application becomes `complete` only after such a pass finds nothing new (at most
  3 passes).
- **Updates are incremental** via the RIS *Historyabfrage* (history query): once
  an Application's initial crawl completes, each run pulls only the delta of
  documents RIS changed since the last successful run.
- **Bytes are refreshed in place.** When RIS changes a document, its stored bytes
  are overwritten on the next run. **There is no per-document change log** in the
  tree — the mirror reflects the latest seen state, not a timeline of edits
  (consolidated-law Fassungen are the one exception: they *are* the historical
  record, and are preserved).
- **Stability.** `path` values and document directories are stable across runs
  (keyed by Dokumentnummer); the `<bucket>` shard is deterministic but opaque.
  Always follow `path` / sitemap links; never reconstruct paths.

## 5. How to verify coverage yourself

- **Live status:** [`/status.json`](status.json) (raw JSON, human view at
  [`/status.html`](status.html)) is regenerated on every reindex. It carries
  `generatedAt` (UTC), the grand totals (`documents`, `applications`, `buckets`,
  `sitemaps`), an `initial` block (`complete`, `applicationsComplete`,
  `applicationsTotal`) saying whether every stored Application has finished its
  first crawl, and a `perApplication[]` breakdown: document count, layout, the
  law/Fassung counts for consolidated law, and per-app `state`
  (`"complete"`/`"in-progress"`) with the `watermark` date of completion. Check
  `initial.complete` (or per-app `state`) **before** treating a count as final —
  while it is `false`, counts are still climbing.
- **Root counts:** `/index.json` carries `documents` (total stored, Fassungen
  counted individually) and per-Application `count`. Each Application's
  `/<App>/index.json` repeats its count; law-grouped apps also carry `lawCount`
  and per-law `paragraphCount` / `fassungCount`.
- **Full enumeration:** walk the indices or `/sitemapindex.xml` as described in
  [`SPEC.md`](SPEC.md) §5. Every stored document is reachable from both; a
  document reachable from neither is not in the mirror.
- **Cross-check against RIS:** for a given Application, compare the mirror's
  `count` with the OGD API's reported hit total for the same query. Any gap is
  either an in-flight run or an omission described in §2.

---

*This is a statement of intent and method, not a guarantee of completeness at any
instant: a mirror is, by nature, a snapshot between runs.*
