# rahul-d-rao/mutual_fund_tracker architecture

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

- Interactive diagram: https://gitdiagram.com/rahul-d-rao/mutual_fund_tracker
- Repository: https://github.com/rahul-d-rao/mutual_fund_tracker

## Overview

##### Project Type & Purpose
- This is a data processing and integration application designed to ingest mutual fund data via CSV, process and transform the data (e.g., filtering, grouping, aggregating), and then export results and interact with AWS services.
- The project integrates with AWS S3 (for storing CSV outputs) and AWS Bedrock (for leveraging generative AI to summarize performance data).

##### Main Components
a. Data Input Component:
- Datasets folder (with input CSV files) as the starting point where raw mutual fund data is stored.
b. Data Processing Module:
- “data_processing” module in src including components such as:
- load_data.py – responsible for loading input CSV files.
- transform_data_and_filter.py, data_range_filter.py, group_by_fund.py, export_results.py – which process, filter, and group the data.
c. Core Application Entry Points:
d. Services Integration:
- A module for “services” containing:
- aws_s3_service.py – for interfacing with AWS S3 (uploading files).
- aws_bedrock_service.py – for interacting with AWS Bedrock to summarize mutual fund performance.
- logger.py – for capturing and recording application events.
e. Command Line Interface (CLI):
- CLI module under src/cli (e.g., cli_helpers.py). It indicates how users interact with the system via command-line commands.
f. Configuration Management:
- Configuration files (config.yaml, aws_credentials.json, and logging_config.json) which provide data file paths, AWS credentials, and log settings.
g. Testing Suite:
- Optionally, add a block for the tests folder to show the unit tests ensuring reliability for AWS services, CLI functionality, and data processing.

##### Relationships and Interactions
- Data flows from the “datasets” folder (Input CSV) to the data processing components.
- The data processing modules (loading, filtering, grouping, transformation) feed into the export module.
- The CLI acts as a triggering interface (starting point) which then channels requests to the processing modules.
- Dependency on configuration files and environment setup to drive these interactions.

##### Architectural Patterns and Design Principles
- Modular Structure: Separate directories for data processing, service integration, and CLI indicate a modular architecture.
- Configuration-driven Design: External configuration files drive input/output paths and AWS credentials.
- Third-Party Service Integration: Emphasize the AWS SDK (Boto3) usage for AWS S3 and AWS Bedrock interactions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Ingestion & Processing
    subgraph "Data Ingestion & Processing"
        DATASET["Data Input (datasets)"]:::local
        LOAD["Load Data"]:::local
        TRANSFORM["Transform & Filter Data"]:::local
        FILTER["Data Range Filter"]:::local
        GROUP["Group By Fund"]:::local
        EXPORT["Export Results"]:::local
    end

    %% Core Application & CLI
    subgraph "Core Application & CLI"
        MAIN1["Main Script 1"]:::local
        MAIN2["Main Script 2"]:::local
        CLI["CLI Interface"]:::local
    end

    %% Services Integration
    subgraph "Services Integration"
        AWS_S3["AWS S3 Service"]:::aws
        AWS_BEDROCK["AWS Bedrock Service"]:::aws
        LOGGER["Logger"]:::local
    end

    %% Configuration Management
    subgraph "Configuration"
        CONFIG_YAML["Config (config.yaml)"]:::config
        AWS_CRED["AWS Credentials (aws_credentials.json)"]:::config
        LOG_CONFIG["Logging Config (logging_config.json)"]:::config
    end

    %% Testing Suite
    subgraph "Testing"
        TESTS["Testing Suite"]:::tests
    end

    %% Data Flow
    DATASET -->|"CSV_Input"| LOAD
    LOAD -->|"LoadCSV"| TRANSFORM
    TRANSFORM -->|"ApplyTransforms"| FILTER
    FILTER -->|"FilterRange"| GROUP
    GROUP -->|"GroupData"| EXPORT

    %% Export branching: output actions
    EXPORT -->|"UploadOutput"| AWS_S3
    EXPORT -->|"CallBedrock"| AWS_BEDROCK
    EXPORT -->|"LogsActivity"| LOGGER

    %% Core & CLI interactions
    CLI -->|"InvokeProcessing"| LOAD
    MAIN1 -->|"StartCLI"| CLI
    MAIN2 -->|"StartCLI"| CLI

    %% Configuration dependencies
    CONFIG_YAML -->|"ProvidesPaths"| LOAD
    CONFIG_YAML -->|"ProvidesPaths"| TRANSFORM
    AWS_CRED -->|"AWS_Creds"| AWS_S3
    AWS_CRED -->|"AWS_Creds"| AWS_BEDROCK
    LOG_CONFIG -->|"LoggingSettings"| LOGGER

    %% Testing influence
    TESTS -->|"TestModule"| LOAD
    TESTS -->|"TestService"| AWS_S3
    TESTS -->|"TestCLI"| CLI

    %% Class Definitions
    classDef local fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef aws fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef config fill:#e2e3e5,stroke:#d6d8db,stroke-width:2px;
    classDef tests fill:#d1c4e9,stroke:#6a1b9a,stroke-width:2px;

    %% Click Events
    click DATASET "https://github.com/rahul-d-rao/mutual_fund_tracker/tree/main/datasets/"
    click LOAD "https://github.com/rahul-d-rao/mutual_fund_tracker/blob/main/src/data_processing/load_data.py"
    click TRANSFORM "https://github.com/rahul-d-rao/mutual_fund_tracker/blob/main/src/data_processing/transform_data_and_filter.py"
    click FILTER "https://github.com/rahul-d-rao/mutual_fund_tracker/blob/main/src/data_processing/data_range_filter.py"
    click GROUP "https://github.com/rahul-d-rao/mutual_fund_tracker/blob/main/src/data_processing/group_by_fund.py"
    click EXPORT "https://github.com/rahul-d-rao/mutual_fund_tracker/blob/main/src/data_processing/export_results.py"
    click MAIN1 "https://github.com/rahul-d-rao/mutual_fund_tracker/blob/main/src/main.py"
    click MAIN2 "https://github.com/rahul-d-rao/mutual_fund_tracker/blob/main/src/main2.py"
    click AWS_S3 "https://github.com/rahul-d-rao/mutual_fund_tracker/blob/main/src/services/aws_s3_service.py"
    click AWS_BEDROCK "https://github.com/rahul-d-rao/mutual_fund_tracker/blob/main/src/services/aws_bedrock_service.py"
    click LOGGER "https://github.com/rahul-d-rao/mutual_fund_tracker/blob/main/src/services/logger.py"
    click CLI "https://github.com/rahul-d-rao/mutual_fund_tracker/blob/main/src/cli/cli_helpers.py"
    click CONFIG_YAML "https://github.com/rahul-d-rao/mutual_fund_tracker/blob/main/config/config.yaml"
    click AWS_CRED "https://github.com/rahul-d-rao/mutual_fund_tracker/blob/main/config/aws_credentials.json"
    click LOG_CONFIG "https://github.com/rahul-d-rao/mutual_fund_tracker/blob/main/config/logging_config.json"
    click TESTS "https://github.com/rahul-d-rao/mutual_fund_tracker/tree/main/tests/"
```
