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 with vector, full-text, and section-aware retrieval; reranks the strongest evidence; generates an answer restricted to the retrieved official text; cites the document, article, and PDF page; and opens the official PDF at the cited page.

The live system 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 built with Python and Streamlit, backed by Supabase PostgreSQL and pgvector. OpenAI embeddings represent regulation chunks, and GPT-5.6 generates 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 articles as logical chunks, and uses vision OCR when a page has no extractable text. Every vector remains connected to its document, article, and PDF-page metadata.

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

Codex helped me turn the architecture into the 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 PDF page-link behavior, configuring GitHub Actions, and deploying the verified app. GPT-5.6 is used in the running product for answer generation and OCR fallback.

Challenges

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

I addressed these 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 official documents
  • Page- and article-aware citations linked to the exact PDF page
  • Hybrid vector, keyword, and section retrieval
  • Read-only public access enforced with row-level security
  • Checksum-based updates and safe document version swaps
  • Automated tests and GitHub Actions
  • A lightweight deployment that needs no 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 reliable citations possible. Arabic PDF extraction also needs explicit handling instead of assuming the raw text order is correct.

What's next

I would expand the verified evaluation set with 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

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

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

Built With

Share this project:

Updates