Skip to content

ExxML/UBC-ProfPilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

173 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ProfPilot Icon

UBC ProfPilot

A web app that summarizes RateMyProfessor reviews with AI and indexes past instructors for any course to help students choose classes with confidence.

React TailwindCSS Node.js Docker License: GPL v3

πŸ“‘ Table of Contents

✨ Features

  • Professor Search: Search for UBC professors by name and view comprehensive ratings data
  • AI-Powered Summaries: Get AI-generated summaries of professor ratings using Gemini API
  • Course Search: Find all professors who have taught a specific course
  • Real-time Progress Updates: Live progress tracking during data scraping via Socket.IO
  • Modern UI: Responsive interface built with React and TailwindCSS
  • Department Filtering: Support for 140+ UBC departments with RateMyProfessors integration
  • Optimized Performance: Connection pooling, browser reuse, and efficient data fetching

πŸ› οΈ Tech Stack

Frontend

  • Framework: ReactJS
  • Styling: TailwindCSS
  • Bidirectional Communication: Socket.IO

Backend

  • Runtime: Node.js
  • Framework: Express.js
  • Web Scraping:
    • Playwright (Chromium browser)
    • Cheerio (HTML parsing)
  • API Integration: Gemini API (for summarizing ratings)
  • Bidirectional Communication: Socket.IO (progress updates on searches)

πŸ“ Project Structure

UBC-ProfPilot/
β”œβ”€β”€ frontend/                 # React frontend application
β”‚   β”œβ”€β”€ public/              # Static files
β”‚   β”‚   β”œβ”€β”€ ProfPilot_Icon.png
β”‚   β”‚   └── index.html
β”‚   └── src/
β”‚       β”œβ”€β”€ assets/          # Images and media files
β”‚       β”œβ”€β”€ components/      # React components
β”‚       β”‚   β”œβ”€β”€ circular-progress.js  # Progress indicator component
β”‚       β”‚   β”œβ”€β”€ course-search.js      # Course search interface
β”‚       β”‚   └── prof-search.js        # Professor search interface
β”‚       β”œβ”€β”€ app.js          # Main application component
β”‚       β”œβ”€β”€ config.js       # Configuration (university, departments, API URL)
β”‚       β”œβ”€β”€ index.css       # Global styles
β”‚       └── index.js        # Application entry point
β”‚
β”œβ”€β”€ backend/                 # Node.js backend server
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ browser.js      # Playwright browser automation
β”‚   β”‚   β”œβ”€β”€ course-data.js  # Course data scraping logic
β”‚   β”‚   β”œβ”€β”€ index.js        # Express server and Socket.IO setup
β”‚   β”‚   β”œβ”€β”€ prof-data.js    # Professor data scraping and AI summary
β”‚   β”‚   └── prof-url.js     # Professor URL lookup
β”‚   β”œβ”€β”€ Dockerfile          # Docker configuration for Playwright
β”‚   └── package.json        # Backend dependencies

πŸš€ Getting Started

Prerequisites

  • Node.js (v14 or higher recommended)
  • npm (v6 or higher)
  • Gemini API Key (required for professor rating summaries)

Backend Setup

  1. Navigate to the backend directory:
    cd backend
  2. Install dependencies (this will also install Chromium browser via Playwright):
    npm install
  3. Create a .env file in the backend directory with the following variables:
    GEMINI_API_KEY=your_gemini_api_key_here
    # FRONTEND_URL is optional for local development
    # Only set it for production deployment
    # FRONTEND_URL=https://your-frontend-url.com
  4. Start the server:
    npm start
    The server will start on http://localhost:3001

Frontend Setup

  1. Navigate to the frontend directory:
    cd frontend
  2. Install dependencies:
    npm install
  3. Create a .env file in the frontend directory with the following variable:
    # REACT_APP_BACKEND_URL is optional for local development
    # Only set it for production deployment
    # REACT_APP_BACKEND_URL=https://your-backend-url.com
  4. Start the development server:
    npm start
    The application will be available at http://localhost:3000

