CBT Question Paper PDF → Structured JSON Pipeline
Quiztract converts Computer Based Test (CBT) question paper PDFs into structured JSON documents, with derived Markdown and HTML views.
granite-vision-4.1-4b for math transcription, figure analysis, and option OCR# 1. Install dependencies
pip install -r requirements.txt
# 2. Configure environment
cp .env.example .env
# Edit .env with your VLM settings
# 3. Run on a single PDF
python run.py --input input/QIB3_2024.pdf --exam-code QIB3
# 4. Bulk processing
python run.py --input-dir input/ --bulk
output/
└── QIB3/
├── QIB3.json # Primary structured output
├── QIB3.md # Derived Markdown view
├── QIB3.html # Derived HTML view (with KaTeX)
├── QIB3.provenance.json # Pipeline execution details
└── assets/
├── figures/ # Figure raster crops
├── math_crops/ # Math expression crops
└── option_crops/ # Image-rendered option crops
--input PATH Path to a single PDF file
--input-dir PATH Path to directory of PDFs (use with --bulk)
--bulk Process all PDFs in input-dir
--exam-code CODE Override exam code (single file mode only)
--skip-render Skip Stage 6, produce JSON only
--skip-validation Skip Stage 4 (not recommended)
--debug Save intermediate representations and page rasters
--review-only Re-render MD/HTML for flagged questions
--config PATH Path to alternate pipeline.yaml
| Stage | Module | Description |
|---|---|---|
| 1 | pipeline/ingest.py | PDF parsing with docling, page rasterization at 300 DPI |
| 2 | pipeline/classify.py | Block classification, question boundary detection |
| 3 | pipeline/extract.py | Content extraction (text/LaTeX/VLM), raster crop saving |
| 4 | pipeline/validate.py | Matrix dimension checks, answer range validation, LaTeX balance |
| 5 | pipeline/assemble.py | JSON assembly with null policy, provenance generation |
| 6 | pipeline/render.py | Markdown and HTML rendering from JSON |
All tunable parameters are in config/pipeline.yaml. Key settings:
~/.cache/huggingface~/.cache/quiztract/vlm-offloadpytest tests/ -v
pipeline/extract.pymodels/schema.pypipeline/validate.pyrenderers/See LICENSE for details.
5 commits
Python
74.0%
Jinja
26.0%
CBT Question Paper PDF → Structured JSON Pipeline
Quiztract converts Computer Based Test (CBT) question paper PDFs into structured JSON documents, with derived Markdown and HTML views.
granite-vision-4.1-4b for math transcription, figure analysis, and option OCR# 1. Install dependencies
pip install -r requirements.txt
# 2. Configure environment
cp .env.example .env
# Edit .env with your VLM settings
# 3. Run on a single PDF
python run.py --input input/QIB3_2024.pdf --exam-code QIB3
# 4. Bulk processing
python run.py --input-dir input/ --bulk
output/
└── QIB3/
├── QIB3.json # Primary structured output
├── QIB3.md # Derived Markdown view
├── QIB3.html # Derived HTML view (with KaTeX)
├── QIB3.provenance.json # Pipeline execution details
└── assets/
├── figures/ # Figure raster crops
├── math_crops/ # Math expression crops
└── option_crops/ # Image-rendered option crops
--input PATH Path to a single PDF file
--input-dir PATH Path to directory of PDFs (use with --bulk)
--bulk Process all PDFs in input-dir
--exam-code CODE Override exam code (single file mode only)
--skip-render Skip Stage 6, produce JSON only
--skip-validation Skip Stage 4 (not recommended)
--debug Save intermediate representations and page rasters
--review-only Re-render MD/HTML for flagged questions
--config PATH Path to alternate pipeline.yaml
| Stage | Module | Description |
|---|---|---|
| 1 | pipeline/ingest.py | PDF parsing with docling, page rasterization at 300 DPI |
| 2 | pipeline/classify.py | Block classification, question boundary detection |
| 3 | pipeline/extract.py | Content extraction (text/LaTeX/VLM), raster crop saving |
| 4 | pipeline/validate.py | Matrix dimension checks, answer range validation, LaTeX balance |
| 5 | pipeline/assemble.py | JSON assembly with null policy, provenance generation |
| 6 | pipeline/render.py | Markdown and HTML rendering from JSON |
All tunable parameters are in config/pipeline.yaml. Key settings:
~/.cache/huggingface~/.cache/quiztract/vlm-offloadpytest tests/ -v
pipeline/extract.pymodels/schema.pypipeline/validate.pyrenderers/See LICENSE for details.
5 commits
Python
74.0%
Jinja
26.0%