# nehansa2003/aws_project architecture

> Architecture diagram of the GitHub repository nehansa2003/aws_project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nehansa2003/aws_project
- Repository: https://github.com/nehansa2003/aws_project

## Overview

ChurnIQ combines a model-development workflow with real-time churn scoring through a Streamlit dashboard and FastAPI service. Its repository also documents an AWS ingestion, validation, and Athena analytics pipeline; the Lambda validator is present, but cloud event wiring and most analytics infrastructure are documented rather than visible in sampled source. The graph distinguishes demonstrated calls from README-described or unverified integrations.

Main entry points: [`frontend_streamlit/app.py`](https://github.com/nehansa2003/aws_project/blob/main/frontend_streamlit/app.py) (Streamlit App), [`api/main.py`](https://github.com/nehansa2003/aws_project/blob/main/api/main.py) (REST API), [`src/predict.py`](https://github.com/nehansa2003/aws_project/blob/main/src/predict.py) (Inference Logic), [`lambda_function.py`](https://github.com/nehansa2003/aws_project/blob/main/lambda_function.py) (Lambda Validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["User Dashboard"]
  node_ui["Streamlit App<br/>[app.py]"]
  node_prediction_view["Prediction Form<br/>[prediction.py]"]
  node_overview_view["Overview<br/>[overview.py]"]
  node_about_view["About<br/>[about.py]"]
end

subgraph group_serving["Prediction Service"]
  node_api["REST API<br/>[main.py]"]
  node_schemas["Request Schemas<br/>[schemas.py]"]
end

subgraph group_ml["Machine Learning"]
  node_predict["Inference Logic<br/>[predict.py]"]
  node_model_artifact["Trained Model"]
  node_config["ML Configuration<br/>[config.py]"]
  node_data_processor["Data Preparation<br/>[data_processor.py]"]
  node_trainer["Model Training<br/>[model_trainer.py]"]
  node_evaluation["Model Evaluation<br/>[evaluate.py]"]
end

subgraph group_cloud["Cloud Data Analytics"]
  node_data_upload(("CSV Upload"))
  node_s3_raw[("S3 Raw Data")]
  node_lambda["Lambda Validation<br/>[lambda_function.py]"]
  node_s3_processed[("S3 Processed Lake")]
  node_cloudwatch[("CloudWatch Logs")]
  node_athena["Athena Analytics<br/>[queries.sql]"]
  node_s3_results[("Athena Results")]
end

node_user(("Customer Team"))

node_user -->|"uses"| node_ui
node_ui -->|"routes to"| node_prediction_view
node_ui -->|"routes to"| node_overview_view
node_ui -->|"routes to"| node_about_view
node_prediction_view -->|"POSTs prediction"| node_api
node_api -->|"validates request"| node_schemas
node_api -->|"calls inference"| node_predict
node_predict -->|"loads model"| node_model_artifact
node_data_processor -->|"reads settings"| node_config
node_trainer -->|"reads settings"| node_config
node_predict -->|"reads model path"| node_config
node_data_upload -.->|"uploads CSV"| node_s3_raw
node_s3_raw -.->|"triggers validation"| node_lambda
node_lambda -.->|"writes processed data"| node_s3_processed
node_lambda -.->|"writes logs"| node_cloudwatch
node_athena -.->|"queries lake"| node_s3_processed
node_athena -.->|"writes results"| node_s3_results
node_trainer -.->|"evaluates models"| node_evaluation

click node_ui "https://github.com/nehansa2003/aws_project/blob/main/frontend_streamlit/app.py"
click node_prediction_view "https://github.com/nehansa2003/aws_project/blob/main/frontend_streamlit/views/prediction.py"
click node_overview_view "https://github.com/nehansa2003/aws_project/blob/main/frontend_streamlit/views/overview.py"
click node_about_view "https://github.com/nehansa2003/aws_project/blob/main/frontend_streamlit/views/about.py"
click node_api "https://github.com/nehansa2003/aws_project/blob/main/api/main.py"
click node_schemas "https://github.com/nehansa2003/aws_project/blob/main/api/schemas.py"
click node_predict "https://github.com/nehansa2003/aws_project/blob/main/src/predict.py"
click node_model_artifact "https://github.com/nehansa2003/aws_project/blob/main/models/best_customer_churn_model.pkl"
click node_config "https://github.com/nehansa2003/aws_project/blob/main/src/config.py"
click node_data_processor "https://github.com/nehansa2003/aws_project/blob/main/src/data_processor.py"
click node_trainer "https://github.com/nehansa2003/aws_project/blob/main/src/model_trainer.py"
click node_evaluation "https://github.com/nehansa2003/aws_project/blob/main/src/evaluate.py"
click node_lambda "https://github.com/nehansa2003/aws_project/blob/main/lambda_function.py"
click node_athena "https://github.com/nehansa2003/aws_project/blob/main/sql/queries.sql"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui,node_prediction_view,node_overview_view,node_about_view toneBlue
class node_api,node_schemas toneAmber
class node_predict,node_model_artifact,node_config,node_data_processor,node_trainer,node_evaluation toneMint
class node_data_upload,node_s3_raw,node_lambda,node_s3_processed,node_cloudwatch,node_athena,node_s3_results toneRose
class node_user toneIndigo
```

## Components

### User Dashboard

- [Streamlit App](https://github.com/nehansa2003/aws_project/blob/main/frontend_streamlit/app.py): `frontend_streamlit/app.py`
- [Prediction Form](https://github.com/nehansa2003/aws_project/blob/main/frontend_streamlit/views/prediction.py): `frontend_streamlit/views/prediction.py`
- [Overview](https://github.com/nehansa2003/aws_project/blob/main/frontend_streamlit/views/overview.py): `frontend_streamlit/views/overview.py`
- [About](https://github.com/nehansa2003/aws_project/blob/main/frontend_streamlit/views/about.py): `frontend_streamlit/views/about.py`

### Prediction Service

- [REST API](https://github.com/nehansa2003/aws_project/blob/main/api/main.py): `api/main.py`
- [Request Schemas](https://github.com/nehansa2003/aws_project/blob/main/api/schemas.py): `api/schemas.py`

### Machine Learning

- [Inference Logic](https://github.com/nehansa2003/aws_project/blob/main/src/predict.py): `src/predict.py`
- [Trained Model](https://github.com/nehansa2003/aws_project/blob/main/models/best_customer_churn_model.pkl): `models/best_customer_churn_model.pkl`
- [ML Configuration](https://github.com/nehansa2003/aws_project/blob/main/src/config.py): `src/config.py`
- [Data Preparation](https://github.com/nehansa2003/aws_project/blob/main/src/data_processor.py): `src/data_processor.py`
- [Model Training](https://github.com/nehansa2003/aws_project/blob/main/src/model_trainer.py): `src/model_trainer.py`
- [Model Evaluation](https://github.com/nehansa2003/aws_project/blob/main/src/evaluate.py): `src/evaluate.py`

### Cloud Data Analytics

- **CSV Upload**
- **S3 Raw Data**
- [Lambda Validation](https://github.com/nehansa2003/aws_project/blob/main/lambda_function.py): `lambda_function.py`
- **S3 Processed Lake**
- **CloudWatch Logs**
- [Athena Analytics](https://github.com/nehansa2003/aws_project/blob/main/sql/queries.sql): `sql/queries.sql`
- **Athena Results**

### Other components

- **Customer Team**

## Connections

- Customer Team → Streamlit App: uses (evidence: `README.md`)
- Streamlit App → Prediction Form: routes to (evidence: `frontend_streamlit/app.py`)
- Streamlit App → Overview: routes to (evidence: `frontend_streamlit/app.py`)
- Streamlit App → About: routes to (evidence: `frontend_streamlit/app.py`)
- Prediction Form → REST API: POSTs prediction (evidence: `frontend_streamlit/views/prediction.py`)
- REST API → Request Schemas: validates request (evidence: `api/main.py`)
- REST API → Inference Logic: calls inference (evidence: `api/main.py`)
- Inference Logic → Trained Model: loads model (evidence: `src/predict.py`)
- Data Preparation → ML Configuration: reads settings (evidence: `src/data_processor.py`)
- Model Training → ML Configuration: reads settings (evidence: `src/model_trainer.py`)
- Inference Logic → ML Configuration: reads model path (evidence: `src/predict.py`)
- CSV Upload → S3 Raw Data: uploads CSV (evidence: `README.md`)
- S3 Raw Data → Lambda Validation: triggers validation (evidence: `README.md`)
- Lambda Validation → S3 Processed Lake: writes processed data (evidence: `README.md`)
- Lambda Validation → CloudWatch Logs: writes logs (evidence: `README.md`)
- Athena Analytics → S3 Processed Lake: queries lake (evidence: `README.md`)
- Athena Analytics → Athena Results: writes results (evidence: `README.md`)
- Model Training → Model Evaluation: evaluates models
