# hawkirk/pycongress architecture

> Architecture diagram of the GitHub repository hawkirk/pycongress, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hawkirk/pycongress
- Repository: https://github.com/hawkirk/pycongress

## Overview

##### Main Components

a. External Components:
- Congress.gov API (external service)
- Client Application (user of the library)
- Environment Variables (for API key storage)

b. Internal Library Components:
- Core Client Class (client.py)
- Resource Classes:
- Bill (bill.py)
- Member (member.py)
- Congress (congress.py)
- Utilities (utils.py)

##### Specific Design Elements

Use these visual elements:
- Blue rectangles for external components (Congress.gov API, Client Application)
- Green rectangles for internal library classes
- Yellow rectangle for utilities
- Double lines for HTTP requests

##### Additional Details

Annotations:
- API version support indication
- Supported endpoints (bill, member, congress)
- Authentication flow
- HTTP request/response flow

##### Implementation Notes

- The library's role as an intermediary between client applications and the Congress.gov API
- The modular design with separate resource classes
- The centralized client handling authentication and requests
- The utility module's supporting role

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        APP[Client Application]
        ENV[Environment Variables]
    end

    subgraph Library["Python Congress Library"]
        CLIENT[Congress Client]:::core
        click CLIENT "https://github.com/hawkirk/PyCongress/blob/main/pycongress/client.py"

        subgraph Resources["Resource Classes"]
            BILL[Bill Resource]:::resource
            MEMBER[Member Resource]:::resource
            CONGRESS[Congress Resource]:::resource
            click BILL "https://github.com/hawkirk/PyCongress/blob/main/pycongress/bill.py"
            click MEMBER "https://github.com/hawkirk/PyCongress/blob/main/pycongress/member.py"
            click CONGRESS "https://github.com/hawkirk/PyCongress/blob/main/pycongress/congress.py"
        end

        UTILS[Utilities]:::util
        INIT[Package Init]:::config
        SETUP[Setup Configuration]:::config
        click UTILS "https://github.com/hawkirk/PyCongress/blob/main/pycongress/utils.py"
        click INIT "https://github.com/hawkirk/PyCongress/blob/main/pycongress/__init__.py"
        click SETUP "https://github.com/hawkirk/PyCongress/blob/main/setup.py"
    end

    subgraph External["External Services"]
        API["Congress.gov API"]:::external
    end

    %% Connections
    APP --> |Uses| CLIENT
    ENV --> |Provides API Key| CLIENT
    CLIENT --> |Manages| BILL
    CLIENT --> |Manages| MEMBER
    CLIENT --> |Manages| CONGRESS
    
    BILL --> |HTTP Requests| API
    MEMBER --> |HTTP Requests| API
    CONGRESS --> |HTTP Requests| API
    
    BILL -.-> |Uses| UTILS
    MEMBER -.-> |Uses| UTILS
    CONGRESS -.-> |Uses| UTILS
    CLIENT -.-> |Uses| UTILS

    %% Styles
    classDef external fill:#ADD8E6,stroke:#333
    classDef core fill:#90EE90,stroke:#333
    classDef resource fill:#98FB98,stroke:#333
    classDef util fill:#FFD700,stroke:#333
    classDef config fill:#DEB887,stroke:#333

    %% Legend
    subgraph Legend
        L1[External Component]:::external
        L2[Core Component]:::core
        L3[Resource Component]:::resource
        L4[Utility Component]:::util
        L5[Configuration]:::config
    end
```
