feat(n8n): add school paperless intake pipeline

This commit is contained in:
Fizzlepoof
2026-05-13 20:53:00 +00:00
parent 5584de38e0
commit 56026cf542
11 changed files with 895 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
# n8n Workflow Testing Status
_Last updated: 2026-05-10_
_Last updated: 2026-05-13_
---
@@ -105,3 +105,38 @@ _Last updated: 2026-05-10_
- [ ] `PAPERLESS_TRIAGE_APPLY_SAFE=false` during initial validation
**Test approach:** Upload a harmless test document to Paperless, POST `{"document_id": <id>}` to the webhook, and confirm `doris-dashboard/data/paperless_review.json` contains a sanitized review item. Use a bill/due-date fixture to verify forced human review.
---
### 18 — Telegram School Intake → Postgres → Paperless v1.0
**What it does:** Accepts multipart school-work upload plus metadata (`class_name`, `assignment_name`, `submission_kind`, optional semester/course_code/paper_kind), records it in shared Postgres, and uploads it into Paperless with a deterministic `intake_id`-based filename.
**Local artifact checks completed:**
- [x] Workflow JSON validates with `python3 -m json.tool`
- [x] Companion helper script validates with `node --check school/intake/submit_to_n8n.js`
- [x] Class profile example JSON validates with `python3 -m json.tool`
**Pre-test checklist:**
- [ ] Shared Postgres table `school_paperless_intake` created from `docs/reference/SCHOOL_INTAKE_POSTGRES_SCHEMA.sql`
- [ ] `PAPERLESS_API_TOKEN` exposed to n8n through env vars
- [ ] Postgres credential `Shared Postgres` created in n8n and wired into workflow 18
- [ ] Webhook path `https://n8n.paccoco.com/webhook/school/intake/upload` reachable from Doris/OpenClaw helper
**Test approach:** POST a small DOCX/PDF through the intake webhook, confirm a row appears in `school_paperless_intake`, and verify the document lands in Paperless with filename prefix `school-...`.
---
### 19 — Paperless School Intake Metadata Enrichment v1.0
**What it does:** Receives Paperless post-consumption webhook for intake-managed documents, resolves the deterministic `intake_id` from the stored filename, loads the intake record from Postgres, then reapplies deterministic title/tags and optional document type/correspondent mapping.
**Local artifact checks completed:**
- [x] Workflow JSON validates with `python3 -m json.tool`
**Pre-test checklist:**
- [ ] Paperless webhook configured to POST `https://n8n.paccoco.com/webhook/school/intake/paperless-enrich`
- [ ] Workflow 18 already working so intake-managed filenames exist in Paperless
- [ ] `PAPERLESS_API_TOKEN`, `PAPERLESS_TAG_SCHOOL`, `PAPERLESS_TAG_ASSIGNMENTS`, and `PAPERLESS_TAG_TELEGRAM` exposed to n8n
- [ ] Optional mapping env vars supplied when ready: `PAPERLESS_TAG_CLASS_MAP_JSON`, `PAPERLESS_TAG_SUBMISSION_KIND_MAP_JSON`, `PAPERLESS_DOCUMENT_TYPE_PAPER_KIND_MAP_JSON`, `PAPERLESS_CORRESPONDENT_CLASS_MAP_JSON`
- [ ] Postgres credential `Shared Postgres` created in n8n and wired into workflow 19
**Test approach:** After a workflow-18 upload is consumed by Paperless, POST `{"document_id": <id>}` to `/webhook/school/intake/paperless-enrich` and verify title/tags are updated and the DB row status becomes `enriched`.