Skip to content

Latest commit

 

History

62 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

ConsilAI

An AI-powered classroom management platform that helps teachers profile students, optimize seating layouts, and generate evidence-backed learning plans — all from one interface.

ConsilAI pairs a Next.js teacher dashboard with a multi-stage AI pipeline: deterministic keyword extraction, automated web research scraping, and LLM-generated intervention plans grounded in real sources. Built as a monorepo with Supabase for auth, persistence, and row-level security.


At a Glance (Resume Metrics)

Metric Value
Total source lines of code 5,663 across 51 source files
Languages TypeScript, JavaScript/JSX, Python, SQL, CSS
Git commits 61
Contributors 4 developers
Active development period 27 days (Nov 14 – Dec 11, 2025)
Monorepo packages 4 (frontend, backend, ai, scraper)
Frontend pages & routes 10 (9 UI pages + 1 API route)
React components 14 reusable components
Database tables 6 PostgreSQL tables
SQL migrations 4 (530 lines of SQL)
Row-Level Security policies 12 policies across all tables
Stored procedures (RPC) 2 (create_student_occurrence, create_class_occurrence)
SPED issue categories recognized 12 (dyslexia, ADHD, anxiety, ESL/ELL, etc.)
Phrase patterns for keyword extraction 100+ deterministic symptom/teacher-note patterns
Research sources scraped per plan Up to 5 web pages per student query
Plan duration 2–3 weeks with 3–6 teacher action steps per segment
Seating algorithm dimensions 4 (academic, behavior, social, support needs)
Grades supported K–12 (13 grade levels)
Student avatar options 16 emoji presets
Production dependencies 11 npm packages + 3 Python packages
Git branches 3 feature branches (classroom-grid, google-oauth, main)

What It Does

1. Student Profile Management

  • Full CRUD for student profiles with issues, strengths, goals, behavioral notes, and avatar
  • Grade-level filtering and search across K–12
  • Per-teacher data isolation via Supabase RLS and JWT-scoped queries
  • Real-time student list updates via Supabase Realtime subscriptions

2. AI Plan Generator

  • 3-stage pipeline: keyword extraction → web research scraping → LLM plan synthesis
  • Recognizes 12 special-education issue categories with 100+ deterministic phrase patterns (e.g., "easily distracted" → ADHD, "trouble decoding words" → dyslexia)
  • Scrapes up to 5 research sources per student using Bing search + Playwright headless browser
  • Generates structured 2–3 week intervention plans with weekly segments, teacher actions, student expectations, and progress check-ins
  • Cites research sources with URLs in every generated plan
  • Plans persist to Supabase with milestones, date ranges, and custom prompts

3. Classroom Seating Simulation

  • Drag-and-drop seating grid with dynamic row/column resizing
  • RBSB (Radius-Based Score Balancing) algorithm — a custom 305-line seating optimizer:
    • Composite scoring across 4 dimensions (academic 50%, behavior 30%, social 20%, support needs −40%)
    • Snake-pattern initial placement sorted by composite score
    • Iterative neighbor-swap balancing (up to 5 iterations) to minimize local/global imbalance
  • One-click auto-sort, CSV export, analytics panel, and local persistence

4. Authentication & Security

  • Google OAuth via Supabase Auth
  • Protected routes on all 9 authenticated pages
  • 12 Row-Level Security policies ensuring teachers only access their own classrooms, students, plans, and occurrences
  • Teacher-scoped database view (teacher_students) for secure frontend queries

Architecture

consilai/                          # Monorepo root
├── apps/
│   ├── frontend/                  # Next.js 14 + React 18 + Tailwind CSS
│   │   ├── app/                   # 9 pages + 1 API route (App Router)
│   │   ├── components/            # 14 reusable UI components
│   │   └── lib/                   # Auth, Supabase client, seating algo, contexts
│   └── backend/
│       ├── src/services/          # RBSB seating algorithm (TypeScript)
│       └── supabase/migrations/   # 4 SQL migrations (530 LOC)
└── packages/
    ├── ai/                        # TypeScript AI pipeline (1,023 LOC)
    │   ├── keywordExtractor.ts    # 12 SPED categories, 100+ patterns (337 LOC)
    │   ├── researchFetcher.ts     # Spawns Python scraper subprocess
    │   ├── planGenerator.ts       # Azure Phi LLM integration
    │   └── prompts/               # Structured JSON plan prompts
    └── scraper/                   # Python research scraper (118 LOC)
        └── scrapers/scraper.py    # Bing + Playwright + BeautifulSoup

AI Pipeline Flow

Teacher selects student
        │
        ▼
┌─────────────────────┐
│ Keyword Extractor   │  12 issue categories, 100+ phrase patterns
│ (TypeScript)        │  Deterministic — no LLM needed
└─────────┬───────────┘
          │ search query (up to 8 terms)
          ▼
┌─────────────────────┐
│ Web Scraper         │  Bing search → 5 URLs → Playwright render
│ (Python)            │  BeautifulSoup text extraction
└─────────┬───────────┘
          │ ResearchSnippet[] with abstracts + summaries
          ▼
┌─────────────────────┐
│ Plan Generator      │  Azure Phi-3 LLM (temp 0.4)
│ (TypeScript)        │  Structured JSON: goals, segments, actions
└─────────┬───────────┘
          │
          ▼
   Plan + cited sources → Supabase

Database Schema

Table Purpose Key Fields
classrooms Teacher-managed classrooms name, description
students Student profiles name, grade, issues[], strengths[], goals[], seat position
plans AI-generated learning plans title, objectives, milestones[], date range
student_occurrences Per-student AI interactions prompt, ai_result (JSONB)
class_occurrences Class-wide AI interactions prompt, ai_result (JSONB)
student_occurrence_students M2M join table occurrence ↔ student links
teacher_students (view) RLS-scoped student query All student fields for current teacher

