Skip to content

jeremy-misola/MoodleOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MoodleOS 🎓🤖

AI-Powered Academic Operating System — Your intelligent study companion that integrates with Moodle, Notion, WakaTime, and more.

Python 3.11+ FastAPI LangGraph License


🏆 Champlain College Hackathon 2026

MoodleOS is an intelligent academic management system that helps students stay on top of their coursework, predict grade outcomes, and avoid burnout through AI-powered analysis.

🎯 Problem Statement

Students struggle to manage multiple courses, track assignment deadlines, and maintain healthy study habits. Traditional LMS platforms (like Moodle) lack predictive capabilities and personalized insights.

💡 Solution

MoodleOS creates a "Second Brain" for academic life by:

  • 📊 Predicting final grades using Monte Carlo simulations
  • 🧠 Detecting burnout risk through coding patterns (WakaTime integration)
  • 🔍 Auto-discovering study resources for assignments (Tavily API)
  • 📝 Syncing everything to Notion for beautiful visualization
  • 🔔 Sending smart alerts via Telegram

🚀 Features

Multi-Agent Architecture (LangGraph)

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│   👁 OBSERVER   │────▶│  🧠 STRATEGIST  │────▶│  ⚡ EXECUTIVE   │
│   Agent         │     │   Agent         │     │   Agent         │
├─────────────────┤     ├─────────────────┤     ├─────────────────┤
│ • Moodle Scrape │     │ • Monte Carlo   │     │ • Notion Sync   │
│ • WakaTime API  │     │ • LLM Analysis  │     │ • Telegram      │
│ • Data Gather   │     │ • Decisions     │     │ • Actions       │
└─────────────────┘     └─────────────────┘     └─────────────────┘

📊 Monte Carlo Grade Predictions

  • Simulates 10,000 possible grade outcomes per course
  • Provides 95% confidence intervals
  • Calculates pass probability
  • Risk level assessment (low/medium/high/critical)

🧠 AI-Powered Analysis

  • Uses GPT-4o for intelligent state determination
  • Three states: IN_FLOW, ON_TRACK, AT_RISK
  • Context-aware recommendations
  • Burnout risk scoring

🔌 Integrations

Integration Purpose
Moodle Course data, assignments, grades
WakaTime Coding time, focus metrics, burnout signals
OpenAI LLM reasoning, natural language
Tavily Academic resource discovery
Notion Dashboard visualization
Telegram Urgent alerts

🛠️ Tech Stack

Backend

  • Python 3.11+ — Modern async Python
  • FastAPI — High-performance API framework
  • LangGraph — Multi-agent orchestration
  • LangChain — LLM integration
  • Playwright — Browser automation (SSO scraping)
  • APScheduler — Scheduled jobs

Data & ML

  • NumPy — Monte Carlo simulations
  • Pydantic — Data validation
  • httpx — Async HTTP client

APIs & Services

  • OpenAI GPT-4o
  • WakaTime API
  • Tavily Search API
  • Notion API
  • Telegram Bot API

📦 Installation

Prerequisites

  • Python 3.11 or higher
  • Poetry or pip
  • Playwright browsers

Quick Start

# Clone the repository
git clone https://github.com/yourusername/moodleos.git
cd moodleos

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Install Playwright browsers
playwright install chromium

# Copy environment template
cp .env.example .env

# Edit .env with your API keys
nano .env

# Run the server
python main.py

Docker (Alternative)

# Build image
docker build -t moodleos .

# Run container
docker run -p 8000:8000 --env-file .env moodleos

⚙️ Configuration

Environment Variables

Create a .env file with the following variables:

# Required
OPENAI_API_KEY=sk-...

# Moodle SSO Credentials
MOODLE_BASE_URL=https://moodle.champlain.edu
MOODLE_USERNAME=your_username
MOODLE_PASSWORD=your_password

# Optional Integrations
WAKATIME_API_KEY=waka_...
TAVILY_API_KEY=tvly_...
NOTION_TOKEN=secret_...
NOTION_DATABASE_ID=...

# Telegram Alerts
TELEGRAM_BOT_TOKEN=...
TELEGRAM_CHAT_ID=...

