# greyhoundforty/account-usage-python architecture

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

- Interactive diagram: https://gitdiagram.com/greyhoundforty/account-usage-python
- Repository: https://github.com/greyhoundforty/account-usage-python

## Overview

Based on our review of the project’s file tree and the README, this project is a set of Python-based scripts aimed at managing billing, licensing, and resource auditing for Citi’s HPC-as-a-Service on IBM Cloud. The project is organized into three main script modules: Billing, Utilities, and LicenseManagement. Each module is containerized (as evidenced by the Dockerfiles) and uses logging configurations and requirements files to manage dependencies and operations.

##### Main Components
- Billing Module: This component (found in the “Billing” folder) contains scripts (e.g., citiUsage.py) and a configuration (apps.yaml) used to calculate contractual billing. It also has its own Dockerfile, requirements, and logging configuration.
- Utilities Module: Contained in the “Utilities” folder, this module is responsible for various resource and audit operations. Its Python scripts (like attachTag.py, currentMonthUsage.py, getCases.py, listTags.py, missingBIllableItems.py) help manage and audit resource tags and usage.
- LicenseManagement Module: Housed under “licenseManagement”, this module includes scripts (such as licenseReport.py) that track BYOL licenses. Like the other modules, it includes Docker support and dependency management.

##### Relationships and Interactions
- Although the modules run as separate containerized services, they share a common purpose: managing aspects of HPC-as-a-Service consumption at Citi. The Billing module processes usage to compute costs; Utilities performs resource audits and data retrieval; LicenseManagement keeps track of license usage.
- Connections (even if abstract) showing that data flows from the HPC resource monitoring systems (or an external data source) into these modules for processing.

##### Architectural Patterns and Design Principles
- Containerization: Each top-level module is containerized, as indicated by their Dockerfiles. This means they can be independently deployed and scaled.
- Modularity: The clear separation into Billing, Utilities, and LicenseManagement reflects a modular design. Each module encapsulates a distinct business capability.
- Dependency Management: Use of requirements.txt and logging configuration files emphasizes standardized dependency and logging practices across components.
- Configuration-Driven Behavior: The Billing module’s use of an apps.yaml file suggests that at least some behavior can be adjusted via configuration files.

##### Relevant Technologies and Tools
- Python: The core scripting language used across modules.
- Docker: Each module includes a Dockerfile, indicating containerized deployment.
- JSON Configurations: For centralized logging (logging.json files) in each module.
- YAML: Seen in Billing (apps.yaml) which might be used for further configuration or orchestration properties.

##### Elements
- Configuration & Deployment Artifacts: Optionally annotate components with references to Docker, requirements.txt, logging.json, and apps.yaml where they influence behavior.

## Diagram (Mermaid)

```mermaid
graph TB
    DS["IBM Cloud HPC-as-a-Service – Data/Resource Source"]:::dataSource

    %% Billing Module Subgraph
    subgraph "Billing Module"
        B0["Billing Module\n(Docker Container)"]:::module
        B1["citiUsage.py"]:::script
        B2["apps.yaml"]:::config
        B3["Dockerfile"]:::module
        B4["logging.json"]:::config
        B5["requirements.txt"]:::config
    end

    %% Utilities Module Subgraph
    subgraph "Utilities Module"
        U0["Utilities Module\n(Docker Container)"]:::module
        U1["attachTag.py"]:::script
        U2["currentMonthUsage.py"]:::script
        U3["getCases.py"]:::script
        U4["listTags.py"]:::script
        U5["missingBIllableItems.py"]:::script
        U6["Dockerfile"]:::module
        U7["logging.json"]:::config
        U8["requirements.txt"]:::config
    end

    %% LicenseManagement Module Subgraph
    subgraph "LicenseManagement Module"
        L0["LicenseManagement Module\n(Docker Container)"]:::module
        L1["licenseReport.py"]:::script
        L2["Dockerfile"]:::module
        L3["logging.json"]:::config
        L4["requirements.txt"]:::config
    end

    %% Data flow from Data/Resource Source to each module container
    DS --> B0
    DS --> U0
    DS --> L0

    %% Billing Module internal connections
    B0 --> B1
    B0 --> B2
    B0 --> B3
    B0 --> B4
    B0 --> B5

    %% Utilities Module internal connections
    U0 --> U1
    U0 --> U2
    U0 --> U3
    U0 --> U4
    U0 --> U5
    U0 --> U6
    U0 --> U7
    U0 --> U8

    %% LicenseManagement Module internal connections
    L0 --> L1
    L0 --> L2
    L0 --> L3
    L0 --> L4

    %% Click Events for Billing Module Components
    click B1 "https://github.com/greyhoundforty/account-usage-python/blob/main/Billing/citiUsage.py"
    click B2 "https://github.com/greyhoundforty/account-usage-python/blob/main/Billing/apps.yaml"
    click B3 "https://github.com/greyhoundforty/account-usage-python/tree/main/Billing/Dockerfile"
    click B4 "https://github.com/greyhoundforty/account-usage-python/blob/main/Billing/logging.json"
    click B5 "https://github.com/greyhoundforty/account-usage-python/blob/main/Billing/requirements.txt"

    %% Click Events for Utilities Module Components
    click U1 "https://github.com/greyhoundforty/account-usage-python/blob/main/Utilities/attachTag.py"
    click U2 "https://github.com/greyhoundforty/account-usage-python/blob/main/Utilities/currentMonthUsage.py"
    click U3 "https://github.com/greyhoundforty/account-usage-python/blob/main/Utilities/getCases.py"
    click U4 "https://github.com/greyhoundforty/account-usage-python/blob/main/Utilities/listTags.py"
    click U5 "https://github.com/greyhoundforty/account-usage-python/blob/main/Utilities/missingBIllableItems.py"
    click U6 "https://github.com/greyhoundforty/account-usage-python/tree/main/Utilities/Dockerfile"
    click U7 "https://github.com/greyhoundforty/account-usage-python/blob/main/Utilities/logging.json"
    click U8 "https://github.com/greyhoundforty/account-usage-python/blob/main/Utilities/requirements.txt"

    %% Click Events for LicenseManagement Module Components
    click L1 "https://github.com/greyhoundforty/account-usage-python/blob/main/licenseManagement/licenseReport.py"
    click L2 "https://github.com/greyhoundforty/account-usage-python/tree/main/licenseManagement/Dockerfile"
    click L3 "https://github.com/greyhoundforty/account-usage-python/blob/main/licenseManagement/logging.json"
    click L4 "https://github.com/greyhoundforty/account-usage-python/blob/main/licenseManagement/requirements.txt"

%% Styles
classDef dataSource fill:#cce5ff,stroke:#004085,stroke-width:2px;
classDef module fill:#d4edda,stroke:#155724,stroke-width:2px;
classDef script fill:#fff3cd,stroke:#856404,stroke-width:1px;
classDef config fill:#f8d7da,stroke:#721c24,stroke-width:1px;
```
