Engineering case study · Cambodian STEM education
Kosoma LMS
An olympiad practice platform with a structured problem bank, contests, practice sessions, and an admin review workflow. A vision-based ingestion pipeline turns difficult Khmer PDFs into validated problems across five STEM subjects.
Next.js / TypeScript / Supabase / PostgreSQL / Python / Gemini
The problem
Turning Cambodian olympiad papers into a usable practice bank required more than displaying PDFs. The platform needed structured problems, multi-part answers, contests, and an administrative review process. Unusable Khmer text layers in source documents made conventional text extraction unsuitable for the ingestion pipeline.
Engineering decisions
- Built an end-to-end practice platform supporting multi-part answers, contests, practice sessions, and administrative review. Maintained the row-level-security-backed database through 24 ordered migrations.
- Rebuilt PDF ingestion after discovering unusable Khmer text layers. Rasterized pages at 200 dpi and used vision extraction with pydantic-validated structured output.
- Added KaTeX validation and repair, SHA-1 content deduplication, and page-level processing records so failed pages can be retried without rerunning a whole document.
- Generalized the ingestion pipeline from one subject to five STEM subjects.
- Replaced client-side aggregation of raw problem records with three PostgreSQL RPCs. Consolidated three permissive problem-access policies into a single policy while preserving public and administrative access.
The result
The platform brings practice, contests, and administrative review into one system. Its ingestion pipeline supports five STEM subjects, validates mathematical formatting, detects duplicate content, and records page-level progress so failed pages can be retried independently.