# srujangowda-10/weatherapi-data-engineering-project architecture

> Architecture diagram of the GitHub repository srujangowda-10/weatherapi-data-engineering-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/srujangowda-10/weatherapi-data-engineering-project
- Repository: https://github.com/srujangowda-10/weatherapi-data-engineering-project

## Overview

##### Main Components

A. Data Source Layer:
- WeatherAPI (external data source)
- API endpoints for current weather and forecast data
- 10 major Indian cities as data points

B. AWS Infrastructure Layer:
- Lambda Functions (show two distinct functions)
- Data Extraction Lambda
- Data Transformation Lambda
- S3 Buckets (show at least two buckets)
- Raw Data Bucket
- Transformed Data Bucket
- AWS Secrets Manager
- EventBridge for scheduling

C. Snowflake Layer:
- External Stage
- Snowpipes
- Data Warehouse Tables
- Dimension Tables (Location, Condition)
- Fact Tables (Current Weather, Forecast Day, Forecast Hour)

##### Component Relationships and Data Flow

1. WeatherAPI → Lambda (Extraction) → Raw S3 Bucket
2. Raw S3 Bucket → Lambda (Transformation) → Transformed S3 Bucket
3. Transformed S3 Bucket → Snowflake External Stage → Snowpipes → Tables

##### Specific Design Elements

A. Top Section:
- WeatherAPI with its endpoints
- EventBridge timer connection to Lambda

B. Middle Section:
- AWS infrastructure components
- S3 buckets with file formats
- Secrets Manager connection to Lambda

C. Bottom Section:
- Snowflake architecture
- Table relationships (star schema)
- Snowpipe data flow

##### Additional Details

- Data formats at each stage (JSON, CSV, etc.)
- Scheduling intervals from EventBridge
- Table relationships in Snowflake
- Security components (AWS Secrets Manager)

##### Important Notes

- Timing information for scheduled events
- Data transformation steps between components
- Error handling and monitoring points
- Volume metrics or data size indicators

##### Recommended Tools

Suggest using:
- Standard database symbols

This system design should emphasize the ETL pipeline nature of the project, showing clear separation between extraction, transformation, and loading phases while highlighting the cloud-based architecture and automated nature of the solution.

## Diagram (Mermaid)

```mermaid
%%{init: {
  'theme': 'base',
  'themeVariables': {
    'primaryColor': '#2b2b2b',
    'primaryTextColor': '#fff',
    'primaryBorderColor': '#7C0000',
    'lineColor': '#F8B229',
    'secondaryColor': '#006100',
    'tertiaryColor': '#0000ff'
  }
}}%%

flowchart TB
    classDef external fill:#90EE90,stroke:#333,stroke-width:2px
    classDef aws fill:#FF9900,stroke:#333,stroke-width:2px
    classDef storage fill:#9370DB,stroke:#333,stroke-width:2px
    classDef snowflake fill:#1E90FF,stroke:#333,stroke-width:2px
    classDef scheduler fill:#808080,stroke:#333,stroke-width:2px

    subgraph "Data Source Layer"
        WA["WeatherAPI"]:::external
        Cities["10 Major Indian Cities"]:::external
    end

    subgraph "AWS Infrastructure Layer"
        EB["EventBridge\n(Scheduler)"]:::scheduler
        SM["AWS Secrets Manager"]:::aws
        
        subgraph "Lambda Functions"
            EL["Data Extraction Lambda"]:::aws
            TL["Data Transformation Lambda"]:::aws
        end
        
        subgraph "S3 Storage"
            RB["Raw Data Bucket\n(JSON)"]:::storage
            TB["Transformed Data Bucket\n(CSV)"]:::storage
        end
    end

    subgraph "Snowflake Layer"
        ES["External Stage"]:::snowflake
        SP["Snowpipes"]:::snowflake
        
        subgraph "Dimension Tables"
            LT["Location Table"]:::snowflake
            CT["Condition Table"]:::snowflake
        end
        
        subgraph "Fact Tables"
            CW["Current Weather"]:::snowflake
            FD["Forecast Day"]:::snowflake
            FH["Forecast Hour"]:::snowflake
        end
    end

    WA --> EL
    Cities --> WA
    EB --> EL
    SM --> EL
    EL --> RB
    RB --> TL
    TL --> TB
    TB --> ES
    ES --> SP
    SP --> LT & CT & CW & FD & FH
    
    click EL "https://github.com/SrujanGowda-10/WeatherApi-Data-Engineering-project/blob/main/DataExtraction.py"
    click TL "https://github.com/SrujanGowda-10/WeatherApi-Data-Engineering-project/blob/main/DataTransformation.py"
    click ES "https://github.com/SrujanGowda-10/WeatherApi-Data-Engineering-project/blob/main/SnowFlake-AWS connection.sql"
    click CW "https://github.com/SrujanGowda-10/WeatherApi-Data-Engineering-project/blob/main/current_weather.sql"
    click FD "https://github.com/SrujanGowda-10/WeatherApi-Data-Engineering-project/blob/main/forecast_day_weather.sql"
    click FH "https://github.com/SrujanGowda-10/WeatherApi-Data-Engineering-project/blob/main/forecast_hour_weather.sql"
    click LT "https://github.com/SrujanGowda-10/WeatherApi-Data-Engineering-project/blob/main/location.sql"
    click CT "https://github.com/SrujanGowda-10/WeatherApi-Data-Engineering-project/blob/main/condition.sql"

    %% Legend
    subgraph Legend
        L1["External Systems"]:::external
        L2["AWS Services"]:::aws
        L3["Storage"]:::storage
        L4["Snowflake Components"]:::snowflake
        L5["Scheduler"]:::scheduler
    end
```
