A Retrieval-Augmented Generation (RAG) system for querying course information at Izmir University of Economics' Faculty of Engineering.
Ever had trouble navigating course catalogs, figuring out prerequisites, or comparing programs across departments? CourseCompass helps you ask natural language questions about courses and get accurate, citation-backed answers.
- Features
- How It Works
- Quick Start
- Usage
- Configuration
- Project Structure
- Evaluation
- Development
- Contributing
- Acknowledgments
| Feature | Description |
|---|---|
| π Web Scraping | Automated scraping of IUE ECTS course catalogs with rate limiting and caching |
| π Smart Chunking | Semantic text chunking that respects document structure and maintains context |
| π Vector Search | ChromaDB-powered semantic search with SBERT (free, local) or Gemini embeddings |
| π€ Grounded Generation | Gemini-powered answers that cite their sources - no hallucinations |
| π‘οΈ Hallucination Prevention | Built-in grounding verification and "trap question" detection |
| π Evaluation Suite | Comprehensive metrics including MRR, Recall@K, and grounding rate |
| π₯οΈ Streamlit GUI | Interactive web interface for queries, comparisons, and data management |
| β¨οΈ CLI | Full command-line interface for automation and scripting |
CourseCompass uses a RAG (Retrieval-Augmented Generation) pipeline to answer questions about IUE engineering courses:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User Interfaces β
β βββββββββββββββ βββββββββββββββ β
β β Streamlit β β CLI β β
β β GUI β β (Typer) β β
β ββββββββ¬βββββββ ββββββββ¬βββββββ β
βββββββββββββββββββββββββββββΌβββββββββββββββββββββββΌβββββββββββββββββββββββββββ
β β
βββββββββββββββββββββββββββββΌβββββββββββββββββββββββΌβββββββββββββββββββββββββββ
β RAG Pipeline β
β ββββββββββββ ββββββββββββ ββββββββββββ βββββββββββββββ β
β β Retrieverβ β β Prompts β β βGenerator β β β Grounding β β
β β β β Builder β β (Gemini) β β Checker β β
β ββββββ¬ββββββ ββββββββββββ ββββββββββββ βββββββββββββββ β
ββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
ββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Indexing Layer β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββββββ β
β β Vector Store β β Embeddings β β Manifest β β
β β (ChromaDB) β β SBERT/Gemini β β Manager β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β²
ββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Ingestion Pipeline β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
β β Scraper β β β Parser β β β Cleaner β β β Chunker β β
β β (ECTS) β β (HTML) β β (Text) β β(Semantic)β β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
The flow:
- Scrape β Pull course data from IUE's ECTS portal
- Parse & Clean β Extract structured information from HTML
- Chunk β Split content into semantic chunks for better retrieval
- Embed β Convert chunks to vectors using SBERT or Gemini
- Retrieve β Find relevant chunks using semantic similarity
- Generate β Create grounded answers with citations
- Python 3.11+
- Gemini API Key - Get one free at Google AI Studio (required for answer generation)
# Clone the repository
git clone https://github.com/mirzaisi/IUE_CourseCompass.git
cd IUE_CourseCompass
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install the package
pip install -e ".[dev]"
# Set up your API key
cp .env.example .env
# Edit .env and add your GEMINI_API_KEY# 1. Scrape course data (takes ~5 minutes)
coursecompass scrape
# 2. Build the search index
coursecompass index --provider sbert # Free, runs locally
# 3. Start asking questions!
coursecompass query "What are the prerequisites for SE 301?"
# Or launch the web interface
coursecompass gui# Get system info and status
coursecompass info
# Scrape all departments
coursecompass scrape
# Scrape specific department
coursecompass scrape --department se
# Build index with different embedding providers
coursecompass index --provider sbert # Free, local (default)
coursecompass index --provider gemini # Requires API key, better quality
# Ask questions
coursecompass query "What courses cover machine learning?"
coursecompass query "Compare SE and CE database courses" --department se --department ce
# Run the evaluation suite
coursecompass eval --questions data/evaluation_questions.jsonLaunch the Streamlit GUI for an interactive experience:
coursecompass gui
# Or: make appThe GUI provides:
- π¬ Natural language Q&A with source citations
- π Cross-department course comparisons
- π Retrieval statistics and confidence scores
- βοΈ Data management (scrape, index, configure)
from iue_coursecompass.rag import Retriever, Generator
from iue_coursecompass.rag.grounding import check_grounding
# Initialize components
retriever = Retriever()
generator = Generator()
# Retrieve relevant chunks
query = "What is SE 301 about?"
hits = retriever.retrieve(query, top_k=5)
# Generate a grounded answer
response = generator.generate(query, hits)
print(response.answer)
# Verify the answer is grounded in sources
grounding = check_grounding(response.answer, hits)
print(f"Grounded: {grounding.is_grounded} (score: {grounding.grounding_score:.2f})")Configuration is split between config/settings.yaml and environment variables:
# Required for answer generation
GEMINI_API_KEY=your-api-key-here
# Optional: Override defaults
EMBEDDING_PROVIDER=sbert # or "gemini"
GEMINI_MODEL=gemini-2.0-flash-exp
RETRIEVAL_TOP_K=5# Departments to scrape
departments:
- id: "se"
name: "Software Engineering"
- id: "ce"
name: "Computer Engineering"
- id: "eee"
name: "Electrical & Electronics Engineering"
- id: "ie"
name: "Industrial Engineering"
# Retrieval settings
retrieval:
top_k: 5
similarity_threshold: 0.3
# Generation settings
generation:
model_name: "gemini-2.0-flash-exp"
temperature: 0.3IUE_CourseCompass/
βββ config/
β βββ settings.yaml # Main configuration
βββ src/iue_coursecompass/
β βββ ingestion/ # Data pipeline
β β βββ scraper.py # Web scraper with caching
β β βββ parser.py # HTML β structured data
β β βββ cleaner.py # Text normalization
β β βββ chunker.py # Semantic chunking
β βββ indexing/ # Vector storage
β β βββ embeddings_sbert.py # Local SBERT embeddings
β β βββ embeddings_gemini.py # Gemini API embeddings
β β βββ vector_store.py # ChromaDB wrapper
β β βββ manifest.py # Index versioning
β βββ rag/ # RAG pipeline
β β βββ retriever.py # Semantic search
β β βββ prompts.py # Prompt engineering
β β βββ generator.py # LLM generation
β β βββ grounding.py # Citation verification
β β βββ quantitative.py # Counting queries
β βββ evaluation/ # Testing & metrics
β β βββ questions.py # Question bank
β β βββ metrics.py # MRR, Recall@K, etc.
β β βββ runner.py # Evaluation harness
β βββ app/ # Streamlit GUI
β βββ cli/ # Command-line interface
βββ tests/ # Unit & integration tests
βββ data/ # Data directory (gitignored)
βββ pyproject.toml # Package config & dependencies
βββ Makefile # Common commands
βββ README.md
The evaluation suite measures both retrieval quality and generation accuracy:
| Metric | What it Measures |
|---|---|
| MRR | Mean Reciprocal Rank - how high relevant results appear |
| Recall@K | Fraction of relevant docs found in top-K results |
| Precision@K | Fraction of top-K results that are relevant |
| Hit Rate | Queries with at least one relevant result |
| Grounding Rate | Answers properly cited from sources |
| Trap Accuracy | Correctly refusing to answer unanswerable questions |
Run the evaluation:
# Run full evaluation
coursecompass eval --questions data/evaluation_questions.json
# Output results to file
coursecompass eval --output results.json# Install with dev dependencies
pip install -e ".[dev]"
# Set up pre-commit hooks (optional)
pre-commit install# Lint code
make lint
# Format code
make format
# Type checking
make typecheck
# Run all checks
make check# Run tests
make test
# Run with coverage
make test-cov
pytest tests/ -v --cov=src/iue_coursecompass --cov-report=htmlContributions are welcome! Here's how to get started:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Test your changes (
make lint && make test) - Commit (
git commit -m 'Add amazing feature') - Push (
git push origin feature/amazing-feature) - Open a Pull Request
Please make sure your code passes linting and tests before submitting.
This project is licensed under the MIT License - see the LICENSE file for details.
- Izmir University of Economics - for the course data
- Sentence Transformers - for local embeddings
- ChromaDB - for vector storage
- Google Gemini - for LLM generation
- Streamlit - for the web interface
- Typer - for the CLI framework
Made with β for IUE Engineering students