Skip to main content
Document Triage Workflow (n8n)
Pattern: Batch intake — file drop → text extraction → AI entity extraction → KB cross-reference → flagged report
Skills used: ai-document-analysis, document-research-specialist, public-records-research-specialist
Workflow overview
[File Trigger / Webhook] → [Text Extraction] → [AI Entity Extraction]
→ [Entity Lookup] → [Confidence Filter] → [Output Flagged Report]
Node chain
1. File Trigger
- Type: Webhook (POST, multipart/form-data) or Local File Trigger (watched folder)
- Path:
/webhook/document-triage - Accepts: PDF, DOCX, images (PNG/JPG for scanned docs)
2. Text Extraction
- Type: HTTP Request to Apache Tika (if running) or Code node with
pdf-parse - URL:
http://tika:9998/tika(if Tika container is available) - Fallback: For images, base64-encode and send to Claude Vision API in step 3 instead.
- Output: Extracted text content per page.
3. AI Entity Extraction
- Type: HTTP Request
- Method: POST
- URL:
{{ $vars.PATRIOT_API_URL }}/chat/message - Body:
{
"message": "Extract all named entities (people, organizations, dates, monetary amounts) from the following document text. Return structured JSON with confidence scores per entity.\n\n{{ $json.extracted_text }}",
"persona": "investigator"
}
- Purpose: Use Claude to identify entities, relationships, and key facts.
- Output: JSON with entities array and relationships array per the
ai-document-analysisschema.
4. Entity Lookup (KB cross-reference)
- Type: HTTP Request (looped over extracted entities)
- Method: POST
- URL:
{{ $vars.PATRIOT_API_URL }}/investigate/entity-lookup - Body per entity:
{
"query": "{{ $json.entity_name }}",
"categories": ["accountability"],
"limit": 5
}
- Purpose: Check each extracted entity against the 336+ accountability profiles.
5. Confidence Filter
- Type: IF node
- Condition: Only pass entities with:
- Extraction confidence >= medium, AND
- At least one accountability profile match with relevance_score > 0.3
- Purpose: Reduce noise. Low-confidence extractions go to a review queue.
6. Output Flagged Report
- Type: Respond to Webhook (or write to n8n database / send notification)
- Body: Structured report with:
- Document metadata (filename, page count, extraction method)
- Flagged entities with profile matches
- Low-confidence entities for human review
- Provenance tags on all extracted data (AI-extracted, AI-inferred)
Provenance tagging
Per ITI inferred-data transparency rules, every entity in the output carries:
| Tag | Meaning |
|---|---|
AI-extracted |
Entity identified by Claude from document text |
AI-inferred |
Relationship derived by reasoning, not explicitly stated |
Human-verified |
Analyst has confirmed against source (set manually post-triage) |
When to use
- Processing FOIA document productions (10-1000+ pages)
- Triaging leaked or whistleblower documents
- Scanning financial disclosures for accountability profile matches
- Batch processing court filings for entity extraction
