How dhruvagarwal4543/car-sage-ai works
CarSage is an Indian new-car research marketplace: users browse and filter a historical-specification catalogue, inspect or compare cars, and can request explainable recommendations, grounded assistant replies, experimental price estimates, or live-price comparisons. The React site calls a FastAPI service backed by PostgreSQL; preprocessing and model training form a separate data/ML branch. The README also documents Firebase-authenticated saved cars. Some subsystem links rely on README descriptions or source-index references because their implementations were not excerpted; the Chrome extension and LLM are planned, not built.
Main entry points: app.py FastAPI routes · api.ts API client · recommend.py Recommendation ranking · catalogue.py Catalogue search and detail
Components 25
Data and ML
- Raw car data
- Data cleaning
src/preprocess.py - Processed catalogue data
- Price model training
src/train_price_model.py - Price model
- Catalogue import
carsage/import_catalogue.py
API and domain
- PostgreSQL catalogue and saved cars
carsage/models.py - FastAPI routes
carsage/app.py - Catalogue search and detail
carsage/catalogue.py - Recommendation ranking
carsage/recommend.py - Constraint search
carsage/search.py - Suitability rules
carsage/rules.py - Grounded assistant
carsage/assistant.py - Experimental estimate
carsage/predict.py - Live price comparison
carsage/prices.py - Token verification
carsage/auth.py
Website
- React website
frontend/src/App.tsx - Explore catalogue
frontend/src/pages/Explore.tsx - Details and comparison
frontend/src/pages/CarDetail.tsx - Advisor experience
frontend/src/pages/Advisor.tsx - API client
frontend/src/api.ts - Website sign-in
frontend/src/auth.tsx
Identity and providers
- Price providers
carsage/providers.py - Firebase authentication
Other components
- Car buyer
Connections 29
- Raw car data → Data cleaning: cleans and audits
- Data cleaning → Processed catalogue data: writes dataset
- Processed catalogue data → Price model training: trains from
- Price model training → Price model: produces model
- Price model → FastAPI routes: serves estimates
- Processed catalogue data → Catalogue import: loads from
- Catalogue import → PostgreSQL catalogue and saved cars: upserts cars
- Car buyer → React website: browses
- React website → API client: uses
frontend/src/App.tsx - Explore catalogue → API client: requests cars
frontend/src/pages/Explore.tsx - Details and comparison → API client: requests details
frontend/src/pages/CarDetail.tsx - Advisor experience → API client: requests advice
- API client → FastAPI routes: calls endpoints
- FastAPI routes → Catalogue search and detail: routes catalogue queries
carsage/app.py - Catalogue search and detail → PostgreSQL catalogue and saved cars: reads catalogue
carsage/app.py - FastAPI routes → Recommendation ranking: routes recommendations
carsage/app.py - Recommendation ranking → Constraint search: searches feasible cars
carsage/recommend.py - Recommendation ranking → Suitability rules: derives suitability
carsage/recommend.py - Recommendation ranking → Catalogue search and detail: uses catalogue data
carsage/recommend.py - FastAPI routes → Grounded assistant: routes questions
carsage/app.py - Grounded assistant → Recommendation ranking: gets recommendations
carsage/assistant.py - FastAPI routes → Experimental estimate: routes estimates
carsage/app.py - FastAPI routes → Live price comparison: routes price comparison
carsage/app.py - Live price comparison → Price providers: fetches quotes
carsage/prices.py - Website sign-in → Firebase authentication: signs in with
- Website sign-in → API client: provides token
frontend/src/auth.tsx - FastAPI routes → Token verification: verifies protected requests
carsage/app.py - Token verification → Firebase authentication: verifies ID tokens
- FastAPI routes → PostgreSQL catalogue and saved cars: reads and writes saved cars
carsage/app.py