PSC / Loksewa Quiz Platform preview
man psc-loksewa
$ man psc-loksewa

PSC / Loksewa Quiz Platform

Independent project

A Go and PostgreSQL backend with a TypeScript frontend, built around reusable questions, hierarchical topics and overlap-safe quiz allocation.

2026 · Question-bank modelling and exact-count quiz generation
GoPostgreSQLTypeScript
highlights
$ cat HIGHLIGHTS.md
  • ├─ Exact-count generation across overlapping topic pools
  • ├─ Atomic persistence of drafts, rules and questions
  • └─ Review and revalidation before publishing
README.md markdown

Problem

A Loksewa question bank needs to reuse questions across topics and target exams. Generating a quiz becomes more complicated when one question belongs to multiple requested topics: simply picking questions independently can produce duplicates or miss a valid allocation.

Data and application structure

The Go backend uses PostgreSQL for hierarchical topics, target exams, questions and model sets. Questions can be assigned to multiple topics and exams. A TypeScript frontend supports administration and review.

Selection logic is separated from HTTP handling and persistence so the allocation rules can be tested independently.

Exact counts without duplicate questions

Each selection rule requests a count from a topic pool, optionally including descendants and difficulty filters. The allocator matches requested slots to distinct question IDs, revisiting earlier assignments when pools overlap.

This avoids a greedy selection failure: a question that is the only match for one rule should not be consumed by another rule that has alternatives. Duplicate candidate IDs are removed, and a shortage is reported when the complete request cannot be satisfied.

Availability → draft → review → publish

Availability is checked before generation. The backend then saves the draft, selection rules and ordered questions in one transaction. A failed operation does not leave a partially saved model set.

Publishing revalidates the saved questions against the rules under a PostgreSQL transaction. It does not silently replace questions after review. A changed question bank can therefore require a new draft instead of publishing an inconsistent set.

Verification approach

The implementation includes allocation unit tests and PostgreSQL integration tests for model generation. Integration tests require an explicit test database and create a separate schema, keeping test fixtures isolated from application data.

Engineering lesson

Correct quiz generation is a domain-logic problem: data relationships, overlap, exact counts and review state need to agree. Database transactions protect persistence, while allocation tests check whether the selected questions satisfy the rules.

Source is not currently publicly accessible. The cover is a workflow illustration; an application screenshot is not yet included here.

Let’s talk engineering.

I’m currently open to backend-focused Software Engineer opportunities, including remote roles and relocation. Project enquiries and open-source collaborations are welcome too.

Write to me

Elsewhere