Add pinned SAOS Polish court judgments snapshot

#21
by PiotrSty - opened

Summary

Adds a pinned, normalized snapshot of Polish court judgments from PiotrSty/saos-polish-court-judgments as the new saos source.

This PR does not claim to contain the complete current SAOS database. The pinned source has 296,692 rows, while the official SAOS API returned 540,726 items on 2026-09-04. That limitation is represented in the datasheet and as addressable Evidence, a falsifiable Claim, and an evidence-backed attestation.

The final build retains 296,689 documents, containing 5,897,001,250 characters and 2,265,448,504 cl100k_base tokens. Three records below 200 characters were removed; no exact normalized duplicates or language-gate failures were found. Courts: COMMON 229,370 / SUPREME 38,058 / NATIONAL_APPEAL_CHAMBER (KIO) 19,758 / CONSTITUTIONAL_TRIBUNAL 9,503 rows.

Scope cleanup (review items 1–3)

Replaced by a single clean commit on main @ 34e7ea3: only this source's files (data/saos/*, src/fetch_saos.py, src/test_saos_contract.py, the SAOS artifacts in artifacts/) plus the registry entry with release: None and a source_findings.md entry. The stale-branch drift is gone — no european_hplt_v3_pl re-add, no uzp_orzeczenia_pl / rock_pollub_pl deletions, no scrub_pii.py / scrub_entities.py, no README / CHANGELOG / VERSION / make_docs / AGENTS.md / sejm-fetcher edits.

Provenance and legal status

  • Official origin: https://www.saos.org.pl/api/dump/judgments (API docs: https://www.saos.org.pl/help/index.php/dokumentacja-api/api-pobierania-danych)
  • Pinned source: PiotrSty/saos-polish-court-judgments@736cba4f92999e29d3e49409b0713c88fc683714
  • License label: public-domain (official documents) / LicenseRef-Polish-Official-Documents
  • Legal basis documented: Polish Copyright Act art. 4(2) and the Polish Open Data Act.
  • Formal legal review: not performed — scope and responsible party below.

Legal review — what is needed and who does it (review item 5)

Needed before release, on the merged corpus as used for training:

  1. Copyright-status confirmation of the art. 4(2) exclusion as applied to full judgment texts, including third-party quoted material inside judgments (party submissions, cited reports, quoted correspondence) which may carry separate rights;
  2. Privacy/GDPR assessment of named private persons in published judgments (parties, attorneys, witnesses) for TDM reuse — including the CJEU/Polish case-law overlay on court-publication practice;
  3. Provider-side terms check (SAOS / Ministry of Justice redistribution terms).

Responsible: the corpus maintainer's legal reviewer with a Polish legal background (bar/counsel or the institution's legal team). The engineering side prepares only the evidence pack: per-record SAOS URLs + court metadata (attribution sidecar), the saos.license-evidence.json snapshot, and sample spot-checks — none of which substitutes for the opinion. Until it lands: mergeable with release: None, excluded from stable releases.

Overlap with uzp_orzeczenia_pl (review item 4)

uzp_orzeczenia_pl holds KIO / appellate / supreme procurement rulings; this snapshot is general jurisdiction, and its NATIONAL_APPEAL_CHAMBER slice (19,758 rows) is exactly the KIO family. Measured two ways:

  1. Verbatim text (normalized exact-line/paragraph containment, ≥30/≥100 chars, 64-bit blake2b, exact): 0 matches in both directions — no record appears verbatim in the other corpus (5.90B vs 1.07B chars checked; note saos records are single-line texts, so this test is whole-record verbatim matching).
  2. Case-number cross-check — the precise question: all 19,758 KIO rows carry case_numbers, and 4,536 of them (22.9% of the KIO slice; 1.5% of the whole snapshot) match a signature in uzp_orzeczenia_pl — e.g. KIO/UZP 5/08, KIO 2741/10. The same decisions are published in both corpora via different extraction paths (SAOS database vs KIO PDFs), so their texts differ verbatim but are the same rulings — a near-duplicate risk at integration.

Integration gate (concrete): drop or pairwise-collapse the 4,536 saos KIO records whose normalized case_numbers intersect uzp_orzeczenia_pl's signature (both keys sit in the attribution sidecars — a mechanical filter), or run near-dedup restricted to that subset. Method + tooling in the review thread.

Processing (original)

  • NFKC Unicode normalization, normalized spaces/quotes/dashes and preserved paragraphs.
  • Article and section numbering retained as substantive legal content.
  • Minimum 200 characters and DynaWord Polish-diacritic ratio gate.
  • Exact normalized-text deduplication.
  • Pattern scrubbing for email, PESEL candidates, labelled NIP/REGON, labelled phones, and bank accounts (14 / 253 / 60 / 66 strings replaced). Not NERGAL — a NERGAL pass is a release gate (judgments name private persons; boundary is a legal question, not a regex question).
  • Implausible dates preserved raw in the attribution sidecar and left empty in the training schema.
  • Per-record SAOS URL, court type, judgment type, case numbers and judge attribution preserved in the sidecar.

Registry

Registry entry kept with release: None (now with added: "2026-09-04"); src/sources.py diff is the entry only.

Test plan

  • python3 -m pytest src/test_saos_contract.py — passed on the clean branch
  • Text-level overlap vs uzp_orzeczenia_pl measured (above)
  • Legal-review scope + responsible party stated (above, datasheet)
  • Reviewer: scope cleanup accepted
  • Maintainer: legal review scheduled before release
Fabryka AI org

Review against AGENTS.md ("What the PR must show", "Normalize the text before you build"). Needed before merge:

  1. Rebase onto current main. Against main the diff currently shows european_hplt_v3_pl being re-added (removed from main for unverified license) and uzp_orzeczenia_pl / rock_pollub_pl being deleted. git fetch of this PR's ref currently fails on our side; a fresh push after the rebase should fix it.
  2. Drop src/scrub_pii.py / src/scrub_entities.py. In-repo scrubbers were removed in #38; PII goes through SlayerLab/NERGAL. Merge with release: None is fine meanwhile, but no release before a NERGAL pass.
  3. Keep the PR to this source. Drop edits to README / CHANGELOG / VERSION in make_docs and to shared files (AGENTS.md, the sejm fetchers, make_docs). Registry entry stays, with release: None; the release bookkeeping is done once by the maintainer after merges.
  4. Overlap. Check against uzp_orzeczenia_pl (KIO/court procurement rulings already on main).
  5. Legal review is marked as not performed — say what's needed and who does it.
Fabryka AI org

Correction to my review comment above: the git fetch failure was on the Hub side (have/ack negotiation), not a problem with this PR. It fetches fine with git -c fetch.negotiationAlgorithm=noop fetch. No re-push needed for that; the rebase ask still stands.

Fabryka AI org

Review addressed — the branch is replaced by a single clean commit on main @ 34e7ea3 (this is PiotrSty's PR, so the fix pushes straight onto refs/pr/21). Point by point:

  1. Rebased / drift gone. No european_hplt_v3_pl re-add, no uzp_orzeczenia_pl / rock_pollub_pl deletions — the diff is this source only (13 files, data/saos/* + src/fetch_saos.py + src/test_saos_contract.py + artifacts/saos_* + registry entry + findings entry). (And acknowledged on the fetch note — fetch.negotiationAlgorithm=noop works from here.)
  2. Scrubbers dropped. src/scrub_pii.py / src/scrub_entities.py were never in this PR's own commits — they appeared via the stale-branch merge; the clean commit removes them from the diff. PII story in the datasheet: the pattern pass in src/fetch_saos.py (e-mail, PESEL candidates, labelled NIP/REGON, labelled phones, bank accounts — 14/253/60/66 strings replaced in this build) and no release before a NERGAL pass (judgments name private persons — parties, attorneys, witnesses). Registry entry kept with release: None.
  3. Scoped to this source. No README / CHANGELOG / VERSION / make_docs / AGENTS.md / sejm-fetcher edits remain.
  4. Overlap with uzp_orzeczenia_pl — measured two ways. (a) Verbatim text (normalized exact-line/paragraph containment, ≥30/≥100 chars, 64-bit blake2b): 0 matches in both directions (5.90B vs 1.07B chars; saos records are single-line texts, so this is whole-record matching). (b) The precise question — the KIO family — via case numbers: all 19,758 NATIONAL_APPEAL_CHAMBER rows carry case_numbers, and 4,536 (22.9% of the KIO slice; 1.5% of the snapshot) match a signature in uzp_orzeczenia_pl (e.g. KIO/UZP 5/08, KIO 2741/10). Same decisions, two extraction paths (SAOS database vs KIO PDFs) — verbatim-distinct but semantically duplicated rulings. Concrete gate: drop or pairwise-collapse those 4,536 saos KIO records by the sidecar key join (saos case_numbers ∩ uzp signature), or near-dedup that subset at integration. Tooling in review_fix/overlap_saos_uzp.py + the case-number cross-check.
  5. Legal review — scoped with responsible party (now in the datasheet): what's needed is (i) copyright-status confirmation of art. 4(2) including third-party quoted material inside judgments, (ii) a privacy/GDPR assessment of named private persons for TDM reuse (with the CJEU/Polish case-law overlay on court-publication practice), (iii) provider-side SAOS/Ministry redistribution terms. Who: the maintainer's legal reviewer with a Polish legal background (bar/counsel or institutional legal team) — engineering can only prepare the evidence pack (per-record URLs/court metadata, saos.license-evidence.json, spot-checks), which is not a substitute. Until the opinion lands: mergeable with release: None, excluded from stable releases.

Verification: python3 -m pytest src/test_saos_contract.py — passed on the clean branch.

Cannot merge
This branch has merge conflicts in the following files:
  • artifacts/source_findings.md

Sign up or log in to comment