# rkpbr/redflag architecture

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

- Interactive diagram: https://gitdiagram.com/rkpbr/redflag
- Repository: https://github.com/rkpbr/redflag

## Overview

redflag is a Gujarati Streamlit stock-analysis dashboard. A user submits a share name; the app fetches market and company data, evaluates business quality and valuation, adds automated warning checks, then presents a decision and a possible investment plan. It also supports review history through a local CSV journal and an optional Google Sheet. The single-file implementation is only partially excerpted, so links to UI orchestration and some integrations are marked unverified rather than inferred as confirmed calls.

Main entry points: [`redflag_app.py`](https://github.com/rkpbr/redflag/blob/main/redflag_app.py) (Market data fetch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Dashboard"]
  node_dashboard["Streamlit interface<br/>[redflag_app.py]"]
end

subgraph group_analysis["Stock analysis"]
  node_market_data["Market data fetch<br/>[redflag_app.py]"]
  node_quality_checks["Quality checks<br/>[redflag_app.py]"]
  node_valuation["PE valuation<br/>[redflag_app.py]"]
  node_warning_checks["Automated warnings<br/>[redflag_app.py]"]
  node_decision_plan["Decision and plan<br/>[redflag_app.py]"]
end

subgraph group_records["Review records"]
  node_journal[("Local CSV journal<br/>[redflag_app.py]")]
end

node_user(("Investor"))
node_news["Google News"]
node_nse_lists["NSE ASM/GSM lists"]
node_yahoo["Yahoo Finance"]
node_google_sheet[("Google Sheet")]

node_user -->|"enters share"| node_dashboard
node_dashboard -.->|"submits for analysis"| node_market_data
node_market_data -.->|"fetches data"| node_yahoo
node_market_data -.->|"supplies data"| node_quality_checks
node_market_data -.->|"supplies data"| node_valuation
node_market_data -.->|"supplies data"| node_warning_checks
node_quality_checks -.->|"informs decision"| node_decision_plan
node_valuation -.->|"informs decision"| node_decision_plan
node_warning_checks -.->|"scans headlines"| node_news
node_warning_checks -.->|"checks lists"| node_nse_lists
node_warning_checks -.->|"checks insiders"| node_yahoo
node_decision_plan -.->|"presents result"| node_dashboard
node_decision_plan -.->|"records review"| node_journal
node_decision_plan -.->|"saves result"| node_google_sheet

click node_dashboard "https://github.com/rkpbr/redflag/blob/main/redflag_app.py"
click node_market_data "https://github.com/rkpbr/redflag/blob/main/redflag_app.py"
click node_quality_checks "https://github.com/rkpbr/redflag/blob/main/redflag_app.py"
click node_valuation "https://github.com/rkpbr/redflag/blob/main/redflag_app.py"
click node_warning_checks "https://github.com/rkpbr/redflag/blob/main/redflag_app.py"
click node_decision_plan "https://github.com/rkpbr/redflag/blob/main/redflag_app.py"
click node_journal "https://github.com/rkpbr/redflag/blob/main/redflag_app.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_dashboard toneBlue
class node_market_data,node_quality_checks,node_valuation,node_warning_checks,node_decision_plan,node_google_sheet toneAmber
class node_journal toneMint
class node_user,node_news,node_nse_lists,node_yahoo toneIndigo
```

## Components

### Dashboard

- [Streamlit interface](https://github.com/rkpbr/redflag/blob/main/redflag_app.py): `redflag_app.py`

### Stock analysis

- [Market data fetch](https://github.com/rkpbr/redflag/blob/main/redflag_app.py): `redflag_app.py`
- [Quality checks](https://github.com/rkpbr/redflag/blob/main/redflag_app.py): `redflag_app.py`
- [PE valuation](https://github.com/rkpbr/redflag/blob/main/redflag_app.py): `redflag_app.py`
- [Automated warnings](https://github.com/rkpbr/redflag/blob/main/redflag_app.py): `redflag_app.py`
- [Decision and plan](https://github.com/rkpbr/redflag/blob/main/redflag_app.py): `redflag_app.py`

### Review records

- [Local CSV journal](https://github.com/rkpbr/redflag/blob/main/redflag_app.py): `redflag_app.py`

### Other components

- **Investor**
- **Google News**
- **NSE ASM/GSM lists**
- **Yahoo Finance**
- **Google Sheet**

## Connections

- Investor → Streamlit interface: enters share (evidence: `redflag_app.py`)
- Streamlit interface → Market data fetch: submits for analysis (evidence: `redflag_app.py`)
- Market data fetch → Yahoo Finance: fetches data
- Market data fetch → Quality checks: supplies data (evidence: `redflag_app.py`)
- Market data fetch → PE valuation: supplies data (evidence: `redflag_app.py`)
- Market data fetch → Automated warnings: supplies data (evidence: `redflag_app.py`)
- Quality checks → Decision and plan: informs decision (evidence: `redflag_app.py`)
- PE valuation → Decision and plan: informs decision (evidence: `redflag_app.py`)
- Automated warnings → Google News: scans headlines
- Automated warnings → NSE ASM/GSM lists: checks lists
- Automated warnings → Yahoo Finance: checks insiders
- Decision and plan → Streamlit interface: presents result (evidence: `redflag_app.py`)
- Decision and plan → Local CSV journal: records review (evidence: `redflag_app.py`)
- Decision and plan → Google Sheet: saves result
