# rishabhzn200/google_news_api_data_flask architecture

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

- Interactive diagram: https://gitdiagram.com/rishabhzn200/google_news_api_data_flask
- Repository: https://github.com/rishabhzn200/google_news_api_data_flask

## Overview

News Data is a Flask-backed news extraction service: a user or scheduled Google Apps Script supplies a company name, the Flask result route invokes the extraction workflow, and fetched articles are normalized and written page-by-page to a configured Google Spreadsheet. The main runtime stages and core modules are evidenced in the excerpts; Apps Script scheduling and its spreadsheet-driven company list are documented in the README, but Code.gs was not sampled, so those links are documented rather than source-verified.

Main entry points: [`flaskmain.py`](https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/flaskmain.py) (Flask routes), [`mainfile.py`](https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/mainfile.py) (News workflow), [`newsapi.py`](https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/newsapi.py) (News API client), [`gspreadapi.py`](https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/gspreadapi.py) (Spreadsheet client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_apps_script["Apps Script trigger<br/>[Code.gs]"]
end

subgraph group_workflow["Extraction workflow"]
  node_orchestrator["News workflow<br/>[mainfile.py]"]
  node_article_model["Article normalization<br/>[articles.py]"]
end

subgraph group_integrations["External services"]
  node_news_client["News API client<br/>[newsapi.py]"]
  node_sheet_client["Spreadsheet client<br/>[gspreadapi.py]"]
end

subgraph group_presentation["Web interface"]
  node_flask_routes["Flask routes<br/>[flaskmain.py]"]
  node_result_view["Result template<br/>[result.html]"]
  node_index_view["Search form<br/>[index.html]"]
end

node_user(("Company search"))
node_news_service{{"News API"}}
node_google_sheets[("Google Spreadsheet")]

node_user -->|"submits search"| node_flask_routes
node_apps_script -.->|"calls API"| node_flask_routes
node_flask_routes -->|"renders form"| node_index_view
node_flask_routes -->|"invokes workflow"| node_orchestrator
node_flask_routes -->|"streams results"| node_result_view
node_orchestrator -->|"requests pages"| node_news_client
node_news_client -->|"fetches articles"| node_news_service
node_orchestrator -->|"normalizes results"| node_article_model
node_orchestrator -->|"writes pages"| node_sheet_client
node_sheet_client -->|"updates worksheet"| node_google_sheets

click node_apps_script "https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/Code.gs"
click node_flask_routes "https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/flaskmain.py"
click node_result_view "https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/templates/result.html"
click node_index_view "https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/templates/index.html"
click node_orchestrator "https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/mainfile.py"
click node_article_model "https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/articles.py"
click node_news_client "https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/newsapi.py"
click node_sheet_client "https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/gspreadapi.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_apps_script toneBlue
class node_orchestrator,node_article_model,node_google_sheets toneAmber
class node_news_client,node_sheet_client,node_news_service toneMint
class node_flask_routes,node_result_view,node_index_view toneRose
class node_user toneIndigo
```

## Components

### Entry points

- [Apps Script trigger](https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/Code.gs): `Code.gs`

### Extraction workflow

- [News workflow](https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/mainfile.py): `mainfile.py`
- [Article normalization](https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/articles.py): `articles.py`

### External services

- [News API client](https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/newsapi.py): `newsapi.py`
- [Spreadsheet client](https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/gspreadapi.py): `gspreadapi.py`

### Web interface

- [Flask routes](https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/flaskmain.py): `flaskmain.py`
- [Result template](https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/templates/result.html): `templates/result.html`
- [Search form](https://github.com/rishabhzn200/google_news_api_data_flask/blob/master/templates/index.html): `templates/index.html`

### Other components

- **Company search**
- **News API**
- **Google Spreadsheet**

## Connections

- Company search → Flask routes: submits search (evidence: `Readme.txt`)
- Apps Script trigger → Flask routes: calls API (evidence: `Readme.txt`)
- Flask routes → Search form: renders form (evidence: `flaskmain.py`)
- Flask routes → News workflow: invokes workflow (evidence: `flaskmain.py`)
- Flask routes → Result template: streams results (evidence: `flaskmain.py`)
- News workflow → News API client: requests pages (evidence: `mainfile.py`)
- News API client → News API: fetches articles (evidence: `newsapi.py`)
- News workflow → Article normalization: normalizes results (evidence: `mainfile.py`)
- News workflow → Spreadsheet client: writes pages (evidence: `mainfile.py`)
- Spreadsheet client → Google Spreadsheet: updates worksheet (evidence: `gspreadapi.py`)
