Inspiration

GJU students often need an answer quickly, but the official regulations are spread across very large English and Arabic PDF files. A correct answer also needs more than a confident explanation: students should be able to see the exact regulation, article, and PDF page for themselves.

I built the GJU Student Regulations Assistant to make those documents searchable without replacing the official university sources.

What it does

A student asks a question in English or Arabic. The assistant:

  • searches the current official GJU regulations using vector, full-text, and section-aware retrieval;
  • reranks and diversifies the strongest evidence;
  • generates an answer restricted to the retrieved official text;
  • cites the document, article or section, and PDF page;
  • opens the official PDF directly at the cited page; and
  • exposes the retrieved evidence so the student can verify the result.

The live system currently indexes four documents from GJU's official Laws & Regulations page, including the 2026 English and Arabic regulation books.

How I built it

The application is a Python and Streamlit project backed by Supabase PostgreSQL and pgvector. OpenAI embeddings represent the regulation chunks, while GPT-5.6 produces evidence-grounded answers through the Responses API.

The ingestion pipeline downloads each official PDF, calculates a checksum, extracts text page by page with PyMuPDF, detects English and Arabic articles and headings, preserves short articles as logical chunks, and uses vision OCR when a page contains no extractable text. Every vector remains connected to its document, article, and PDF-page metadata.

The public application uses a read-only Supabase anonymous key. Ingestion is isolated behind a service-role key and can only run from administrative scripts or a manual GitHub Actions workflow.

Codex helped me turn the initial architecture into a working repository: scaffolding the ingestion and retrieval layers, iterating on Arabic reading-order repair and OCR, creating the Supabase schema and RLS policies, building tests, diagnosing page-link behavior, and deploying the verified app. GPT-5.6 is used in the running product for answer generation and OCR fallback.

Challenges

The largest English regulation book is hundreds of pages long, and regulation wording does not always match how a student asks a question. Arabic PDFs added another challenge because visually positioned text can be extracted in the wrong reading order. Reliable citations also required retaining PDF page boundaries throughout extraction, chunking, retrieval, and generation.

I addressed those issues with hybrid retrieval, article-aware chunking, Arabic reading-order repair, selective OCR, version-safe ingestion, metadata filters, and direct PDF page links.

Accomplishments

  • A working public bilingual assistant grounded in real official documents
  • Page- and article-aware citations with links to the exact PDF page
  • Hybrid vector, keyword, and section retrieval
  • Read-only public database access enforced with row-level security
  • Checksum-based updates and safe document version swaps
  • Automated tests and GitHub Actions
  • A lightweight deployment that does not require a GPU or local model

What I learned

For regulation assistants, retrieval quality and source traceability matter as much as answer quality. Keeping page metadata from the first extraction step made the final citations reliable. I also learned that Arabic PDF extraction needs explicit handling instead of assuming the raw text order is correct.

What's next

Next I would expand the evaluation set with verified questions from students and university staff, improve printed-page-number detection, add more GJU departments and document types, and build an administrative review dashboard for disputed or outdated answers.

Try it

Live app: https://gju-regulations-assistant.streamlit.app/

The assistant is informational. The official regulation and the responsible GJU office remain authoritative.

Built With

  • codex
  • github-actions
  • openai-embeddings
  • openai-gpt-5.6
  • pgvector
  • postgresql
  • pymupdf
  • python
  • streamlit
  • supabase
Share this project:

Updates