A knowledge graph-based learning platform that helps students learn Python programming concepts through an adaptive testing system.
This project uses Neo4j graph database to model relationships between Python programming concepts (topics) and creates a personalized learning path based on student performance. The system includes:
- Knowledge Graph: Topics and their prerequisite relationships stored in Neo4j
- Adaptive Testing: AI-powered question generation and evaluation
- Progress Tracking: PostgreSQL database for storing student answers and progress
- Web Interface: Flask-based API for student interaction
.
├── app.py # Main Flask application
├── main.py # Alternative entry point
├── database.py # Neo4j database operations
├── postgres_db.py # PostgreSQL database operations
├── judge.py # AI-based answer evaluation
├── seed.py # Database seeding script
├── models/
│ └── Phi-3-mini-4k-instruct-q4.gguf # Local LLM model
└── [debug/test files] # Various debugging and testing utilities
- Python 3.8+
- Neo4j Database
- PostgreSQL Database
- Required Python packages (see Installation)
-
Clone the repository
git clone <your-repo-url> cd skillgraph
-
Install dependencies
pip install -r requirements.txt
-
Download the LLM model
python download_model.py
The model file (
Phi-3-mini-4k-instruct-q4.gguf) will be downloaded to themodels/directory. -
Set up environment variables
Copy
.env.exampleto.envand update with your credentials:cp .env.example .env
Edit
.envwith your actual database credentials. -
Set up databases
- Install and start Neo4j
- Install and start PostgreSQL
- Verify connections with:
python check_db.py
-
Seed the knowledge graph
python seed.py
The application uses environment variables for configuration. See .env.example for all available options:
- Neo4j: URI, username, password
- PostgreSQL: host, database name, username, password, port
-
Start the application
python app.py
-
Access the API
- The server runs on
http://localhost:5000 - Use the provided endpoints to interact with the learning platform
- The server runs on
POST /submit- Submit student answers for evaluationGET /next-topic- Get the next recommended topic- Additional endpoints defined in
app.py
The system models Python concepts as a directed graph where:
- Nodes: Programming topics (e.g., Variables, Loops, Functions)
- Edges: REQUIRES relationships showing prerequisites
- Properties: Difficulty levels (Easy, Medium, Hard)
Run the test files to verify functionality:
python test_api.py
python test_submit.py
python test_frontend_call.pycheck_db.py- Verify database connectionsdebug_neo4j.py- Debug Neo4j queriesdiagnose.py- System diagnosticsforce_repair.py- Database repair utilities
- Never commit
.envfile to version control - Keep your database credentials secure
- The
.gitignorefile is configured to exclude sensitive files
Contributions are welcome! Please feel free to submit a Pull Request.
- Uses Phi-3-mini-4k-instruct model for AI evaluation
- Built with Flask, Neo4j, and PostgreSQL
