student-engagement-api

Student Engagement Analytics API

Live demo / docs     Portfolio     All Projects

A RESTful API built with Flask for tracking and analyzing student engagement metrics in educational platforms. Includes a built-in analytics dashboard and OpenAPI documentation.

Features

Tech Stack

Technology Purpose
Python 3 Runtime
Flask Web framework
SQLAlchemy ORM and database
SQLite Database engine
Chart.js Dashboard visualizations
OpenAPI 3.0 API documentation

Getting Started

git clone https://github.com/Freddricklogan/student-engagement-api.git
cd student-engagement-api
pip install -r requirements.txt
python seed_data.py    # Generate sample data
python app.py          # Start server on port 5000

Open http://localhost:5000 for the dashboard.

API Endpoints

All endpoints require an X-API-Key header. Default dev key: dev-api-key-2026

Method Endpoint Description
GET /api/students List students (filterable by major, status)
GET /api/students/:id Get student by ID
POST /api/students Create a new student
GET /api/sessions List sessions (filterable by student, course)
POST /api/sessions Create a new session
GET /api/events List engagement events
POST /api/events Record an engagement event
GET /api/analytics/overview Engagement overview metrics
GET /api/analytics/sessions-by-course Session counts by course
GET /api/analytics/engagement-trend Daily engagement score trend
GET /api/analytics/top-students Top students by engagement score

Example Request

curl -H "X-API-Key: dev-api-key-2026" http://localhost:5000/api/analytics/overview
{
    "total_students": 40,
    "total_sessions": 648,
    "total_events": 2847,
    "avg_session_duration": 62.3,
    "avg_engagement_score": 0.52
}

Data Model

Student (1) ──── (N) Session (1) ──── (N) EngagementEvent

License

MIT License

Author

Freddrick Logan