How ashwinssj/cardataset works
1. Overall shape
- This repository is a two-tier telemetry analytics system: a Flask/Python backend for ingesting and classifying OBD-II CSV data, and a React/Vite frontend for interactive visualization and behavior monitoring.
- The primary runtime boundary is HTTP between frontend and backend; the backend owns data processing, persistence, and ML inference.
2. Frontend subsystem
- frontend/ is a single-page app built with React 18 + Vite.
- The UI appears centered around src/App.jsx and a chart component src/components/TimeChart.jsx, suggesting one main dashboard view with time-based analytics and snapshot metrics.
- Styling is handled with local CSS files (App.css, index.css) and the README indicates a dark/glassmorphism presentation layer.
3. Frontend responsibilities
- The frontend is responsible for uploading CSV telemetry, displaying classification results, and rendering time-series charts and summary ratios.
- It does not appear to own business logic for prediction; it is a presentation and interaction layer consuming backend responses.
4. Backend entrypoint and API layer
- backend/main.py is the likely Flask application entrypoint and API hub.
- The backend is described as using Flask-CORS, so the API is designed to be called directly from the browser-based frontend without cross-origin friction.
- This layer is the main integration point for file upload, telemetry analysis, and returning dashboard-ready JSON.
5. Data processing and normalization
- backend/preprocess_data.py indicates a distinct preprocessing stage for cleaning and normalizing uploaded CSVs before they are analyzed or stored.
- The README calls out timestamp resolution logic, including a fallback that anchors data to the current day when timestamps are missing, which suggests preprocessing is responsible for converting raw CSV rows into a time-aware session model.
6. Machine learning inference path
- The backend integrates pre-trained scikit-learn Random Forest models for two classification tasks: driving behavior and car health.
- The model artifacts are referenced in the README as rf_behavior_model.pkl and rf_health_model.pkl, implying inference happens server-side after preprocessing and before results are returned to the UI.
7. Persistence and session history
- The README mentions SQLite3 storage with automated schema initialization, so the backend likely persists uploads, analysis results, or session metadata locally.
- This creates a second data path beyond live inference: processed telemetry can be stored for date-wise filtering and historical analysis in the dashboard.
8. Visualization model
- The frontend charting is based on Recharts and focuses on time-anchored telemetry trends.
- The architecture therefore transforms raw OBD-II rows into a structure suitable for timeline visualization, with the backend controlling the timestamp semantics and the frontend only rendering the resulting series.
9. Offline data assets and exploratory analysis
- The repository includes many labeled CSV files such as idle*.csv, drive*.csv, live*.csv, long*.csv, and ufpe*.csv, which look like collected telemetry datasets used for experimentation, validation, or model development.
- car_obd_analysis.ipynb reinforces that part of the repo serves as an offline analytics/training workspace, separate from the production app path.
10. Testing and validation
- backend/test_up.py suggests a lightweight backend validation or upload test script, likely used to exercise the ingestion/inference flow outside the browser.
- This points to a development workflow where CSV datasets are used to validate preprocessing, prediction, and database writes independently of the frontend.
11. Dependency and runtime boundaries
- Backend dependencies center on Flask, Flask-CORS, Pandas, scikit-learn, joblib, and SQLite; frontend dependencies center on React, Vite, and Recharts.
- The system is therefore a local-first analytics application: Python handles compute and storage, while the browser handles interactivity and visualization.
12. High-level data flow
- The main flow is: CSV upload → backend preprocessing → ML classification + time resolution → optional SQLite persistence → JSON response → frontend charts and summary UI.
- The key architectural seam is the backend response contract: the UI depends on the server to return already-classified, time-structured telemetry rather than raw CSV rows.
Main entry points: App.jsx Dashboard · main.py API server · preprocess_data.py Preprocess data · car_obd_analysis.ipynb Analysis notebook
Components 13
Frontend
React/Vite dashboard and visualization layer
- App shell · Bootstraps the dashboard and overall client-side UI
frontend/src/main.jsx - Dashboard · Primary telemetry upload and results screen
frontend/src/App.jsx - Time chart · Renders time-series telemetry and summary trends
frontend/src/components/TimeChart.jsx - UI styles · Local styling for the dashboard and page chrome
frontend/src/App.css
Backend
Flask API, preprocessing, inference, and persistence
- API server · Hosts the HTTP API used by the browser app
backend/main.py - Preprocess data · Cleans uploads and resolves telemetry timestamps
backend/preprocess_data.py - Classify telemetry · Runs behavior and car-health prediction from uploaded data
- Behavior model · Pretrained random forest for driving behavior
- Health model · Pretrained random forest for car health
- Session store · Stores analysis history and processed upload metadata
- Upload test · Exercises ingestion and prediction flow outside the UI
backend/test_up.py
Data Assets
CSV datasets and offline analysis materials
- Telemetry CSVs · Collected OBD-II data used for analysis and validation
- Analysis notebook · Exploratory analysis and model development workspace
car_obd_analysis.ipynb
Connections 16
- App shell → Dashboard: renders · Client entry mounts the main dashboard view
- Dashboard → Time chart: uses · Dashboard delegates telemetry plotting to the chart component
- Dashboard → UI styles: styled by · Dashboard presentation is controlled by local CSS
- Dashboard → API server: API calls · Uploads and dashboard requests go over HTTP
- API server → Preprocess data: normalizes · Incoming CSV payloads are cleaned before analysis
- API server → Classify telemetry: invokes · API orchestrates classification after preprocessing
- Classify telemetry → Behavior model: loads · Behavior predictions use the pretrained model artifact
- Classify telemetry → Health model: loads · Health predictions use the pretrained model artifact
- Preprocess data → Session store: persists · Processed sessions and history are written to local storage
- Classify telemetry → Session store: records · Prediction results may be saved for later filtering and review
- API server → Dashboard: returns JSON · Server responds with classified, time-structured telemetry
- Telemetry CSVs → Upload test: feeds · Sample CSVs are used to validate the upload path
- Telemetry CSVs → Analysis notebook: analyzed in · Offline datasets support experimentation and model work
- Analysis notebook → Behavior model: trains · Notebook likely contributes to the behavior classifier
- Analysis notebook → Health model: trains · Notebook likely contributes to the health classifier
- Preprocess data → Time chart: structures data · Timestamp resolution and normalization prepare series for visualization