# AI use cases for PAKGOV RAG Project (salikhussain71-code/PAKGOV-RAG-project)

Repo: [salikhussain71-code/PAKGOV-RAG-project](https://github.com/salikhussain71-code/PAKGOV-RAG-project) | Use cases: 3 | Page: https://dedupedai.com/use-cases/salikhussain71-code-pakgov-rag-project/

A research project that answers questions about the Constitution of Pakistan in English, Urdu, or both, using hybrid retrieval and citation-grounded answers, with a published retrieval evaluation.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Ask Constitution questions and get cited answers: https://dedupedai.com/use-cases/salikhussain71-code-pakgov-rag-project/ask-constitution-questions-with-citations/
- Check the retrieval benchmark numbers yourself: https://dedupedai.com/use-cases/salikhussain71-code-pakgov-rag-project/reproduce-retrieval-benchmark-results/
- Build a search index for Senate rules and acts: https://dedupedai.com/use-cases/salikhussain71-code-pakgov-rag-project/index-senate-rules-for-search/

## How to ask Constitution questions and get cited answers with PAKGOV RAG Project

Repo: [salikhussain71-code/PAKGOV-RAG-project](https://github.com/salikhussain71-code/PAKGOV-RAG-project) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Run the local demo and ask questions in English or Urdu, getting answers that cite the source page.

**Who it is for:** A law student or policy researcher who needs a quick, page-cited answer about a Constitution of Pakistan article, in English or Urdu.

**The problem:** Finding the right article and page in a long constitutional text takes time, and a general chatbot may invent an answer without a source.

**The outcome:** A running local web demo where each answer shows its status, its language, the answer text, and a [Source: Constitution.pdf p.X] citation, or says insufficient evidence.

### Steps

1. Clone https://github.com/salikhussain71-code/PAKGOV-RAG-project and open the project folder.
2. Run `pip install streamlit sentence-transformers faiss-cpu rank_bm25`.
3. Run `python -m streamlit run app/demo/app.py --server.port 8501`.
4. Open http://localhost:8501 in a browser.
5. Ask `What is Right to Information?`, then `Article 19A`, then `آرٹیکل 19 اے کیا ہے؟` and check each result's citation.

### Prompt to paste into your agent

```text
Clone the repo salikhussain71-code/PAKGOV-RAG-project, install its demo requirements, and start app/demo/app.py on port 8501. Ask the demo the question <question in English or Urdu> and report the answer, its status, and its [Source: Constitution.pdf p.X] citation. Verify that the cited page actually contains the answer text before reporting it.
```

### Caveat

The README reports that 13 of 50 evaluation questions missed at R@5, so some questions will return insufficient evidence even when the Constitution covers them.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/salikhussain71-code-pakgov-rag-project/ask-constitution-questions-with-citations/

## How to check the retrieval benchmark numbers yourself with PAKGOV RAG Project

Repo: [salikhussain71-code/PAKGOV-RAG-project](https://github.com/salikhussain71-code/PAKGOV-RAG-project) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Regenerate the results table from committed evaluation files and compare BM25, dense, and hybrid retrieval.

**Who it is for:** A researcher or reviewer who needs to verify the R@1, R@5, and MRR figures before citing them in a paper or report.

**The problem:** Benchmark numbers are only useful if they can be checked, and comparing retrievers on different question sets gives misleading rankings.

**The outcome:** A regenerated FINAL_RESULTS.md table, with the metrics checked against the committed raw outputs in data/interim/ and evaluation/retrieval/.

### Steps

1. Clone https://github.com/salikhussain71-code/PAKGOV-RAG-project and open the project folder.
2. Install the Python packages the evaluation script imports, such as `pip install streamlit sentence-transformers faiss-cpu rank_bm25`, if the script fails with a missing module. (inferred, check the README)
3. Run `python app/eval/final_table.py`.
4. Open evaluation/retrieval/FINAL_RESULTS.md and compare it with hybrid_rrf_metrics_50.json and dense_metrics_50.json.
5. Read evaluation/retrieval/failure_analysis_50.md and note the questions where the gold source was not in the top 5.

### Prompt to paste into your agent

```text
Clone salikhussain71-code/PAKGOV-RAG-project, run python app/eval/final_table.py, and write the regenerated results to evaluation/retrieval/FINAL_RESULTS.md. Report the R@5 and MRR values for BM25, Dense, and Hybrid RRF (k=60). Verify that the values match the committed metrics JSON files in evaluation/retrieval/ and flag any difference.
```

### Caveat

The README warns that the 50-question set is small, so a 10-point gap at R@5 equals 5 questions and the ranking should be treated as indicative.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/salikhussain71-code-pakgov-rag-project/reproduce-retrieval-benchmark-results/

## How to build a search index for Senate rules and acts with PAKGOV RAG Project

Repo: [salikhussain71-code/PAKGOV-RAG-project](https://github.com/salikhussain71-code/PAKGOV-RAG-project) | Difficulty: Advanced | Time: 1 hour | Basis: From the README

Extract, chunk, and embed a folder of Senate PDFs into a FAISS index using the repo's pipeline commands.

**Who it is for:** A developer or legislative researcher who wants to search Senate rules, salary acts, or secretariat acts with the same pipeline used for the Constitution.

**The problem:** Senate rules and acts are spread across many PDFs, and some are scanned images with no extractable text, so keyword search alone misses content.

**The outcome:** A chunked JSONL file and a FAISS index with one vector per chunk, built from the Senate PDFs in data/raw/senate, ready for the retrieval pipeline.

### Steps

1. Place the Senate PDFs in data/raw/senate/ inside the cloned repository.
2. Run `python ingestion/extract.py --input data/raw/senate --output data/interim/senate_raw.jsonl`.
3. Run `python ingestion/chunking/chunk_documents.py --input data/interim/senate_raw.jsonl --output data/processed/senate_chunks.jsonl`.
4. Run `python retrieval/embed.py --input data/processed/senate_chunks.jsonl --output data/processed/senate_faiss`.
5. Check the log for the line `Saved FAISS index with <N> vectors` and compare N with the chunk count. (inferred, check the README)

### Prompt to paste into your agent

```text
In the cloned salikhussain71-code/PAKGOV-RAG-project repo, place the PDFs from <folder of Senate PDFs> in data/raw/senate/ and run the extract, chunk, and embed commands from the README in order. Report the number of chunks saved and the number of FAISS vectors saved. Verify that scanned PDFs that produced placeholder text are listed, since OCR is pending for them.
```

### Caveat

The README's Senate run produced 1080 chunks, but two scanned PDFs yielded only placeholder text because OCR via Tesseract is still pending, so those documents are not searchable yet.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/salikhussain71-code-pakgov-rag-project/index-senate-rules-for-search/
