0%
balqalam Logo
balqalam
FeaturesCommunityPricingDocumentation
Login
  • 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
  • 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
Sales & GTM
  • Marketing Brief
  • Sales
  • Go-to-market
  • Marketing
  • Admission — Feature Spotlight
  • Pilot Program
  • Leads
  • Proposal
  • Outreach Templates
  • Case Study
  • Competitors
  • Landing-page teardown
  • Competitor FAQ
  • Business model
  • Shared economy
  • Traction
Fundraising & Ecosystem
  • Get Support
  • Investor Deck
  • Data Room
  • Investors
  • Accelerators
  • Incubators
  • Grants
  • Sponsors
  • Partners
  • Competitions & Hackathons
  • Universities & Training Centers

Document Intelligence

PreviousNext

Platform-wide AI document processing — admissions, exams, finance, library — with shared extraction, queue, and budget infrastructure.

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.

EpicGoalPoints
EPIC-0 — FoundationGeneralized extraction service, async processing queue, per-school budget, status UI atoms34
EPIC-1 — AdmissionClassify and extract from applicant docs, auto-merit, bank-receipt verification, bulk processing45
EPIC-2 — TextbookUpload + chapter extraction + content chunking + summaries + browse UI30
EPIC-3 — Exam GenerationTopic-based question generation, past-exam ingestion, mock-exam auto-gen, standard alignment32
EPIC-4 — Bulk Scan GradingUpload answer sheets, OCR, auto-grade, review queue, analytics22
EPIC-5 — FinancialWire invoice PDFs, bank-statement OCR, expense-receipt enhancements, financial reports20
EPIC-6 — Onboarding & ProviderApply generic extractor to onboarding, multi-provider routing, quality eval28
EPIC-7 — Library & SearchIndex CatalogMaterial / CatalogBook for semantic search, reading-level metadata, recommendations22

Architecture context

The plan extends existing infrastructure rather than replacing it.

ComponentLocationCurrent state
Document extractionsrc/lib/document-extraction/Claude 3.5 Sonnet via Vercel AI SDK generateObject() + Zod. Hardcoded to onboarding steps.
AI providerssrc/lib/ai/providers.tsMulti-provider routing (Anthropic + Groq), task-based selection, cost estimation
Rate limitersrc/lib/ai/rate-limiter.tsPriority queue, 5 concurrent, exponential backoff
AI configsrc/lib/ai/config.tsAIServiceConfig — monthlyCostLimit, fallback, confidence thresholds
AI servicessrc/lib/ai/openai.tsEssay grading, OCR, question generation guarded by isAIServiceAvailable()
Receipt OCRfinance/receipt/ai/extract-receipt-data.tsWorking pattern: generateObject() + Zod + DB status update
QBank engineqbank-automation/engine/PDF parse + LangChain chunking + embeddings (placeholder findRelevantChunks())
PDF templatessrc/components/file/generate/@react-pdf/renderer for invoice, receipt, certificate, report card, ID card, transcript

Schema facts

  • Application.documents is Json? — untyped URL array, no AI processing today.
  • Application.entranceScore, interviewScore, meritScore are manual Decimal?.
  • SourceMaterial + SourceChunk exist; findRelevantChunks() returns empty.
  • CatalogMaterial, CatalogBook have fileUrl / digitalFileUrl but no pipeline.
  • FinancialReport has status: GENERATING | COMPLETED | FAILED + fileUrl; generation stubbed.
  • Payment supports BANK_TRANSFER with receiptUrl.
  • ExpenseReceipt has a working OCR pipeline.
  • StudentAnswer has uploadUrl, ocrText, ocrConfidence, single-answer processOCRWithAI().

Patterns

Every epic follows the same conventions:

  • Server actions are "use server" with auth() + schoolId guard.
  • 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)

StoryTitlePtsType
0.1Generalize document extraction service8API
0.2DocumentProcessingJob Prisma model5DB
0.3AI budget enforcement service5API
0.4Queue runner8API
0.5Processing-status UI components5UI
0.6Document-processing settings3UI

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)

StoryTitlePts
1.1Define admission schemas and prompts5
1.2Admission processing actions8
1.3Admission review UI5
1.4Document completeness validation3
1.5Auto-compute merit scores8
1.6Bank-transfer receipt verification8
1.7Bulk processing for campaigns8

EPIC-2 — Textbook (30 pts)

StoryTitlePts
2.1Textbook upload + metadata extraction8
2.2Auto-extract chapter structure8
2.3Content chunking and embeddings5
2.4AI chapter summaries5
2.5Textbook management UI4

EPIC-3 — Exam Generation (32 pts)

StoryTitlePts
3.1Wire findRelevantChunks to question generation5
3.2Topic-based question generation UI5
3.3Past exam paper ingestion5
3.4Mock exam auto-generation8
3.5Mock exam UI + student take flow5
3.6Curriculum-standards alignment4

EPIC-4 — Bulk Scan Grading (22 pts)

StoryTitlePts
4.1Bulk answer-sheet upload + jobs5
4.2Bulk OCR processing5
4.3Auto-grade against answer keys5
4.4Review queue4
4.5Analytics and reporting3

EPIC-5 — Financial (20 pts)

StoryTitlePts
5.1Wire invoice PDF generation3
5.2Bank statement OCR + reconciliation5
5.3Expense receipt extraction enhancements4
5.4Financial report generation pipeline5
5.5Wire remaining PDF templates3

EPIC-6 — Onboarding & Provider (28 pts)

StoryTitlePts
6.1Migrate onboarding extraction to generic service4
6.2Multi-provider routing per task5
6.3Provider quality eval harness5
6.4Confidence thresholds and fallback5
6.5DEVELOPER cost dashboard4
6.6Provider failover and retry policy5

EPIC-7 — Library & Search (22 pts)

StoryTitlePts
7.1Index CatalogMaterial / CatalogBook for semantic search5
7.2Reading-level metadata extraction4
7.3Recommendation surface (UI)5
7.4Search ranking and filters4
7.5Content access analytics4

See also

  • AI Document Processing
  • Multi-tenancy
  • Architecture
AI Document ProcessingInternationalization

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

Built by Databayt ·

Welcome to balqalam.

A great journey is about to begin.