# harikrishna1-ds/powerbi_sync architecture

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

- Interactive diagram: https://gitdiagram.com/harikrishna1-ds/powerbi_sync
- Repository: https://github.com/harikrishna1-ds/powerbi_sync

## Overview

TV Search Production Sync is a local workspace for capturing DataTrace queue data, preserving numbered previews, and maintaining two authoritative Google Sheets production trackers. The main workflow runs from portal capture through local snapshot storage and tracker synchronization to dashboard reporting. The React workspace also exposes comparisons, SLA views, and exports; a legacy Streamlit analytics view remains in the repository. The README documents scheduling and recovery behavior, while some implementation details—especially browser capture wiring and unsampled report features—are not visible in the excerpts.

Main entry points: [`gsheet_dashboard/server.py`](https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/server.py) (Sync orchestration), [`gsheet_dashboard/tracker_sync.py`](https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/tracker_sync.py) (Tracker merge), [`gsheet_dashboard/frontend/src/main.jsx`](https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/frontend/src/main.jsx) (React workspace), [`gsheet_dashboard/datatrace_sync.py`](https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/datatrace_sync.py) (Capture processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture"]
  node_scraper["Portal capture"]
  node_capture_processing["Capture processing<br/>[datatrace_sync.py]"]
  node_preview_store[("Preview history<br/>[preview_store.py]")]
end

subgraph group_sync["Tracker sync"]
  node_sync_orchestrator["Sync orchestration<br/>[server.py]"]
  node_tracker_sync["Tracker merge<br/>[tracker_sync.py]"]
  node_formatting["Status formatting"]
end

subgraph group_reporting["Reporting"]
  node_reporting["Order reporting<br/>[order_reporting.py]"]
  node_sla_comments["SLA comments<br/>[sla_comments.py]"]
  node_dates["Reporting dates<br/>[reporting_dates.py]"]
end

subgraph group_interfaces["Workspace interfaces"]
  node_react_ui["React workspace<br/>[main.jsx]"]
  node_streamlit["Streamlit analytics<br/>[streamlit_app.py]"]
end

subgraph group_runtime["Runtime support"]
  node_clock["IST clock<br/>[indian_clock.py]"]
  node_config["Sync configuration<br/>[sync_config.py]"]
end

node_operator(("Operator"))
node_portal(("DataTrace portal"))
node_sheets[("Google Sheets")]

node_operator -->|"uses"| node_react_ui
node_react_ui -->|"requests API"| node_sync_orchestrator
node_portal -.->|"provides queue"| node_scraper
node_scraper -.->|"captures data"| node_capture_processing
node_sync_orchestrator -->|"starts sync"| node_capture_processing
node_capture_processing -->|"saves previews"| node_preview_store
node_sync_orchestrator -->|"reads previews"| node_preview_store
node_sync_orchestrator -->|"runs tracker sync"| node_tracker_sync
node_tracker_sync -->|"writes trackers"| node_sheets
node_sync_orchestrator -->|"reads tracker data"| node_sheets
node_tracker_sync -->|"uses formatting"| node_formatting
node_sync_orchestrator -->|"builds reports"| node_reporting
node_reporting -->|"uses tracker reports"| node_tracker_sync
node_sync_orchestrator -->|"handles SLA edits"| node_sla_comments
node_sync_orchestrator -->|"uses date ranges"| node_dates
node_react_ui -->|"shows results"| node_sync_orchestrator
node_operator -->|"uses analytics"| node_streamlit
node_streamlit -->|"reads trackers"| node_sheets
node_sync_orchestrator -->|"uses IST time"| node_clock
node_sync_orchestrator -->|"loads settings"| node_config

click node_scraper "https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/scrape_datatrace.js"
click node_capture_processing "https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/datatrace_sync.py"
click node_preview_store "https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/preview_store.py"
click node_sync_orchestrator "https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/server.py"
click node_tracker_sync "https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/tracker_sync.py"
click node_formatting "https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/tracker_formatting.py"
click node_reporting "https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/order_reporting.py"
click node_sla_comments "https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/sla_comments.py"
click node_dates "https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/reporting_dates.py"
click node_react_ui "https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/frontend/src/main.jsx"
click node_streamlit "https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/streamlit_app.py"
click node_clock "https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/indian_clock.py"
click node_config "https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/sync_config.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_scraper,node_capture_processing,node_preview_store toneBlue
class node_sync_orchestrator,node_tracker_sync,node_formatting,node_sheets toneAmber
class node_reporting,node_sla_comments,node_dates toneMint
class node_react_ui,node_streamlit toneRose
class node_clock,node_config,node_operator,node_portal toneIndigo
```

## Components

### Capture

- [Portal capture](https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/scrape_datatrace.js): `gsheet_dashboard/scrape_datatrace.js`
- [Capture processing](https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/datatrace_sync.py): `gsheet_dashboard/datatrace_sync.py`
- [Preview history](https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/preview_store.py): `gsheet_dashboard/preview_store.py`

### Tracker sync

- [Sync orchestration](https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/server.py): `gsheet_dashboard/server.py`
- [Tracker merge](https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/tracker_sync.py): `gsheet_dashboard/tracker_sync.py`
- [Status formatting](https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/tracker_formatting.py): `gsheet_dashboard/tracker_formatting.py`

### Reporting

- [Order reporting](https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/order_reporting.py): `gsheet_dashboard/order_reporting.py`
- [SLA comments](https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/sla_comments.py): `gsheet_dashboard/sla_comments.py`
- [Reporting dates](https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/reporting_dates.py): `gsheet_dashboard/reporting_dates.py`

### Workspace interfaces

- [React workspace](https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/frontend/src/main.jsx): `gsheet_dashboard/frontend/src/main.jsx`
- [Streamlit analytics](https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/streamlit_app.py): `gsheet_dashboard/streamlit_app.py`

### Runtime support

- [IST clock](https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/indian_clock.py): `gsheet_dashboard/indian_clock.py`
- [Sync configuration](https://github.com/harikrishna1-ds/powerbi_sync/blob/main/gsheet_dashboard/sync_config.py): `gsheet_dashboard/sync_config.py`

### Other components

- **Operator**
- **DataTrace portal**
- **Google Sheets**

## Connections

- Operator → React workspace: uses (evidence: `README.md`)
- React workspace → Sync orchestration: requests API (evidence: `README.md`)
- DataTrace portal → Portal capture: provides queue
- Portal capture → Capture processing: captures data
- Sync orchestration → Capture processing: starts sync (evidence: `gsheet_dashboard/server.py`)
- Capture processing → Preview history: saves previews (evidence: `gsheet_dashboard/datatrace_sync.py`)
- Sync orchestration → Preview history: reads previews (evidence: `gsheet_dashboard/server.py`)
- Sync orchestration → Tracker merge: runs tracker sync (evidence: `gsheet_dashboard/server.py`)
- Tracker merge → Google Sheets: writes trackers (evidence: `README.md`)
- Sync orchestration → Google Sheets: reads tracker data (evidence: `gsheet_dashboard/server.py`)
- Tracker merge → Status formatting: uses formatting (evidence: `gsheet_dashboard/tracker_sync.py`)
- Sync orchestration → Order reporting: builds reports (evidence: `gsheet_dashboard/server.py`)
- Order reporting → Tracker merge: uses tracker reports (evidence: `gsheet_dashboard/order_reporting.py`)
- Sync orchestration → SLA comments: handles SLA edits (evidence: `gsheet_dashboard/server.py`)
- Sync orchestration → Reporting dates: uses date ranges (evidence: `gsheet_dashboard/server.py`)
- React workspace → Sync orchestration: shows results (evidence: `README.md`)
- Operator → Streamlit analytics: uses analytics (evidence: `gsheet_dashboard/streamlit_app.py`)
- Streamlit analytics → Google Sheets: reads trackers (evidence: `gsheet_dashboard/streamlit_app.py`)
- Sync orchestration → IST clock: uses IST time (evidence: `gsheet_dashboard/server.py`)
- Sync orchestration → Sync configuration: loads settings (evidence: `gsheet_dashboard/server.py`)
