# keeganjustis/wa-state-environmental-policy-watch architecture

> Architecture diagram of the GitHub repository keeganjustis/wa-state-environmental-policy-watch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/keeganjustis/wa-state-environmental-policy-watch
- Repository: https://github.com/keeganjustis/wa-state-environmental-policy-watch

## Overview

##### Project type and purpose
- This is a prototype Python-based backend service (“Environmental Policy Newsfeed & AI Summarization Tool”) that periodically fetches environmental-policy articles (focused on Washington State Legislature), summarizes them via an AI model, and (in the future) will store results and serve/push notifications.

##### File structure
- Top-level: CI workflows (.github/workflows/pylint.yml), config files (requirements.txt, .gitignore), tests (test/unit).
- src/: main orchestration (main.py), three pipeline stages: get_news.py (fetching), analyze_news.py (summarization), send_summary.py (delivery).
- tmp/news_sites.json: list of source endpoints.

##### README for insights
- Core pipeline: Source Identification → Article Retrieval → AI Summarization → (future) Storage & Notification → (planned) Frontend/API.
- Technology stack: Python, LLM (e.g., GPT API), future DB (PostgreSQL), future web/mobile UI, notifications via email/SMS.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Sources
    subgraph "External Sources"
        direction TB
        NewsFeeds["News Feeds (RSS/Endpoints)"]:::external
        NewsConfig["Source Config\n(tmp/news_sites.json)"]:::internal
        NewsFeeds -->|"configured in JSON"| NewsConfig
    end

    %% Pipeline Orchestration
    subgraph "Core Pipeline"
        direction TB
        Scheduler["Cron Scheduler"]:::external
        Main["Orchestration\n(src/main.py)"]:::internal
        Fetch["Fetch Service\n(src/get_news.py)"]:::internal
        Summarize["Summarization Service\n(src/analyze_news.py)"]:::internal
        Deliver["Delivery Service\n(src/send_summary.py)"]:::internal

        Scheduler -->|"trigger"| Main
        Main -->|"invoke"| Fetch
        Fetch -->|"returns raw articles (JSON)"| Main
        Main -->|"pass articles"| Summarize
        Summarize -->|"returns summaries (JSON)"| Main
        Main -->|"pass summaries"| Deliver
    end

    %% External APIs and Services
    subgraph "External APIs & Services"
        direction TB
        LLM["LLM API\n(OpenAI/GPT)"]:::external
        EmailService["SMTP / SMS API"]:::external
        Fetch -->|"HTTP GET"| NewsFeeds
        Summarize -->|"HTTP POST"| LLM
        Deliver -->|"SMTP / HTTP"| EmailService
    end

    %% Future Components
    subgraph "Planned Extensions"
        direction TB
        DB["Database\n(PostgreSQL)"]:::planned
        API["Backend API\n(Flask/FastAPI)"]:::planned
        Frontend["Web/Mobile UI"]:::planned

        Summarize -->|"store summaries"| DB
        Fetch -->|"store raw articles"| DB
        API -->|"read from DB"| DB
        Frontend -->|"consume API"| API
    end

    %% Auxiliary Components
    subgraph "CI & Tests"
        direction TB
        CI["CI Workflow\n(.github/workflows/pylint.yml)"]:::auxiliary
        TestsFetch["Unit Test\n(test/unit/test_get_news.py)"]:::auxiliary
        TestsSumm["Unit Test\n(test/unit/test_analyze_news.py)"]:::auxiliary
        CI -->|"lint & check"| Main
        TestsFetch -->|"validate"| Fetch
        TestsSumm -->|"validate"| Summarize
    end

    %% Dependencies & Docs
    subgraph "Project Artifacts"
        direction TB
        Req["requirements.txt"]:::auxiliary
        Readme["README.md"]:::auxiliary
    end

    %% Click Events
    click Main "https://github.com/keeganjustis/wa-state-environmental-policy-watch/blob/main/src/main.py"
    click Fetch "https://github.com/keeganjustis/wa-state-environmental-policy-watch/blob/main/src/get_news.py"
    click Summarize "https://github.com/keeganjustis/wa-state-environmental-policy-watch/blob/main/src/analyze_news.py"
    click Deliver "https://github.com/keeganjustis/wa-state-environmental-policy-watch/blob/main/src/send_summary.py"
    click NewsConfig "https://github.com/keeganjustis/wa-state-environmental-policy-watch/blob/main/tmp/news_sites.json"
    click CI "https://github.com/keeganjustis/wa-state-environmental-policy-watch/blob/main/.github/workflows/pylint.yml"
    click TestsFetch "https://github.com/keeganjustis/wa-state-environmental-policy-watch/blob/main/test/unit/test_get_news.py"
    click TestsSumm "https://github.com/keeganjustis/wa-state-environmental-policy-watch/blob/main/test/unit/test_analyze_news.py"
    click Req "https://github.com/keeganjustis/wa-state-environmental-policy-watch/blob/main/requirements.txt"
    click Readme "https://github.com/keeganjustis/wa-state-environmental-policy-watch/blob/main/README.md"

    %% Styles
    classDef internal fill:#ADD8E6,stroke:#000
    classDef external fill:#90EE90,stroke:#000
    classDef planned fill:#D3D3D3,stroke:#000,stroke-dasharray: 5 5
    classDef auxiliary fill:#FFDEAD,stroke:#000
```
