Documents
Query, edit, and manage extracted student records after file processing.
Overview
nexa.documents is the read/write layer for everything the file processing pipeline produces. You use it after a file reaches status: "complete" — either via the file.completed webhook or by polling.
All methods are scoped to a userId — the same ID resolved by your getUser callback.
Typical flow after a file is processed:
- List the user's documents to find the completed file
- Fetch student records for that file
- Review stats — pass rates, subject breakdowns
- Let teachers correct records with update/delete
- Optionally re-run AI refinement on low-quality pages
List user documents
Fetch all documents belonging to a user:
Each entry contains:
| Field | Type | Description |
|---|---|---|
fileId | string | Use this to fetch records |
documentTitle | string | Label set during upload |
status | string | "queued" | "processing" | "complete" | "failed" |
pageCount | number | Total pages in the PDF |
recordCount | number | Student records extracted |
createdAt | string | ISO timestamp |
Get student records
Fetch paginated, sortable records for a file:
Each StudentRecord contains studentName, a subjects map of scores, total, average, and grade.
Get document statistics
Aggregated analytics for a processed file:
Update a record
Correct a student's name or subject scores:
Delete a record
Remove a record from a document (e.g. a duplicate or OCR artefact):
Advanced — LLM refinement
Re-run AI refinement on a specific page. Useful when OCR produced poor quality output on a single page without needing to reprocess the whole document.
Advanced — Confirm subject groups
After the AI analyses the document, confirm or override the detected subject column groupings:
This affects how subjects are labelled and grouped in the records table.
Advanced — Analysis jobs and chunks
Inspect the raw pipeline state for debugging:
What's next
- React Hooks —
useGetUserDocuments,useGetFileStudentRecords, and more - React Components — StudentRecordsTable — pre-built records grid with sorting and inline editing
- Webhooks — know when a file is ready to query