How yl1183/laformula works
Project Type and Purpose
• LaFormula is a full-stack application combined with an ETL pipeline.
File-Structure Analysis
• Top-level scripts (extract.py, transform.py, load.py, update.py, web_scrape.py, load_google_connector.py, main.py, service.py, datamodels.py, sql_side/):
• These implement the ETL/data-ingestion and utility tasks.
• laformula_backend/:
• A Django project (“laformula”) with one app (“test_app”).
• Contains models.py, serializers.py, views.py → implements MVC/REST API.
• Settings, URLs, ASGI/WGSI for deployment.
• laformula_frontend/:
• A React project (create-react-app structure) under src/, public/.
• Components/, pages/ for UI; api.js for HTTP calls to the Django backend.
• Other artifacts: manual_test.ipynb for exploratory analysis; sql_side/ for raw SQL or DDL scripts.
Key Insights from README
• Ranking “best driver” independent of car performance.
• A reference ERD link suggests a relational data model in the database.
• Screenshot hints at a homepage slider and data tables – features implemented in React.
Main Components & Their Interactions
a. Data Ingestion Layer (ETL)
• Components: web_scrape.py, load_google_connector.py
• Function: Pull raw race and driver data from external sources.
b. Transformation Layer
• Components: transform.py, datamodels.py
• Function: Clean, normalize, and map raw data into schema.
c. Loading Layer
• Components: load.py, update.py, sql_side/
• Function: Insert/update records in the relational database (as defined by Django models).
d. Database
• Likely PostgreSQL/SQLite configured in Django settings.py
• Holds tables for drivers, races, results, computed rankings.
e. Backend API (Django MVC/REST)
• laformula_backend/laformula: project settings & URL routing.
• test_app: models.py, serializers.py (data → JSON), views.py (API endpoints).
• Exposes endpoints consumed by frontend.
f. Frontend UI (React SPA)
• laformula_frontend/src: components (DriverGrid, HomepageSlider, Navbar, etc.), pages (Home, Drivers, Races, Teams).
• api.js: defines REST calls to backend.
• Renders interactive visualizations and dropdowns using fetched JSON data.
Architectural Patterns & Design Principles
• ETL pipeline pattern (Extract → Transform → Load) separated into distinct scripts.
• MVC / REST paradigm in backend: clear separation of models, serializers, and views/controllers.
• Single-page application on frontend: component-based, unidirectional data flow (props/state).
• Modularization: separate directories for scripts, backend, frontend.