How wyngs/batak-sort works
Project Type and Purpose
• BearSmart is a full-stack course-planning web application (“BearSmart”) built by Team Bataksort.
• It provides course data browsing/search, calendar scheduling, advisor chat functionality, and resources.
• Key indicators:
– “frontend” directory contains a React+Vite UI + Python “backend.py” service + chat history.
– “backend” directory with package.json suggests a Node/Express API.
– “constants” directory of JSON/CSV files holds static course data.
– “scapping” script ingests and transforms external course data.
File Structure
• Top-Level:
– constants/ (static JSON/CSV course datasets)
– backend/ (Node.js API server)
– frontend/ (React UI + Python chat service)
– scapping/ (Python scraper for populating constants/)
• Patterns & Roles:
– Data Ingestion: scapping/scrapping.py → constants/
– Data Store: file-based JSON/CSV in constants/ (no DB engine)
– Micro-services: Node API (business logic) + Python Chat micro-service
– Client: React + Tailwind + Vite in frontend/src
• Config & Deployment Files:
– backend/package.json, frontend/package.json & package-lock.json
– python venv & requirements.txt in frontend
– Vite & ESLint & Tailwind configs in frontend
README for Additional Insights
• Two parallel servers:
– Python “backend.py” (likely Flask/FastAPI chat endpoint)
– Node “backend” (npm run dev for API)
• Commands hint at ports each service listens on (e.g., default 3000 for Vite, 8000 for Python, 5000 for Node).
• No external DB—uses static JSON, but may later swap in a database.
Main Components
a. Data Ingestion Service (Scraper)
– scapping/scrapping.py
– Fetches & normalizes course data from UAlberta, writes to constants/*.json
b. Static Data Store (“constants” folder)
– Fall24FinalSchedule.json, Gpa.csv, cmput_courses.json, etc.
c. API Layer 1: Node.js Backend (/backend)
– Exposes REST endpoints for: course search, calendar events, resource lookup
– Reads from constants/*, returns JSON
d. API Layer 2: Python Chat Service (frontend/backend.py)
– Serves an advisor chatbot using chat_history.json (and possibly external AI API)
– Exposes chat endpoints consumed by the React app
e. Client UI: React + Vite (frontend/src)
– Pages: Home, Search, Calendar, Resource, Advisor
– Calls both Node Backend & Python Chat Service
f. External Services (optional)
– OpenAI or other AI API (if Python service uses external LLM)
Relationships & Interactions
– Scraper → constants (file write)
– Node API → constants (file read)
– Python Chat Service → chat_history.json (read/write) → external LLM (optional)
– React Frontend → Node API (course data, calendar)
– React Frontend → Python Chat Service (advisor chat)
– Browser (User) ↔ React Frontend
Architectural Patterns & Principles
• Separation of Concerns: UI, business logic (Node), domain-specific micro-service (Python chat), data ingestion, static store.
• Micro-service style: two independent backends (Node + Python).
• File-based “database” for rapid prototyping, pluggable for real DB later.
• Standard 3-tier web architecture with an extra micro-service.