A community-driven app for tracking and comparing the prices of everyday goods across cities. Built with Python, SQLite, Pandas, and Streamlit, it lets users log, visualize, and analyze item price trends, inflation, and cost-of-living differences with clear charts and full local data privacy.
Community Price Tracker
A community-driven data app for logging and analyzing the prices of everyday goods (milk, bread, eggs, fuel, etc.) over time. This project empowers local communities to track inflation, compare cities, and visualize cost-of-living trends using a fully local, privacy-friendly setup, built with Python, SQLite, Pandas, and Streamlit.
Features
Log and manage:
- Items, Stores, and Prices
- Price, date, currency, and quantity
- Multiple cities and stores
- Price trend charts for any item
- Basket cost comparison across cities
- Data persistence via SQLite
- Simple Streamlit UI for non-technical users
Tech Stack
| Component | Purpose | |------------|----------| | Python 3.10+ | Core logic and data processing | | SQLite3 | Lightweight local database | | Pandas | CSV and data analysis | | Matplotlib | Chart generation | | Streamlit | Interactive web interface | | CSV Generator | Creates realistic price datasets |Project Structure
community-price-tracker/
โ
โโโ data/
โ โโโ prices.db # SQLite database
โ โโโ generated_prices.csv # Synthetic dataset
โ
โโโ outputs/
โ โโโ trend_milk.png # Sample trend chart
โ โโโ basketbycity.png # Basket comparison chart
โ
โโโ src/
โ โโโ schema.sql # Database schema
โ โโโ db.py # SQLite helper functions
โ โโโ init_db.py # Initializes DB
โ โโโ generate_data.py # Generates synthetic CSV data
โ โโโ import_csv.py # Imports CSV โ normalized schema
โ โโโ analytics.py # Generates charts
โ โโโ streamlit_app.py # Interactive web app
โ โโโ additem.py / addstore.py / addprice.py / listdata.py
โ
โโโ README.md
Installation & Setup
Clone or download
git clone https://github.com/<your-username>/community-price-tracker.git
cd community-price-tracker
Create a virtual environment
python -m venv .venv
.venv\Scripts\activate # (Windows)
source .venv/bin/activate # (macOS/Linux)
Install dependencies
pip install -r requirements.txt
Initialize the database
python src/init_db.py
Generate and Import Data
Generate synthetic price data
python src/generate_data.py
This creates:
data/generated_prices.csv
containing 1000 random records for multiple items and cities.
Import data into SQLite
python src/importcsv.py --file data/generatedprices.csv
Automatically:
- Creates new items and stores
- Inserts prices with correct relations
Verify Your Data
List whatโs inside the database:python src/list_data.py
Expected output:
Items
| id | name | unit |
|----|--------|-------|
| 1 | Milk | liter |
| 2 | Bread | loaf |
Stores | id | name | city | |----|---------------|----------| | 1 | Market 1 | Helsinki |
Prices | item | store | city | price | date | |------|--------|----------|-------|------------| | Milk | Market 1 | Helsinki | 1.35 | 2025-10-26 |
Analytics & Charts
Generate a price trend chart
python src/analytics.py --item Milk --outdir outputs
Creates:
outputs/trend_milk.png
Compare basket cost across cities
python src/analytics.py --basket Milk Bread Eggs --outdir outputs
Creates:
outputs/basketbycity.png
Example Output:
Milk Price Trend
Basket Cost by City
Run the Streamlit App
streamlit run src/streamlit_app.py
Web Features:
- Log new items, stores, and prices
- View recent entries
- Trend charts by item
- Compare basket costs
- 100% local and privacy-friendly
Database Schema
| Table | Columns | |--------|----------| | item | id, name, category, unit | | store | id, name, city, latitude, longitude | | price | id, itemid, storeid, price, currency, quantity, date |
Indexed for faster queries on(itemid, date)and(storeid, date).
Example Use Case
Community volunteers across different cities can:- Log weekly prices for essential goods
- Visualize price inflation patterns
- Compare living costs between regions
- Share insights for economic awareness
Screenshot Gallery (Placeholders)
Trends Tab
Basket Comparison
Future Enhancements
- Export charts as PDF reports
- Geolocation map view
- Price change notifications
- ML model for price forecasting