🐳 Docker

The backend includes a Dockerfile that uses the official Playwright image to ensure all browser dependencies are properly installed. This is required for deployment environments.

Key Docker features:

  • Based on mcr.microsoft.com/playwright:v1.52.0-jammy
  • Installs Chromium browser with all system dependencies
  • Direct Node.js execution (PID 1) for proper signal handling
  • See more in backend/Dockerfile

🏒 Deployment

Backend Deployment (Render)

  1. Platform: Render Web Service
  2. Build Environment: Select Docker (required for Playwright Chromium)
  3. Configuration:
    • Set root directory to backend
    • Add environment variables:
      • GEMINI_API_KEY - Your Gemini API key for generating professor summaries
      • FRONTEND_URL - Full URL of your deployed frontend (e.g., https://your-frontend.vercel.app)

Frontend Deployment (Vercel)

  1. Platform: Vercel (Recommended for fast cold starts and CDN distribution)
  2. Framework Preset: Select "Create React App"
  3. Configuration:
    • Set root directory to frontend
    • Add environment variable:
      • REACT_APP_BACKEND_URL - Full URL of your deployed backend (e.g., https://your-backend.onrender.com)
    • All other settings can be left as default

πŸ”§ Configuration

University Settings

University configuration can be modified in frontend/src/config.js:

export const UNIVERSITY_CONFIG = {
  name: "University of British Columbia",
  shortName: "UBC",
  number: "1413", // RateMyProfessors university ID
};

The config.js file also contains mappings for 140+ UBC departments to their RateMyProfessors department IDs. These are used for course searches.

πŸ“‘ API Endpoints

The backend provides the following REST API endpoints:

GET /professor

Search for a professor and get their ratings data.

Query Parameters:

  • fname - First name
  • lname - Last name
  • university - University number (e.g., '1413' for UBC)

Response:

{
  "URL": "https://www.ratemyprofessors.com/professor/...",
  "first_name": "John",
  "last_name": "Doe",
  "university": "University of British Columbia",
  "would_take_again": 85.5,
  "difficulty": 3.2,
  "overall_quality": 4.5,
  "ratings": [...],
  "summary": "AI-generated summary..."
}

GET /course

Find all professors who have taught a specific course.

Query Parameters:

  • course_name - Course code (e.g., 'CPSC 110')
  • department_number - Department ID from RateMyProfessors
  • university_number - University ID (e.g., '1413')

Response:

{
  "course_name": "CPSC 110",
  "professors_count": 5,
  "professors": [
    {
      "name": "John Doe",
      "first_name": "John",
      "last_name": "Doe",
      "department": "Computer Science",
      "profile_url": "https://...",
      "num_ratings": 42
    }
  ]
}

Socket.IO Events

The application uses Socket.IO for real-time communication and progress updates during searches:

Client β†’ Server Events:

  • start-professor-search - Initiates a professor search
  • skip-ratings-load - Skips loading individual ratings during professor search
  • start-course-search - Initiates a course search
  • skip-professors-load - Skips loading professor details during course search
  • stop-search - Cancels an ongoing search

Server β†’ Client Events:

  • search-progress - Progress updates during professor search
  • search-error - Error notification for professor search
  • course-search-progress - Progress updates during course search
  • course-search-error - Error notification for course search
  • course-search-complete - Course search completion
  • server_shutdown - Server shutdown notification

πŸ“Š Data Sources

All professor ratings and course information are sourced from RateMyProfessors.com. The application:

  • Scrapes data in real-time (no database required)
  • Uses Playwright for dynamic content loading
  • Generates AI summaries using Google's Gemini models

πŸ“ License

This project is licensed under the GNU General Public License v3.0.

About

A RateMyProfessors scraper-summarizer for UBC students

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages