# chandrika-sudo/pricetruth architecture

> Architecture diagram of the GitHub repository chandrika-sudo/pricetruth, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chandrika-sudo/pricetruth
- Repository: https://github.com/chandrika-sudo/pricetruth

## Overview

This repository is a product-price intelligence analysis project: it cleans a Flipkart catalog, simulates price history, derives discount-integrity and deal-trust metrics, and presents results through a Streamlit dashboard and analysis scripts. The main workflow runs from raw catalog data through cleaned and scored datasets to interactive exploration. Separate branches provide category/business summaries, score validation, and a sample price-history chart. Some scripts and SQL files were not excerpted, so their internal behavior and connections are not inferred.

Main entry points: [`data/processed/catalog_with_trust_score.csv`](https://github.com/chandrika-sudo/pricetruth/blob/main/data/processed/catalog_with_trust_score.csv) (Scored Catalog), [`src/generate_price_history.py`](https://github.com/chandrika-sudo/pricetruth/blob/main/src/generate_price_history.py) (History and Scoring), [`src/price_history_analysis.py`](https://github.com/chandrika-sudo/pricetruth/blob/main/src/price_history_analysis.py) (History Chart Analysis), [`src/business_analysis2.py`](https://github.com/chandrika-sudo/pricetruth/blob/main/src/business_analysis2.py) (SQL Analysis Runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prep["Catalog Preparation"]
  node_raw[("Raw Catalog")]
  node_cleaner["Catalog Cleaning<br/>[clean_data.py]"]
  node_clean_catalog[("Clean Catalog<br/>[catalog_clean.csv]")]
end

subgraph group_scoring["Price Integrity"]
  node_simulator["History and Scoring"]
  node_price_history[("Simulated History")]
  node_scored_catalog[("Scored Catalog")]
end

subgraph group_explore["Insights and Exploration"]
  node_dashboard["Price Dashboard<br/>[dashboard.py]"]
  node_history_analysis["History Chart Analysis"]
  node_sample_chart["Sample History Chart"]
end

subgraph group_analysis["Business Analysis"]
  node_baseline["Baseline Analysis"]
  node_business_one["Category Summary"]
  node_business_runner["SQL Analysis Runner"]
  node_category_sql["Category Analysis Query"]
  node_discount_sql["Discount Integrity Query"]
  node_business_three["Business Analysis"]
  node_validator["Trust Score Validation"]
end

node_analyst(("Analyst"))

node_analyst -.->|"runs preparation"| node_cleaner
node_cleaner -->|"reads"| node_raw
node_cleaner -->|"writes"| node_clean_catalog
node_simulator -->|"reads"| node_clean_catalog
node_simulator -->|"writes"| node_price_history
node_simulator -->|"writes"| node_scored_catalog
node_analyst -->|"explores"| node_dashboard
node_dashboard -->|"loads"| node_scored_catalog
node_dashboard -->|"loads"| node_price_history
node_history_analysis -->|"loads"| node_scored_catalog
node_history_analysis -->|"loads"| node_price_history
node_history_analysis -->|"writes"| node_sample_chart
node_business_one -->|"queries"| node_scored_catalog
node_business_runner -->|"executes"| node_category_sql
node_business_runner -->|"executes"| node_discount_sql
node_business_runner -->|"queries"| node_scored_catalog
node_validator -->|"validates"| node_scored_catalog

click node_raw "https://github.com/chandrika-sudo/pricetruth/blob/main/data/raw/flipkart_com-ecommerce_sample.csv"
click node_cleaner "https://github.com/chandrika-sudo/pricetruth/blob/main/src/clean_data.py"
click node_clean_catalog "https://github.com/chandrika-sudo/pricetruth/blob/main/data/processed/catalog_clean.csv"
click node_simulator "https://github.com/chandrika-sudo/pricetruth/blob/main/src/generate_price_history.py"
click node_price_history "https://github.com/chandrika-sudo/pricetruth/blob/main/data/processed/price_history.parquet"
click node_scored_catalog "https://github.com/chandrika-sudo/pricetruth/blob/main/data/processed/catalog_with_trust_score.csv"
click node_dashboard "https://github.com/chandrika-sudo/pricetruth/blob/main/src/dashboard.py"
click node_history_analysis "https://github.com/chandrika-sudo/pricetruth/blob/main/src/price_history_analysis.py"
click node_sample_chart "https://github.com/chandrika-sudo/pricetruth/blob/main/data/processed/sample_price_history.html"
click node_baseline "https://github.com/chandrika-sudo/pricetruth/blob/main/src/baseline_analysis.py"
click node_business_one "https://github.com/chandrika-sudo/pricetruth/blob/main/src/business_analysis1.py"
click node_business_runner "https://github.com/chandrika-sudo/pricetruth/blob/main/src/business_analysis2.py"
click node_category_sql "https://github.com/chandrika-sudo/pricetruth/blob/main/sql/category_analysis.sql"
click node_discount_sql "https://github.com/chandrika-sudo/pricetruth/blob/main/sql/discount_integrity.sql"
click node_business_three "https://github.com/chandrika-sudo/pricetruth/blob/main/src/business_analysis3.py"
click node_validator "https://github.com/chandrika-sudo/pricetruth/blob/main/src/validate_trust_score.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_raw,node_cleaner,node_clean_catalog toneBlue
class node_simulator,node_price_history,node_scored_catalog toneAmber
class node_dashboard,node_history_analysis,node_sample_chart toneMint
class node_baseline,node_business_one,node_business_runner,node_category_sql,node_discount_sql,node_business_three,node_validator toneRose
class node_analyst toneIndigo
```

## Components

### Catalog Preparation

- [Raw Catalog](https://github.com/chandrika-sudo/pricetruth/blob/main/data/raw/flipkart_com-ecommerce_sample.csv): `data/raw/flipkart_com-ecommerce_sample.csv`
- [Catalog Cleaning](https://github.com/chandrika-sudo/pricetruth/blob/main/src/clean_data.py): `src/clean_data.py`
- [Clean Catalog](https://github.com/chandrika-sudo/pricetruth/blob/main/data/processed/catalog_clean.csv): `data/processed/catalog_clean.csv`

### Price Integrity

- [History and Scoring](https://github.com/chandrika-sudo/pricetruth/blob/main/src/generate_price_history.py): `src/generate_price_history.py`
- [Simulated History](https://github.com/chandrika-sudo/pricetruth/blob/main/data/processed/price_history.parquet): `data/processed/price_history.parquet`
- [Scored Catalog](https://github.com/chandrika-sudo/pricetruth/blob/main/data/processed/catalog_with_trust_score.csv): `data/processed/catalog_with_trust_score.csv`

### Insights and Exploration

- [Price Dashboard](https://github.com/chandrika-sudo/pricetruth/blob/main/src/dashboard.py): `src/dashboard.py`
- [History Chart Analysis](https://github.com/chandrika-sudo/pricetruth/blob/main/src/price_history_analysis.py): `src/price_history_analysis.py`
- [Sample History Chart](https://github.com/chandrika-sudo/pricetruth/blob/main/data/processed/sample_price_history.html): `data/processed/sample_price_history.html`

### Business Analysis

- [Baseline Analysis](https://github.com/chandrika-sudo/pricetruth/blob/main/src/baseline_analysis.py): `src/baseline_analysis.py`
- [Category Summary](https://github.com/chandrika-sudo/pricetruth/blob/main/src/business_analysis1.py): `src/business_analysis1.py`
- [SQL Analysis Runner](https://github.com/chandrika-sudo/pricetruth/blob/main/src/business_analysis2.py): `src/business_analysis2.py`
- [Category Analysis Query](https://github.com/chandrika-sudo/pricetruth/blob/main/sql/category_analysis.sql): `sql/category_analysis.sql`
- [Discount Integrity Query](https://github.com/chandrika-sudo/pricetruth/blob/main/sql/discount_integrity.sql): `sql/discount_integrity.sql`
- [Business Analysis](https://github.com/chandrika-sudo/pricetruth/blob/main/src/business_analysis3.py): `src/business_analysis3.py`
- [Trust Score Validation](https://github.com/chandrika-sudo/pricetruth/blob/main/src/validate_trust_score.py): `src/validate_trust_score.py`

### Other components

- **Analyst**

## Connections

- Analyst → Catalog Cleaning: runs preparation
- Catalog Cleaning → Raw Catalog: reads (evidence: `src/clean_data.py`)
- Catalog Cleaning → Clean Catalog: writes (evidence: `src/clean_data.py`)
- History and Scoring → Clean Catalog: reads (evidence: `src/generate_price_history.py`)
- History and Scoring → Simulated History: writes (evidence: `src/generate_price_history.py`)
- History and Scoring → Scored Catalog: writes (evidence: `src/generate_price_history.py`)
- Analyst → Price Dashboard: explores (evidence: `src/dashboard.py`)
- Price Dashboard → Scored Catalog: loads (evidence: `src/dashboard.py`)
- Price Dashboard → Simulated History: loads (evidence: `src/dashboard.py`)
- History Chart Analysis → Scored Catalog: loads (evidence: `src/price_history_analysis.py`)
- History Chart Analysis → Simulated History: loads (evidence: `src/price_history_analysis.py`)
- History Chart Analysis → Sample History Chart: writes (evidence: `src/price_history_analysis.py`)
- Category Summary → Scored Catalog: queries (evidence: `src/business_analysis1.py`)
- SQL Analysis Runner → Category Analysis Query: executes (evidence: `src/business_analysis2.py`)
- SQL Analysis Runner → Discount Integrity Query: executes (evidence: `src/business_analysis2.py`)
- SQL Analysis Runner → Scored Catalog: queries (evidence: `src/business_analysis2.py`)
- Trust Score Validation → Scored Catalog: validates (evidence: `src/validate_trust_score.py`)