# Scheduling
POLLING_INTERVAL_MINUTES=60
LOG_LEVEL=INFO

API Keys Setup

OpenAI

  1. Go to OpenAI API Keys
  2. Create a new API key
  3. Add to .env as OPENAI_API_KEY

WakaTime

  1. Go to WakaTime Settings
  2. Copy your API key
  3. Add to .env as WAKATIME_API_KEY

Tavily

  1. Sign up at Tavily
  2. Get your API key from the dashboard
  3. Add to .env as TAVILY_API_KEY

Notion

  1. Create a Notion integration at Notion Developers
  2. Share your database with the integration
  3. Copy the integration token and database ID

Telegram

  1. Create a bot via @BotFather
  2. Get your chat ID by messaging @userinfobot
  3. Add both to .env

🎮 Usage

API Endpoints

Once running, access the API at http://localhost:8000

Endpoint Method Description
/ GET API info
/health GET Health check
/agent/run POST Run full agent cycle
/courses GET List all courses
/assignments GET List assignments
/predictions GET Grade predictions
/burnout GET Burnout assessment
/resources/search POST Search study resources
/notion/sync POST Sync to Notion

Interactive Docs

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc

Running Agent Cycle

import httpx

async def run_moodleos():
    async with httpx.AsyncClient() as client:
        response = await client.post("http://localhost:8000/agent/run")
        print(response.json())

# Output:
# {
#   "success": true,
#   "state": "on_track",
#   "confidence": 0.75,
#   "reasoning": "Good progress in most courses...",
#   "urgent_actions": ["OVERDUE: Assignment 3 in CS270"],
#   "recommendations": ["Monitor Calculus II - Current trend needs attention"],
#   "burnout_score": 35.2,
#   "alerts_count": 2
# }

Monte Carlo Simulation

from grade_simulator import GradeSimulator
from models import Course, GradebookEntry

course = Course(
    id="123",
    name="Computer Science 101",
    gradebook=[
        GradebookEntry(item_name="Midterm", grade=85, max_grade=100, weight=25),
        GradebookEntry(item_name="Final", grade=None, max_grade=100, weight=40),
    ]
)

simulator = GradeSimulator(iterations=10000)
prediction = simulator.simulate_final_grade(course)

print(f"Predicted: {prediction.predicted_mean:.1f}%")
print(f"95% CI: {prediction.confidence_interval_95}")
print(f"Pass Probability: {prediction.pass_probability * 100:.0f}%")

📁 Project Structure

moodleos/
├── main.py              # FastAPI application & endpoints
├── agent_graph.py       # LangGraph multi-agent system
├── moodle_connector.py  # Playwright SSO scraper
├── wakatime_client.py   # WakaTime API client
├── grade_simulator.py   # Monte Carlo simulations
├── tavily_search.py     # Academic resource search
├── notion_sync.py       # Notion integration
├── models.py            # Pydantic data models
├── config.py            # Settings & configuration
├── requirements.txt     # Python dependencies
├── .env.example         # Environment template
└── README.md            # This file

🔬 Technical Highlights

Monte Carlo Simulation

The grade simulator uses NumPy to run 10,000 simulations per course:

  • Models uncertainty in future assignment grades
  • Uses normal distribution based on current performance
  • Provides statistical confidence intervals

LangGraph State Machine

workflow = StateGraph(AgentState)
workflow.add_node("observe", observer.observe)
workflow.add_node("analyze", strategist.analyze)
workflow.add_node("execute", executive.execute)

workflow.set_entry_point("observe")
workflow.add_edge("observe", "analyze")
workflow.add_edge("analyze", "execute")
workflow.add_edge("execute", END)

Playwright SSO Handling

Automatic handling of:

  • SAML SSO authentication
  • Multi-factor authentication prompts
  • Session management
  • Cookie persistence

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.


🙏 Acknowledgments

  • LangChain/LangGraph for the multi-agent framework
  • OpenAI for GPT-4o
  • Champlain College for the hackathon opportunity
  • All API providers for their generous free tiers

📧 Contact

Created with 💜 for Champlain College Hackathon 2026

Team: [Your Team Name] Members: [Team Members]


⬆ Back to Top

Made with 🚀 by students, for students

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors