feat(data): update samorzad_gov_pl to upstream v0.2

#15

Update samorzad_gov_pl to de-identified upstream v0.2

Summary

This PR updates the existing samorzad_gov_pl component from the published v0.2 release of dawidmajewski/samorzad-gov-pl-articles.

The rebuilt DynaWord source contains:

  • 72,472 documents;
  • 107,130,266 characters;
  • 40,011,099 cl100k_base proxy tokens;
  • institution-level author values for all retained documents;
  • one-to-one attribution records with de-identified titles and canonical source URLs.

No other source Parquet is changed.

Source update and de-identification

The converter now pins upstream revision:

a998efea84bb0a62d94effc0b54f88b422d9898f

and verifies the release manifest SHA-256, all 10 Parquet shards, schema, row counts, unique IDs and release-wide record-text digest before conversion.

The v0.2 source release de-identifies consumer-facing text before DynaWord filtering. It uses the pinned ArkadiuszPawlak/fastpdn-ner-polish-pii model at revision 636c57fe77b0afad8f065e7c76243dc051437035, together with deterministic rules and checksum validation for contact data and structured identifiers. Removed values are represented by typed placeholders.

The upstream release audit scanned all 81,418 records for structured residuals, reran the PERSON model on an evenly spaced 1,000-record sample, validated placeholder structure and verified provenance against the pinned source manifest. Four corrupted source records were excluded before publication.

DynaWord filtering

From 81,418 upstream records, the conversion removes:

  • 6,932 documents shorter than 200 characters;
  • 34 documents below the existing Polish-language heuristic;
  • 1,980 exact-text duplicates.

The resulting source contains 72,472 documents. Retained text is an exact subset of the de-identified upstream release after trimming leading and trailing whitespace.

Release integration

This PR prepares v0.2.6 and updates:

  • the source converter, pinned release contract and contract tests;
  • the Parquet artifact, attribution sidecar and statistics;
  • the source datasheet and attribution notice;
  • README totals, version history, changelog and contributor credit;
  • complete-corpus phrase-frequency reports and plots.

New stable totals:

  • 4,327,540 documents;
  • 9,639,034,986 cl100k_base proxy tokens;
  • 19 sources.

The source count now includes the already merged wiktionary_examples artifact in the stable release totals.

Verification

  • 15 passed in the complete src/ pytest suite;
  • Ruff checks passed for the changed Python code, excluding two pre-existing repository-wide import/executable-bit rules;
  • all 72,472 retained texts match the pinned de-identified upstream records exactly;
  • all 72,472 attribution entries align one-to-one with Parquet IDs, titles and institution authors;
  • zero malformed, unknown, nested or in-word de-identification placeholders;
  • zero internal exact-text duplicates and zero exact-text overlap with the other 18 source Parquets;
  • canonical eight-column DynaWord schema, unique deterministic IDs, positive token counts and complete institution authors;
  • complete-corpus totals recomputed from all 19 source statistics and Parquets;
  • a second full conversion produced identical artifact hashes;
  • git diff --check passed and no local paths, credentials or network addresses appear in the textual diff.

Artifact SHA-256:

  • Parquet: 3a683b4220b9b70698d7c524637d9ea5c1d72630b8f92ea7a871642a719cf2c0;
  • attribution sidecar: 2def7488c34e749204842bcf21d33149738b34de2515115e3f79401f7eb271c4;
  • statistics: eb17463e79ed4ff03694f17773372311a8a576d393244b26d27486096025fd4c;
  • pinned upstream manifest: 9d349bb271033fef62a051e311115460e030740f9593bb7f3158cb1437f87639.
Fabryka AI org

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

  1. Before → after. Give counts for the current shard vs this update (docs / tokens / chars), and what changed.
  2. License — name it and link where it's stated.
  3. Sample inline. Paste 2–3 real documents into the description, one fenced block each: metadata as key: value lines, a blank line, then the text with its real line breaks, truncated with […] (format as in #24). A linked .sample.jsonl renders on the Hub as one escaped line per document and can't be reviewed at a glance.
  4. Describe the texts — genre, publishers, time span.
  5. PII. PII was done upstream with fastpdn-ner-polish-pii; AGENTS.md requires SlayerLab/NERGAL. The source can merge with release: None after another scrubber, but it won't be admitted to a release until the shard is re-run through NERGAL. State in the datasheet which scrubber ran.
  6. Rebase onto current main. git fetch of this PR's ref currently fails on our side; a fresh push after the rebase should fix 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 — delivered as a replacement PR (#46) because this PR is authored by @dawidmajewski and this account cannot push to refs/pr/15 (git: "Forbidden to push on refs/pr/15" — same author-scoped ref policy as #24/#19). One clean commit on main @ 34e7ea3, scoped to the source; merging #46 lands the fix and #15 can close as superseded (or the author can fast-forward refs/pr/15 to that commit). Point by point:

  1. Before → after counts — table in the replacement PR: docs 72,771 → 72,472 (−299); tokens 41,154,506 → 40,011,099 (−2.8%); chars 109,513,754 → 107,130,266 (−2.2%); upstream rows 81,422 → 81,418 (−4 corrupted excluded upstream); drops: short 6,624→6,932, dup 1,992→1,980, lang 35→34; publishers 247→247. What changed: upstream v0.2 (a998efea…) applies the samorzad-pii-v3 de-identification (fastpdn-ner-polish-pii + rules → typed placeholders) before DynaWord filtering — the shrink is those redactions + the 4 corrupted records + shifted dedup/length outcomes.
  2. License — CC BY-SA 4.0 for textual content, stated in the shared samorzad.gov.pl / gov.pl platform footer, quoted verbatim in the replacement PR from a live page (https://samorzad.gov.pl/web/gmina-krzyz-wielkopolski/2-miliony-dla-gminy-krzyz-wielkopolski): "Treści tekstowe publikowane w serwisie … są udostępniane na licencji typu Creative Commons: uznanie autorstwa - na tych samych warunkach 4.0 (CC BY-SA 4.0)." (AV content is BY-NC-ND and is not redistributed — text only.) Deed: https://creativecommons.org/licenses/by-sa/4.0/deed.pl; per-record license_url + canonical URLs in the sidecar.
  3. Sample inline — 2 real documents in the replacement PR (format as in #24), including one showing the v0.2 <PHONE> placeholder in situ.
  4. Texts — genre (institutional news/announcements: administrative notices, investment reports, school/culture announcements, museum notes), publishers (247 tenants — 246 local public institutions + 1 central), time span (2020-04-10 – 2026-07-31 dated records; a subset undated), register (formal institutional Polish).
  5. PII — the scrubber that ran is upstream samorzad-pii-v3 (pinned fastpdn-ner-polish-pii @636c57fe… + deterministic rules + checksum validation; typed placeholders; upstream audit over all 81,418 records + PERSON-model rerun on a 1,000-record sample). It is not SlayerLab/NERGAL: no release before a NERGAL pass; merge with release: None fine meanwhile. Stated in the datasheet.
  6. Rebase/scope — the replacement PR is one clean commit on main @ 34e7ea3; the shared-file drift is gone: no make_docs.py, pattern_frequency_report.md, or chart-PNG changes (release bookkeeping stays with the maintainer), only data/samorzad_gov_pl/*, src/clean_samorzad_gov_pl.py, src/test_samorzad_gov_pl_contract.py and the registry entry.

Verification: python3 -m pytest src/test_samorzad_gov_pl_contract.py — passed on the scoped branch.

ppuzio changed pull request status to closed

Sign up or log in to comment