- Introduction
- Pitch
- Hogwarts
- Live Demo
- MVP
- Roadmap
- Launch Sprint
- PRD
- Get Started
- Localhost
- Architecture
- Structure
- Pattern
- Page
- Layout
- Content
- Types
- Config
- Actions
- Queries
- Authorization
- Validation
- Form
- Table
- Detail
- Card
- Util
- Hooks
- List Params
- Views
- README.md
- ISSUE.md
- Technology Stack
- Database
- File
- CDN Assets
- Entry Points
- Dashboard
- Authentication
- Credentials
- OAuth
- Flow Diagrams
- Multi-Tenancy
- Offline
- Onboarding
- Onboarding Videos
- Add Values
- Admission
- Application
- Attendance
- Compliance
- Profile
- Exams
- Exam Wizard
- Timetable
- Classrooms
- Notifications
- Conference
- LMS (Lumos)
- Finance
- Fee Management
- Invoice
- Wallet
- Salary
- Payroll
- Timesheet
- Expenses
- Budget
- Receipt
- Accounts
- Banking
- Reports
- Dashboard
- Permissions
- Messages
- Integration Flow
- Provision
- AI Document Processing
- Document Intelligence
- Internationalization
- Translation
- Translation Guide
- Icons
- Docs Factory
- Inspiration
- Listings
- Teachers
- Students
- Catalog
- Library
- Contributing
- Code of conduct
- GitHub Workflow
- Database Seeds
- Database Safety
- Test Accounts
- Playwright
- Prettier
- Block Rebound
The Document Intelligence Initiative brings AI-powered document handling to every Hogwarts module: admission docs, bank receipts, textbook ingestion, exam answer sheets, expense receipts, library content. Manual entry becomes automated extraction, classification, and validation.
For focused architecture see AI Document Processing. This page is the epic-level scope.
Scope
8 epics, 42 stories, 233 story points. Each epic depends on the foundation; domain epics ship independently of one another.
| Epic | Goal | Points |
|---|---|---|
| EPIC-0 — Foundation | Generalized extraction service, async processing queue, per-school budget, status UI atoms | 34 |
| EPIC-1 — Admission | Classify and extract from applicant docs, auto-merit, bank-receipt verification, bulk processing | 45 |
| EPIC-2 — Textbook | Upload + chapter extraction + content chunking + summaries + browse UI | 30 |
| EPIC-3 — Exam Generation | Topic-based question generation, past-exam ingestion, mock-exam auto-gen, standard alignment | 32 |
| EPIC-4 — Bulk Scan Grading | Upload answer sheets, OCR, auto-grade, review queue, analytics | 22 |
| EPIC-5 — Financial | Wire invoice PDFs, bank-statement OCR, expense-receipt enhancements, financial reports | 20 |
| EPIC-6 — Onboarding & Provider | Apply generic extractor to onboarding, multi-provider routing, quality eval | 28 |
| EPIC-7 — Library & Search | Index CatalogMaterial / CatalogBook for semantic search, reading-level metadata, recommendations | 22 |
Architecture context
The plan extends existing infrastructure rather than replacing it.
| Component | Location | Current state |
|---|---|---|
| Document extraction | src/lib/document-extraction/ | Claude 3.5 Sonnet via Vercel AI SDK generateObject() + Zod. Hardcoded to onboarding steps. |
| AI providers | src/lib/ai/providers.ts | Multi-provider routing (Anthropic + Groq), task-based selection, cost estimation |
| Rate limiter | src/lib/ai/rate-limiter.ts | Priority queue, 5 concurrent, exponential backoff |
| AI config | src/lib/ai/config.ts | AIServiceConfig — monthlyCostLimit, fallback, confidence thresholds |
| AI services | src/lib/ai/openai.ts | Essay grading, OCR, question generation guarded by isAIServiceAvailable() |
| Receipt OCR | finance/receipt/ai/extract-receipt-data.ts | Working pattern: generateObject() + Zod + DB status update |
| QBank engine | qbank-automation/engine/ | PDF parse + LangChain chunking + embeddings (placeholder findRelevantChunks()) |
| PDF templates | src/components/file/generate/ | @react-pdf/renderer for invoice, receipt, certificate, report card, ID card, transcript |
Schema facts
Application.documentsisJson?— untyped URL array, no AI processing today.Application.entranceScore,interviewScore,meritScoreare manualDecimal?.SourceMaterial+SourceChunkexist;findRelevantChunks()returns empty.CatalogMaterial,CatalogBookhavefileUrl/digitalFileUrlbut no pipeline.FinancialReporthasstatus: GENERATING | COMPLETED | FAILED+fileUrl; generation stubbed.PaymentsupportsBANK_TRANSFERwithreceiptUrl.ExpenseReceipthas a working OCR pipeline.StudentAnswerhasuploadUrl,ocrText,ocrConfidence, single-answerprocessOCRWithAI().
Patterns
Every epic follows the same conventions:
- Server actions are
"use server"withauth()+schoolIdguard. - Server components call
getTenantContext(). - Server actions return error codes, not strings.
- Queries scoped by
schoolId. - All UI text dictionary-driven (i18n).
Stories per epic
EPIC-0 — Foundation (34 pts)
| Story | Title | Pts | Type |
|---|---|---|---|
| 0.1 | Generalize document extraction service | 8 | API |
| 0.2 | DocumentProcessingJob Prisma model | 5 | DB |
| 0.3 | AI budget enforcement service | 5 | API |
| 0.4 | Queue runner | 8 | API |
| 0.5 | Processing-status UI components | 5 | UI |
| 0.6 | Document-processing settings | 3 | UI |
Refactors src/lib/document-extraction/ to accept any Zod schema + prompt at call time. Adds DocumentProcessingJob + AIUsageLog, per-school monthly caps with per-domain toggles, queue runner with retry + cost attribution. UI atoms render job state badges, progress, retry/cancel.
EPIC-1 — Admission (45 pts)
| Story | Title | Pts |
|---|---|---|
| 1.1 | Define admission schemas and prompts | 5 |
| 1.2 | Admission processing actions | 8 |
| 1.3 | Admission review UI | 5 |
| 1.4 | Document completeness validation | 3 |
| 1.5 | Auto-compute merit scores | 8 |
| 1.6 | Bank-transfer receipt verification | 8 |
| 1.7 | Bulk processing for campaigns | 8 |
EPIC-2 — Textbook (30 pts)
| Story | Title | Pts |
|---|---|---|
| 2.1 | Textbook upload + metadata extraction | 8 |
| 2.2 | Auto-extract chapter structure | 8 |
| 2.3 | Content chunking and embeddings | 5 |
| 2.4 | AI chapter summaries | 5 |
| 2.5 | Textbook management UI | 4 |
EPIC-3 — Exam Generation (32 pts)
| Story | Title | Pts |
|---|---|---|
| 3.1 | Wire findRelevantChunks to question generation | 5 |
| 3.2 | Topic-based question generation UI | 5 |
| 3.3 | Past exam paper ingestion | 5 |
| 3.4 | Mock exam auto-generation | 8 |
| 3.5 | Mock exam UI + student take flow | 5 |
| 3.6 | Curriculum-standards alignment | 4 |
EPIC-4 — Bulk Scan Grading (22 pts)
| Story | Title | Pts |
|---|---|---|
| 4.1 | Bulk answer-sheet upload + jobs | 5 |
| 4.2 | Bulk OCR processing | 5 |
| 4.3 | Auto-grade against answer keys | 5 |
| 4.4 | Review queue | 4 |
| 4.5 | Analytics and reporting | 3 |
EPIC-5 — Financial (20 pts)
| Story | Title | Pts |
|---|---|---|
| 5.1 | Wire invoice PDF generation | 3 |
| 5.2 | Bank statement OCR + reconciliation | 5 |
| 5.3 | Expense receipt extraction enhancements | 4 |
| 5.4 | Financial report generation pipeline | 5 |
| 5.5 | Wire remaining PDF templates | 3 |
EPIC-6 — Onboarding & Provider (28 pts)
| Story | Title | Pts |
|---|---|---|
| 6.1 | Migrate onboarding extraction to generic service | 4 |
| 6.2 | Multi-provider routing per task | 5 |
| 6.3 | Provider quality eval harness | 5 |
| 6.4 | Confidence thresholds and fallback | 5 |
| 6.5 | DEVELOPER cost dashboard | 4 |
| 6.6 | Provider failover and retry policy | 5 |
EPIC-7 — Library & Search (22 pts)
| Story | Title | Pts |
|---|---|---|
| 7.1 | Index CatalogMaterial / CatalogBook for semantic search | 5 |
| 7.2 | Reading-level metadata extraction | 4 |
| 7.3 | Recommendation surface (UI) | 5 |
| 7.4 | Search ranking and filters | 4 |
| 7.5 | Content access analytics | 4 |
See also
On This Page
ScopeArchitecture contextSchema factsPatternsStories per epicEPIC-0 — Foundation (34 pts)EPIC-1 — Admission (45 pts)EPIC-2 — Textbook (30 pts)EPIC-3 — Exam Generation (32 pts)EPIC-4 — Bulk Scan Grading (22 pts)EPIC-5 — Financial (20 pts)EPIC-6 — Onboarding & Provider (28 pts)EPIC-7 — Library & Search (22 pts)See also