# vidyutchakrabarti/goistats architecture

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

- Interactive diagram: https://gitdiagram.com/vidyutchakrabarti/goistats
- Repository: https://github.com/vidyutchakrabarti/goistats

## Overview

##### Project type and purpose
- GOIStats is an AWS-based data-processing pipeline and analytics application.
- It ingests national survey and CPI datasets, cleans/transforms them via Python (in Colab or Lambda), stores results in S3 and an RDS Postgres database, and exposes the results through a PowerBI dashboard.
- Terraform is used for infrastructure-as-code to provision AWS resources (IAM, VPC, S3, Lambda, RDS, S3 notifications).

##### File structure
- Top level:
– S3 Data: local drop-in of cleaned CSVs for testing/analysis
– terraform: IaC split into bootstrap (creates initial IAM/permissions) and main (defines VPC, S3 buckets, lambda, RDS, security)
– DWDMvis.pbix: PowerBI report
- In terraform/main: the presence of lambda_function.py, s3_notification.tf, and rds.tf indicates an event-driven ETL (S3→Lambda) that writes into RDS.

##### README for additional insights
- Describes two primary dataset sources (Household Consumption & CPI)
- Notes deployment steps (terraform init/plan/apply) and cost-driven choice of Lambda over Glue
- Mentions PowerBI as the final visualization layer

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External and Development Layers
    ExternalData["External Data Sources"]:::external
    click ExternalData "https://github.com/vidyutchakrabarti/goistats/tree/main/S3 Data/"
    Developer["Developer Prototype (Colab)"]:::dev

    %% Documentation Layer
    subgraph "Documentation"
        Assets["Assets (Pipeline, Schema Diagrams)"]:::doc
        click Assets "https://github.com/vidyutchakrabarti/goistats/tree/main/assets/"
        README["README & Documentation"]:::doc
        click README "https://github.com/vidyutchakrabarti/goistats/blob/main/README.md"
    end

    %% AWS Cloud Boundary
    subgraph "AWS Cloud"
        direction TB
        %% Security
        IAM["IAM & Security"]:::security
        click IAM "https://github.com/vidyutchakrabarti/goistats/blob/main/terraform/main/iam.tf"
        click IAM "https://github.com/vidyutchakrabarti/goistats/blob/main/terraform/main/security.tf"

        %% Networking
        VPC["VPC & Networking"]:::network
        click VPC "https://github.com/vidyutchakrabarti/goistats/blob/main/terraform/main/vpc.tf"

        %% Storage
        S3Raw["Raw Data S3 Bucket"]:::storage
        S3Clean["Cleaned Data S3 Bucket"]:::storage
        click S3Raw "https://github.com/vidyutchakrabarti/goistats/blob/main/terraform/main/s3.tf"
        click S3Clean "https://github.com/vidyutchakrabarti/goistats/blob/main/terraform/main/s3.tf"

        S3Notif["S3 Notification"]:::storage
        click S3Notif "https://github.com/vidyutchakrabarti/goistats/blob/main/terraform/main/s3_notification.tf"

        %% Compute
        Lambda["ETL Lambda Function"]:::compute
        click Lambda "https://github.com/vidyutchakrabarti/goistats/blob/main/terraform/main/lambda.tf"
        click Lambda "https://github.com/vidyutchakrabarti/goistats/blob/main/terraform/main/lambda_function.py"

        %% Database
        RDS["Postgres RDS"]:::db
        click RDS "https://github.com/vidyutchakrabarti/goistats/blob/main/terraform/main/rds.tf"
    end

    %% BI Layer
    PowerBI["PowerBI Dashboard"]:::bi
    click PowerBI "https://github.com/vidyutchakrabarti/goistats/blob/main/DWDMvis.pbix"

    %% Terraform IaC
    Terraform["Terraform Infrastructure"]:::iac
    click Terraform "https://github.com/vidyutchakrabarti/goistats/blob/main/terraform/bootstrap/main.tf"
    click Terraform "https://github.com/vidyutchakrabarti/goistats/blob/main/terraform/bootstrap/variables.tf"
    click Terraform "https://github.com/vidyutchakrabarti/goistats/blob/main/terraform/main/main.tf"
    click Terraform "https://github.com/vidyutchakrabarti/goistats/blob/main/terraform/main/variables.tf"
    click Terraform "https://github.com/vidyutchakrabarti/goistats/blob/main/terraform/main/outputs.tf"

    %% Data Flows
    ExternalData -->|"upload raw CSVs"| S3Raw
    S3Raw -->|"on new object"| S3Notif
    S3Notif -->|"invokes ETL"| Lambda
    Lambda -->|"writes cleaned CSV"| S3Clean
    Lambda -->|"loads data"| RDS
    Developer -.->|"prototypes cleaning"| Lambda
    RDS -->|"queries over VPC"| PowerBI

    %% Terraform Relationships
    Terraform -.-> IAM
    Terraform -.-> VPC
    Terraform -.-> S3Raw
    Terraform -.-> S3Clean
    Terraform -.-> S3Notif
    Terraform -.-> Lambda
    Terraform -.-> RDS

    %% Class Definitions
    classDef external fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef dev fill:#f2f2f2,stroke:#333,stroke-width:1px
    classDef storage fill:#bbdefb,stroke:#333,stroke-width:1px
    classDef compute fill:#ffe0b2,stroke:#333,stroke-width:1px
    classDef db fill:#c8e6c9,stroke:#333,stroke-width:1px
    classDef network fill:#b3e5fc,stroke:#333,stroke-width:1px
    classDef security fill:#ffcdd2,stroke:#333,stroke-width:1px
    classDef iac fill:#e1bee7,stroke:#333,stroke-width:1px
    classDef bi fill:#fff9c4,stroke:#333,stroke-width:1px
    classDef doc fill:#eceff1,stroke:#333,stroke-width:1px
```
