# rkr2025/kerala-gold-rate architecture

> Architecture diagram of the GitHub repository rkr2025/kerala-gold-rate, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rkr2025/kerala-gold-rate
- Repository: https://github.com/rkr2025/kerala-gold-rate

## Overview

This repository publishes daily Kerala gold-rate updates and also contains a parallel fuel-price update flow. The principal workflow fetches rates from external pages, parses and formats them, and writes JSON snapshots; HTML files provide the apparent user-facing views. The scraper-to-source and scraper-to-data relationships are visible in the sampled Python files. HTML behavior and whether the pages load these JSON files were not sampled, so those links are shown as unverified.

Main entry points: [`scrape.py`](https://github.com/rkr2025/kerala-gold-rate/blob/main/scrape.py) (Gold-rate scraper), [`scrape_fuel.py`](https://github.com/rkr2025/kerala-gold-rate/blob/main/scrape_fuel.py) (Fuel-rate scraper), [`data.json`](https://github.com/rkr2025/kerala-gold-rate/blob/main/data.json) (Gold-rate data), [`data-fuel.json`](https://github.com/rkr2025/kerala-gold-rate/blob/main/data-fuel.json) (Fuel-rate data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Rate collection"]
  node_gold_scraper["Gold-rate scraper<br/>[scrape.py]"]
  node_fuel_scraper["Fuel-rate scraper<br/>[scrape_fuel.py]"]
end

subgraph group_snapshots["Rate snapshots"]
  node_gold_data[("Gold-rate data<br/>[data.json]")]
  node_fuel_data[("Fuel-rate data<br/>[data-fuel.json]")]
end

subgraph group_views["Web views"]
  node_gold_view["Gold-rate page<br/>[index.html]"]
  node_fuel_view["Fuel-rate page<br/>[fuel.html]"]
end

node_gold_source(("Gold-rate source"))
node_fuel_source(("Petrol and diesel sources"))

node_gold_scraper -->|"fetches rates"| node_gold_source
node_gold_scraper -->|"writes snapshot"| node_gold_data
node_fuel_scraper -->|"fetches district rates"| node_fuel_source
node_fuel_scraper -->|"writes snapshot"| node_fuel_data
node_gold_view -.->|"may read"| node_gold_data
node_fuel_view -.->|"may read"| node_fuel_data

click node_gold_scraper "https://github.com/rkr2025/kerala-gold-rate/blob/main/scrape.py"
click node_fuel_scraper "https://github.com/rkr2025/kerala-gold-rate/blob/main/scrape_fuel.py"
click node_gold_data "https://github.com/rkr2025/kerala-gold-rate/blob/main/data.json"
click node_fuel_data "https://github.com/rkr2025/kerala-gold-rate/blob/main/data-fuel.json"
click node_gold_view "https://github.com/rkr2025/kerala-gold-rate/blob/main/index.html"
click node_fuel_view "https://github.com/rkr2025/kerala-gold-rate/blob/main/fuel.html"

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_gold_scraper,node_fuel_scraper toneBlue
class node_gold_data,node_fuel_data toneAmber
class node_gold_view,node_fuel_view toneMint
class node_gold_source,node_fuel_source toneIndigo
```

## Components

### Rate collection

- [Gold-rate scraper](https://github.com/rkr2025/kerala-gold-rate/blob/main/scrape.py): `scrape.py`
- [Fuel-rate scraper](https://github.com/rkr2025/kerala-gold-rate/blob/main/scrape_fuel.py): `scrape_fuel.py`

### Rate snapshots

- [Gold-rate data](https://github.com/rkr2025/kerala-gold-rate/blob/main/data.json): `data.json`
- [Fuel-rate data](https://github.com/rkr2025/kerala-gold-rate/blob/main/data-fuel.json): `data-fuel.json`

### Web views

- [Gold-rate page](https://github.com/rkr2025/kerala-gold-rate/blob/main/index.html): `index.html`
- [Fuel-rate page](https://github.com/rkr2025/kerala-gold-rate/blob/main/fuel.html): `fuel.html`

### Other components

- **Gold-rate source**
- **Petrol and diesel sources**

## Connections

- Gold-rate scraper → Gold-rate source: fetches rates (evidence: `scrape.py`)
- Gold-rate scraper → Gold-rate data: writes snapshot (evidence: `scrape.py`)
- Fuel-rate scraper → Petrol and diesel sources: fetches district rates (evidence: `scrape_fuel.py`)
- Fuel-rate scraper → Fuel-rate data: writes snapshot (evidence: `scrape_fuel.py`)
- Gold-rate page → Gold-rate data: may read
- Fuel-rate page → Fuel-rate data: may read
