Files
CatoandClaude 380a31be95 Quick check reads PDFs; a scored deadline eval set; docs truth (#183)
* feat(intake): PDF on the quick check, and a deadline eval set

- /api/extract-pdf reads a PDF's text layer on the server (unpdf, %PDF magic
  check, 10 MB, 10 pages, text capped at MAX_TEXT). Nothing stored or logged.
  Scans answer scanned_pdf; the page then offers the photo picker.
- One file input takes a PDF or photos; the text flows into the letter box and
  the existing redaction and analyze path. Messages in en, de, fr, it.
- eval/letters: 17 synthetic Swiss letters (de, fr, en) with expected
  deadlines; eval/pdf: text and image-only PDFs; `pnpm eval:deadlines` scores
  stored replies offline, or live with --url on the free chain.
- Docs: README quick-check/matter line, ROADMAP ticks, CHANGELOG 2026-12-02,
  .env.example host path.

Co-Authored-By: Claude <noreply@anthropic.com>

* feat(eval): optional private letter set, scored separately

--private <dir> / CAUSIUS_EVAL_PRIVATE_DIR (default
/opt/causius/shared/eval-private). Absent: "private set: not present,
skipped". Present: "private: N/M (x%)" and pass/fail by position only; no ids,
names, quotes or dates are printed. eval-private/ and eval/private/ ignored.

Co-Authored-By: Claude <noreply@anthropic.com>

* feat(eval): precision, recall and false-invention rate; answer key for the private set

