How 1tony0/cps510 works
Project Type and Purpose
• This is a full-stack Ride & Pickup DBMS web application.
• It consists of a React (Vite) frontend, a Python Flask backend, and an Oracle relational database.
• The goal is to provide a UI for CRUD operations on Customers, Drivers, Vehicles, Locations, Rides, Payments, and Ratings, plus reporting.
File Structure Analysis
• Top-level directories:
• backend/ – Flask app (app.py, config.py, db.py), SQL scripts (init_db.sql), seeding (seed_data.py), requirements.
• frontend/ – Vite‐powered React app (index.html, src/, package.json, vite.config.js).
• Other artifacts: test_e2e.py for end-to-end tests.
• Configuration and environment management via .env and .env.example.
• Clear separation: backend handles API and data logic; frontend handles user interface and API calls.
Main Components
a. Frontend Layer
– React Components (CustomerList, RideForm, Reports, etc.)
– Axios service (frontend/src/services/api.js)
– Vite dev server / static hosting
b. Backend Layer
– Flask application (app.py) with RESTful routes under /api
– Business logic & query functions in db.py
– Configuration via config.py and python-dotenv
– CORS middleware
c. Database Layer
– Oracle Database instance with 7 BCNF tables (Customer, Driver, Vehicle, Location, Ride, Payment, Rating)
– Connection via cx_Oracle and connection pooling
d. Test & Dev Tools (optional)
– test_e2e.py interacting with REST API
– Virtual environment (venv) and npm environment
Relationships and Data Flows
• Frontend → Backend: HTTP/REST JSON calls (GET/POST/PUT/DELETE) on endpoints like /api/customers, /api/rides, /api/reports/*
• Backend → Database: SQL queries via cx_Oracle connector, returning result sets or executing DML
• Backend Configuration: Reads DB credentials and pool settings from .env
• Seed Data: seed_data.py or init_db.sql populates tables before runtime
• Dev Servers: Frontend on port 5173; Backend on port 5000
Architectural Patterns & Design Principles
• Three-Tier Architecture (Presentation, Application, Data)
• Layered separation:
• UI Layer: React components + client‐side routing
• Service Layer: Axios API wrapper
• API Layer: Flask routes + controllers
• Data Access Layer: db.py functions + SQL scripts
• Component-based design on frontend for maintainability
• RESTful API with consistent JSON envelope (success/data/message)
• BCNF database normalization to enforce data integrity
Essential Details to Capture
• Three-tier separation and communication protocols
• The role of environment config (.env) in connecting to DB
• The seed process and database initialization scripts
• The test script’s position in the overall flow
• The fact that the frontend and backend are independent services in development