reports: user articles that embed claims under a database seal and link each other

- /berichte lists published reports; /berichte/<slug> renders a report: Markdown subset built as React
  elements (no raw HTML), [[angabe:ID]] embeds the claim card under a seal (green 'Amtliche Daten' when a
  source is official), [text](angabe:ID|bericht:slug|person:slug|org:slug) links inline, [[bericht:slug]]
  embeds another report; a box says how many claims the text rests on; backlinks between reports.
- /berichte/verfassen (login at the proxy): own reports, editor with a picker that finds claims, reports and
  persons and inserts their codes; draft / published / withdrawn; every save kept in report_revision.
- Claim pages show the embed code, 'use in a new report' and the reports citing the claim.
- API: GET /api/v1/reports, /reports/{slug} (references resolved like permalinks, merged claims follow the
  survivor); POST/PUT for the web app with POLITRACK_AUTHOR_TOKEN on behalf of the proxy user. The web app
  trusts Remote-User only with X-Politrack-Proxy = POLITRACK_PROXY_SECRET.
- Migration 0011 (report, report_revision, report_reference, app_user.display_name); docs: data model,
  deployment (sign-in setup), design system, roadmap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
simonandClaude Opus 5.5 committed 2026-11-20 10:19:50 +01:00
1 parent f2d72fe464
commit 9f0e2fc115
32 files changed
+1974 -21

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
"""Reference syntax of user reports (the web app's ReportBody renders the same syntax)."""
from politrack.queries.reports import parse_references
BODY = """## Spenden 2017
[[angabe:123]]
Die Spende ist in [dieser Angabe](angabe:456) belegt, siehe auch [den Bericht](bericht:spenden-2017-2)
und [Pierer](person:stefan-pierer) bei der [ÖVP](org:oevp).
[[Bericht: wahlkampf-2017 ]]
[[angabe:123]] mitten im Satz ist keine Einbettung, [kaputt](angabe:abc) und [[angabe:x]] auch nicht.
[[claim:789]]
"""
def test_references_are_parsed_once_with_embedding_winning():
refs = parse_references(BODY)
assert refs == [
("claim", "123", True), ("report", "wahlkampf-2017", True), ("claim", "789", True),
("claim", "456", False), ("report", "spenden-2017-2", False), ("person", "stefan-pierer", False),
("organization", "oevp", False),
]
def test_inline_reference_to_an_embedded_claim_stays_embedded():
assert parse_references("[[angabe:5]]\n\nWie [oben](angabe:5) gezeigt") == [("claim", "5", True)]
def test_invalid_keys_are_ignored():
assert parse_references("[x](person:Hans Wurst) [y](bericht:../admin) [z](angabe:12a)") == []