Tech Stack

Layer Technology Version
Frontend framework Next.js (App Router) 14.x
UI library React 18.x
Styling Tailwind CSS (dark/light mode) 3.3
Icons Lucide React 0.263
Auth Supabase Auth + Google OAuth
Database Supabase (PostgreSQL)
AI / LLM Azure Phi-3
Research scraping Python (Playwright, BeautifulSoup, Requests)
AI pipeline TypeScript 5.4
Realtime Supabase Realtime (Postgres changes)

Codebase Breakdown

Area Files Lines of Code % of Total
Frontend (JSX pages) 10 ~1,991 35%
Frontend (components) 14 ~1,100 19%
Frontend (lib/utils) 8 ~901 16%
AI package (TypeScript) 10 ~1,023 18%
SQL migrations 4 ~530 9%
Python scraper 1 ~118 2%
CSS 1 ~60 1%
Total 51 5,663 100%

Largest Modules

File Lines Description
app/classroom/page.jsx 670 Seating simulation with drag-and-drop, auto-sort, CSV export
app/plans/page.jsx 406 AI plan generator UI with Supabase persistence
migrations/0001_*.sql 401 Core schema, RLS policies, RPC functions
keywordExtractor.ts 337 12-category SPED keyword extraction engine
rbsbSeating.ts 305 Radius-Based Score Balancing seating algorithm
PlanResultCard.jsx 230 Plan display with milestones and source citations
StudentForm.jsx 193 Student profile form with validation
Navbar.jsx 179 Navigation with auth state and theme toggle

Key Features by the Numbers

  • 10 application routes (home, login, auth callback, students list/create/detail/edit, classroom, plans, API)
  • 14 reusable React components (Button, Desk, DeskGrid, StudentCard, PlanResultCard, etc.)
  • 3 React context providers (Auth, Theme, Toast)
  • 12 RLS policies protecting 6 database tables
  • 2 Supabase RPC stored procedures for occurrence tracking
  • 12 SPED/SEL issue categories with deterministic keyword expansion
  • 100+ phrase patterns for symptom and teacher-note matching
  • 5 web research sources scraped per plan generation
  • 4 composite score dimensions in the seating algorithm
  • 5 max balancing iterations in RBSB auto-sort
  • 3–6 teacher action steps per plan segment
  • 2–3 week plan duration windows
  • 16 emoji avatar options for student profiles
  • 13 K–12 grade levels supported in filtering
  • 2 export formats (CSV for seating charts and plans)
  • 2 theme modes (light and dark)

Getting Started

Prerequisites

  • Node.js 18+
  • Python 3.10+ with virtual environment
  • Supabase project (URL + anon key)
  • Azure Phi-3 deployment (endpoint, deployment name, API key)
  • Google OAuth credentials (for Supabase Auth)

Environment Variables

Create apps/frontend/.env.local:

NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
AZURE_PHI_ENDPOINT=your_azure_phi_endpoint
AZURE_PHI_DEPLOYMENT=your_deployment_name
AZURE_PHI_API_KEY=your_api_key

Install & Run

# Frontend
cd apps/frontend
npm install
npm run dev          # http://localhost:3000

# AI package (TypeScript compilation)
cd packages/ai
npm install
npm run build

# Python scraper
cd packages/scraper
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

# Database migrations
# Apply SQL files in apps/backend/supabase/migrations/ via Supabase CLI or dashboard

Database Setup

Run migrations in order against your Supabase project:

  1. 0001_classrooms_students_occurrences.sql — Core schema, RLS, RPC functions
  2. 0002_students_profile_fields.sql — Student profile extensions (issues, strengths, goals)
  3. 0003_plans.sql — AI plan persistence table
  4. 0004_teacher_students_view_refresh.sql — View refresh for new columns

Project Structure

consilai/
├── apps/
│   ├── frontend/          # Next.js 14 teacher dashboard (~3,992 LOC)
│   └── backend/           # Supabase migrations + seating service (~835 LOC)
├── packages/
│   ├── ai/                # TypeScript AI pipeline (~1,023 LOC)
│   └── scraper/           # Python web research scraper (~118 LOC)
├── apps/database_schema.txt
└── README.md

Team & Development

Contributor Commits
pho-muncher 30
manalaishabeer@gmail.com 13
Christian Chamberland 11
Tona 7
  • 61 total commits over 27 days of active development
  • 3 feature branches: classroom-grid, google-oauth, main
  • Built collaboratively as a full-stack EdTech prototype

Resume Talking Points

"Built ConsilAI, a full-stack EdTech platform (~5,700 LOC) helping teachers generate AI-powered, research-backed learning plans for students with special needs."

  • Architected a 4-package monorepo (Next.js frontend, Supabase backend, TypeScript AI pipeline, Python scraper) with 61 commits across 4 contributors in 27 days
  • Designed a 3-stage AI pipeline: deterministic keyword extraction across 12 SPED categories and 100+ phrase patterns, automated web research scraping (5 sources/plan), and Azure Phi-3 LLM plan synthesis
  • Implemented 12 Row-Level Security policies on 6 PostgreSQL tables with Google OAuth, ensuring complete per-teacher data isolation
  • Built a custom RBSB seating algorithm (305 LOC) using composite scoring across 4 behavioral dimensions, snake-pattern placement, and iterative neighbor-swap balancing
  • Delivered 14 React components across 10 routes with dark/light theming, drag-and-drop classroom simulation, real-time Supabase subscriptions, and CSV export
  • Integrated Playwright headless browser scraping with BeautifulSoup text extraction, orchestrated from Node.js via subprocess spawning

License

Private project — all rights reserved.

About

patriothacks 2025 winner

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages