# eliasbenaddou/monzo-api-wrapper architecture

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

- Interactive diagram: https://gitdiagram.com/eliasbenaddou/monzo-api-wrapper
- Repository: https://github.com/eliasbenaddou/monzo-api-wrapper

## Overview

##### Main Components

a) External Systems:
- Monzo API (external service)
- Database System (indicated by sql_templates.py and db.py)

b) Core Components:
- Transaction Management Module
- Balance Management Module
- Database Interface Layer
- Logging System

##### Component Organization

**┌─────────────────────────────────────────────────────────┐**
- Client Application                   │
- ┘
- ↕
**┌─────────────────────────────────────────────────────────┐**
- Monzo API Wrapper                       │
- ┬───────────────┬────────────────────────┤
- Transactions │   Balances    │        Utils           │
- Get        │   - Get       │  - Custom Logger       │
- Upload     │   - Upload    │  - DB Interface        │
- ┴───────────────┴────────────────────────┘
- ↕
**┌─────────────────────────────────────────────────────────┐**
- Monzo API                           │
- ┘
- ↕
**┌─────────────────────────────────────────────────────────┐**
- Database                            │
- ┘

##### Design Elements

Use these visual elements:
- Blue rectangles for core components
- Green rectangles for external systems
- Red highlights for critical paths

##### Specific Component Details

a) Transaction Management:
- Bidirectional flow between get_transactions.py and upload_transactions.py
- To both Monzo API and database

b) Balance Management:
- Similar structure to transactions
- Connection to get_balances.py and upload_balances.py

c) Utils Package:
- Central role of db.py
- Custom_logger.py as a cross-cutting concern
- Sql_templates.py connected to database operations

##### Notes for Implementation

- Keep the main data flow prominent
- Separation between get and upload operations
- Clear boundaries between the wrapper and external systems
- Monitoring and logging flows

##### Integration points with external systems

This structure accurately represents the project's architecture while maintaining clarity and showing the essential relationships between components.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        CA[Client Application]
    end

    subgraph Wrapper[Monzo API Wrapper]
        subgraph Transactions
            GT["Get Transactions"]:::core
            UT["Upload Transactions"]:::core
        end

        subgraph Balances
            GB["Get Balances"]:::core
            UB["Upload Balances"]:::core
        end

        subgraph Utils
            DB["Database Interface"]:::util
            LOG["Custom Logger"]:::util
            SQL["SQL Templates"]:::util
        end
    end

    subgraph External
        API[Monzo API]:::external
        DBS[(Database)]:::database
    end

    subgraph CICD[CI/CD Pipeline]
        GHA["GitHub Actions"]:::cicd
    end

    %% Connections
    CA <--> GT
    CA <--> GB
    GT <--> API
    GB <--> API
    GT --> DB
    GB --> DB
    UT --> API
    UB --> API
    DB <--> DBS
    DB --> SQL
    
    LOG -.-> GT
    LOG -.-> GB
    LOG -.-> UT
    LOG -.-> UB
    
    GHA -.-> Wrapper

    %% Click Events
    click GT "https://github.com/eliasbenaddou/monzo-api-wrapper/blob/main/src/monzo_api_wrapper/get_transactions.py"
    click UT "https://github.com/eliasbenaddou/monzo-api-wrapper/blob/main/src/monzo_api_wrapper/upload_transactions.py"
    click GB "https://github.com/eliasbenaddou/monzo-api-wrapper/blob/main/src/monzo_api_wrapper/get_balances.py"
    click UB "https://github.com/eliasbenaddou/monzo-api-wrapper/blob/main/src/monzo_api_wrapper/upload_balances.py"
    click DB "https://github.com/eliasbenaddou/monzo-api-wrapper/blob/main/src/monzo_api_wrapper/utils/db.py"
    click SQL "https://github.com/eliasbenaddou/monzo-api-wrapper/blob/main/src/monzo_api_wrapper/utils/sql_templates.py"
    click LOG "https://github.com/eliasbenaddou/monzo-api-wrapper/blob/main/src/monzo_api_wrapper/utils/custom_logger.py"
    click GHA "https://github.com/eliasbenaddou/monzo-api-wrapper/tree/main/.github/workflows"

    %% Styling
    classDef core fill:#2374ab
    classDef util fill:#48a9a6
    classDef external fill:#4caf50
    classDef database fill:#ff9800
    classDef cicd fill:#9c27b0

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Utility Components]:::util
        L3[External Systems]:::external
        L4[(Database)]:::database
        L5[CI/CD]:::cicd
    end
```
