# machadoluiz/daric architecture

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

- Interactive diagram: https://gitdiagram.com/machadoluiz/daric
- Repository: https://github.com/machadoluiz/daric

## Overview

##### Project Type and Purpose
- This is a full-stack, single-page web application built with Python and Streamlit.

##### File Structure Analysis
- Top-level:
- financial_tracker/app.py – the Streamlit entry point (UI layer + orchestration).
- financial_tracker/data – bundled sample CSVs and JSON template (static assets).
- financial_tracker/extractors – modules that pull raw data from three sources: Sample, LocalFile, GoogleDrive.
- financial_tracker/transformations – core business logic to clean, normalize, and categorize transactions.
- financial_tracker/visualizations – routines that build charts, tables, and KPIs for the UI.
- Configuration files: pyproject.toml, .pre-commit-config.yaml, .python-version, indicating Python package setup and code quality tooling.
- Deployment: runs via “streamlit run financial_tracker/app.py”, no separate backend service or database server—data lives in CSVs or Google Drive folders.

##### README Insights
- Describes end-to-end user flow: data selection → data loading → optional category JSON mapping → submit → dashboard.
- Lists external dependency: Google Drive API (GCP service account credentials).
- No mention of a persistent database; data is ephemeral per session.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Presentation Layer"
        UI["Streamlit App"]:::ui
    end

    subgraph "Application Layer"
        EF["Extractor Factory"]:::processing
    end

    subgraph "Data Layer"
        subgraph "Extractors"
            LFE["LocalFileExtractor"]:::extractors
            GDE["GoogleDriveExtractor"]:::extractors
        end
    end

    subgraph "Data Sources"
        SAS["sample_account_data.csv"]:::dataStore
        SCS["sample_credit_card_data.csv"]:::dataStore
        LFS["User-uploaded CSV"]:::dataStore
        JSON["category_keywords_template.json"]:::dataStore
    end

    subgraph "External Services"
        GDrive["Google Drive"]:::external
        Credentials["Service Account JSON"]:::external
    end

    subgraph "Business Logic Layer"
        TE["Transformation Engine"]:::transform
    end

    subgraph "Presentation Logic Layer"
        VE["Visualization Engine"]:::visualization
    end

    %% Data Flow
    UI -->|"select data source"| EF
    EF -->|"use sample data"| SAS
    EF -->|"use sample data"| SCS
    EF -->|"instantiate LocalFileExtractor"| LFE
    EF -->|"instantiate GoogleDriveExtractor"| GDE

    LFE -->|"read CSV"| LFS
    LFE -.->|"optional JSON mapping"| JSON

    GDE -->|"fetch via API"| GDrive
    GDE -->|"use credentials"| Credentials

    SAS -->|"raw CSV rows"| TE
    SCS -->|"raw CSV rows"| TE
    LFS -->|"raw CSV rows"| TE
    GDE -->|"raw CSV rows"| TE
    JSON -.->|"category mapping"| TE

    TE -->|"normalized transactions"| VE
    VE -->|"render charts/KPIs"| UI

    %% Click Events
    click UI "https://github.com/machadoluiz/daric/blob/main/financial_tracker/app.py"
    click SAS "https://github.com/machadoluiz/daric/blob/main/financial_tracker/data/sample_account_data.csv"
    click SCS "https://github.com/machadoluiz/daric/blob/main/financial_tracker/data/sample_credit_card_data.csv"
    click JSON "https://github.com/machadoluiz/daric/blob/main/financial_tracker/data/category_keywords_template.json"
    click EF "https://github.com/machadoluiz/daric/blob/main/financial_tracker/extractors/extractor_factory.py"
    click LFE "https://github.com/machadoluiz/daric/blob/main/financial_tracker/extractors/local_file_extractor.py"
    click GDE "https://github.com/machadoluiz/daric/blob/main/financial_tracker/extractors/google_drive_extractor.py"
    click TE "https://github.com/machadoluiz/daric/blob/main/financial_tracker/transformations/transform.py"
    click VE "https://github.com/machadoluiz/daric/blob/main/financial_tracker/visualizations/visualization.py"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px;
    classDef processing fill:#C6E2FF,stroke:#333,stroke-width:1px;
    classDef extractors fill:#90EE90,stroke:#333,stroke-width:1px;
    classDef dataStore fill:#F0E68C,stroke:#333,stroke-width:1px;
    classDef external fill:#FFA500,stroke:#333,stroke-width:1px;
    classDef transform fill:#98FB98,stroke:#333,stroke-width:1px;
    classDef visualization fill:#FFDEAD,stroke:#333,stroke-width:1px;
```