Most letters correctly have no deadline, so each is scored true negative,
false invention, true positive, miss or wrong date. Ranges accept any date in
them. Private set reads answers.json and letters/*.txt and prints only counts,
metrics and pass/fail by position. Four more synthetic traps: open-ended
suspension risk, amount with no date, spend-cap reset, 2-3 working days.

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-03 01:55:56 +01:00

215 lines
6.2 KiB
JSON

{
"_comment": "Synthetic letters only: every name, address and number is invented. expected is the ISO deadline a careful reader derives, an inclusive [from, to] range when the letter says 'within 2-3 working days', or null when there is no legal deadline (a spend-cap or quota reset, a billing-cycle date, an open-ended risk, an amount to settle with no date). today is the reference date.",
"cases": [
{
"id": "de-zahlungsbefehl",
"lang": "de",
"today": "2026-11-12",
"expected": "2026-11-20",
"kind": "relative",
"quote": "innert 10 Tagen seit Zustellung",
"file": "de-zahlungsbefehl.txt"
},
{
"id": "de-kuendigung-wohnung",
"lang": "de",
"today": "2026-12-01",
"expected": "2027-03-31",
"kind": "absolute",
"quote": "Das Mietverhältnis endet am 31. März 2027; die Wohnung ist bis dann gereinigt zurückzugeben",
"note": "Contains an absolute move-out date AND a relative challenge period (30 days, no delivery date): the move-out date is the expected answer.",
"file": "de-kuendigung-wohnung.txt"
},
{
"id": "de-strafbefehl-busse",
"lang": "de",
"today": "2026-11-30",
"expected": "2026-12-04",
"kind": "relative",
"quote": "Einsprache innert 10 Tagen ab Zustellung",
"file": "de-strafbefehl-busse.txt"
},
{
"id": "de-mahnung-datum",
"lang": "de",
"today": "2026-12-02",
"expected": "2026-12-15",
"kind": "absolute",
"quote": "Wir erwarten Ihre Zahlung bis spätestens 15. Dezember 2026",
"file": "de-mahnung-datum.txt"
},
{
"id": "de-steuerveranlagung",
"lang": "de",
"today": "2026-11-20",
"expected": "2026-12-09",
"kind": "relative",
"quote": "innert 30 Tagen nach Eröffnung schriftlich und begründet Einsprache beim Steueramt erhoben werden",
"file": "de-steuerveranlagung.txt"
},
{
"id": "de-ahv-info-ohne-frist",
"lang": "de",
"today": "2026-12-02",
"expected": null,
"kind": "none",
"quote": "",
"note": "Informational only: no deadline. Expected: no deadline (null).",
"file": "de-ahv-info-ohne-frist.txt"
},
{
"id": "de-iv-verfuegung",
"lang": "de",
"today": "2026-11-25",
"expected": "2026-12-18",
"kind": "relative",
"quote": "innert 30 Tagen nach Zustellung der Verfügung schriftlich Einsprache bei der IV-Stelle erhoben werden",
"file": "de-iv-verfuegung.txt"
},
{
"id": "de-zahlungsfrist-rechnungsdatum",
"lang": "de",
"today": "2026-12-01",
"expected": "2026-12-24",
"kind": "relative",
"quote": "zahlbar innert 30 Tagen ab Rechnungsdatum",
"file": "de-zahlungsfrist-rechnungsdatum.txt"
},
{
"id": "de-mahnung-7-tage",
"lang": "de",
"today": "2026-11-27",
"expected": "2026-12-02",
"kind": "relative",
"quote": "binnen 7 Tagen ab Datum dieses Schreibens",
"file": "de-mahnung-7-tage.txt"
},
{
"id": "fr-commandement-de-payer",
"lang": "fr",
"today": "2026-11-18",
"expected": "2026-11-26",
"kind": "relative",
"quote": "dans les dix jours dès la notification",
"file": "fr-commandement-de-payer.txt"
},
{
"id": "fr-resiliation-bail",
"lang": "fr",
"today": "2026-12-02",
"expected": "2027-06-30",
"kind": "absolute",
"quote": "Vous devez avoir libéré les locaux au plus tard le 30 juin 2027",
"file": "fr-resiliation-bail.txt"
},
{
"id": "fr-amende",
"lang": "fr",
"today": "2026-12-05",
"expected": "2026-12-21",
"kind": "absolute",
"quote": "L'amende doit être payée au plus tard le 21 décembre 2026",
"file": "fr-amende.txt"
},
{
"id": "fr-confirmation-sans-delai",
"lang": "fr",
"today": "2026-12-02",
"expected": null,
"kind": "none",
"quote": "",
"note": "Informational only: no deadline. Expected: no deadline (null).",
"file": "fr-confirmation-sans-delai.txt"
},
{
"id": "fr-taxation",
"lang": "fr",
"today": "2026-11-15",
"expected": "2026-11-27",
"kind": "relative",
"quote": "dans les 30 jours dès la notification de la présente décision",
"file": "fr-taxation.txt"
},
{
"id": "en-debt-reminder",
"lang": "en",
"today": "2026-11-25",
"expected": "2026-12-04",
"kind": "relative",
"quote": "within 14 days of the date of this letter",
"file": "en-debt-reminder.txt"
},
{
"id": "en-fine",
"lang": "en",
"today": "2026-12-02",
"expected": "2027-01-08",
"kind": "absolute",
"quote": "The fine must be paid by 8 January 2027",
"file": "en-fine.txt"
},
{
"id": "en-landlord-notice",
"lang": "en",
"today": "2026-12-03",
"expected": "2026-12-31",
"kind": "relative",
"quote": "within 30 days of receiving this letter",
"file": "en-landlord-notice.txt"
},
{
"id": "de-sperrung-ohne-datum",
"lang": "de",
"today": "2026-12-02",
"expected": null,
"kind": "none",
"file": "de-sperrung-ohne-datum.txt"
},
{
"id": "fr-montant-sans-date",
"lang": "fr",
"today": "2026-12-02",
"expected": null,
"kind": "none",
"file": "fr-montant-sans-date.txt"
},
{
"id": "en-spend-cap-reset",
"lang": "en",
"today": "2026-12-02",
"expected": null,
"kind": "none",
"file": "en-spend-cap-reset.txt"
},
{
"id": "en-update-2-3-working-days",
"lang": "en",
"today": "2026-12-03",
"expected": [
"2026-12-07",
"2026-12-08"
],
"kind": "range",
"quote": "Please update us within 2-3 working days",
"file": "en-update-2-3-working-days.txt"
}
],
"pdfs": [
{
"file": "../pdf/de-zahlungsbefehl-text.pdf",
"layer": "text",
"letter": "de-zahlungsbefehl"
},
{
"file": "../pdf/fr-amende-text.pdf",
"layer": "text",
"letter": "fr-amende"
},
{
"file": "../pdf/de-zahlungsbefehl-scan.pdf",
"layer": "none",
"letter": "de-zahlungsbefehl"
}
]
}