# jackoturner/ai_implementation_and_impact_module architecture

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

- Interactive diagram: https://gitdiagram.com/jackoturner/ai_implementation_and_impact_module
- Repository: https://github.com/jackoturner/ai_implementation_and_impact_module

## Overview

This is a three-class e-commerce review sentiment project: reviews are prepared and labeled, sampled for modeling, and served by a Linear SVM prediction API with a Streamlit dashboard. The principal runtime path is dashboard sign-in and review entry → API prediction → model result; analytics use a separate API endpoint. The README documents notebook-based model training and evaluation, but notebook internals were not sampled, so those links are omitted. The graph reflects shown calls and documented capabilities only.

Main entry points: [`app/ui/dashboard.py`](https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/app/ui/dashboard.py) (Streamlit dashboard), [`app/api/main.py`](https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/app/api/main.py) (FastAPI endpoints), [`src/data/prepare_dataset.py`](https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/src/data/prepare_dataset.py) (Dataset preparation), [`src/data/create_model_sample.py`](https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/src/data/create_model_sample.py) (Model sampling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_preparation["Review preparation"]
  node_raw_reviews[("Raw reviews")]
  node_raw_loader["Raw review loader"]
  node_cleaner["Review cleaner<br/>[clean_reviews.py]"]
  node_labeler["Sentiment labels<br/>[create_labels.py]"]
  node_preparer["Dataset preparation<br/>[prepare_dataset.py]"]
  node_clean_data[("Clean labeled data")]
  node_sampler["Model sampling"]
  node_model_sample[("Model sample")]
  node_training["Model training and evaluation"]
end

subgraph group_serving["Prediction service"]
  node_model_file[("Saved SVM pipeline")]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_predict["Sentiment prediction<br/>[main.py]"]
  node_metrics["Model metrics<br/>[metrics.py]"]
end

subgraph group_dashboard["Dashboard"]
  node_dashboard_app["Streamlit dashboard<br/>[dashboard.py]"]
  node_auth["Demo authentication<br/>[auth.py]"]
  node_result["Prediction and analytics"]
end

node_user(("Dashboard user"))

node_user -->|"uses"| node_dashboard_app
node_dashboard_app -->|"requires login"| node_auth
node_preparer -->|"loads"| node_raw_loader
node_preparer -->|"cleans"| node_cleaner
node_preparer -->|"labels"| node_labeler
node_raw_loader -.->|"reads"| node_raw_reviews
node_preparer -->|"writes"| node_clean_data
node_sampler -->|"reads"| node_clean_data
node_sampler -->|"writes"| node_model_sample
node_training -.->|"trains on"| node_model_sample
node_training -->|"saves"| node_model_file
node_api -->|"loads"| node_model_file
node_dashboard_app -->|"requests prediction"| node_api
node_api -->|"routes"| node_predict
node_predict -->|"returns sentiment"| node_result
node_dashboard_app -->|"renders"| node_result
node_dashboard_app -->|"requests metrics"| node_api
node_api -->|"serves metrics"| node_metrics
node_metrics -->|"provides analytics"| node_result

click node_raw_reviews "https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/data/raw/Video_Games_5.json.gz"
click node_raw_loader "https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/src/data/load_raw_reviews.py"
click node_cleaner "https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/src/data/clean_reviews.py"
click node_labeler "https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/src/data/create_labels.py"
click node_preparer "https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/src/data/prepare_dataset.py"
click node_clean_data "https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/data/processed/video_games_reviews_cleaned.csv"
click node_sampler "https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/src/data/create_model_sample.py"
click node_model_sample "https://github.com/jackoturner/ai_implementation_and_impact_module/tree/main/data/processed"
click node_training "https://github.com/jackoturner/ai_implementation_and_impact_module/tree/main/notebooks"
click node_dashboard_app "https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/app/ui/dashboard.py"
click node_auth "https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/app/ui/auth.py"
click node_api "https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/app/api/main.py"
click node_predict "https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/app/api/main.py"
click node_metrics "https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/app/api/metrics.py"

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_raw_reviews,node_raw_loader,node_cleaner,node_labeler,node_preparer,node_clean_data,node_sampler,node_model_sample,node_training,node_user toneBlue
class node_model_file,node_api,node_predict,node_metrics toneAmber
class node_dashboard_app,node_auth,node_result toneMint
```

## Components

### Review preparation

- [Raw reviews](https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/data/raw/Video_Games_5.json.gz): `data/raw/Video_Games_5.json.gz`
- [Raw review loader](https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/src/data/load_raw_reviews.py): `src/data/load_raw_reviews.py`
- [Review cleaner](https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/src/data/clean_reviews.py): `src/data/clean_reviews.py`
- [Sentiment labels](https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/src/data/create_labels.py): `src/data/create_labels.py`
- [Dataset preparation](https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/src/data/prepare_dataset.py): `src/data/prepare_dataset.py`
- [Clean labeled data](https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/data/processed/video_games_reviews_cleaned.csv): `data/processed/video_games_reviews_cleaned.csv`
- [Model sampling](https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/src/data/create_model_sample.py): `src/data/create_model_sample.py`
- [Model sample](https://github.com/jackoturner/ai_implementation_and_impact_module/tree/main/data/processed): `data/processed`
- [Model training and evaluation](https://github.com/jackoturner/ai_implementation_and_impact_module/tree/main/notebooks): `notebooks`

### Prediction service

- **Saved SVM pipeline**
- [FastAPI endpoints](https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/app/api/main.py): `app/api/main.py`
- [Sentiment prediction](https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/app/api/main.py): `app/api/main.py`
- [Model metrics](https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/app/api/metrics.py): `app/api/metrics.py`

### Dashboard

- [Streamlit dashboard](https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/app/ui/dashboard.py): `app/ui/dashboard.py`
- [Demo authentication](https://github.com/jackoturner/ai_implementation_and_impact_module/blob/main/app/ui/auth.py): `app/ui/auth.py`
- **Prediction and analytics**

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Streamlit dashboard: uses (evidence: `README.md`)
- Streamlit dashboard → Demo authentication: requires login (evidence: `app/ui/dashboard.py`)
- Dataset preparation → Raw review loader: loads (evidence: `src/data/prepare_dataset.py`)
- Dataset preparation → Review cleaner: cleans (evidence: `src/data/prepare_dataset.py`)
- Dataset preparation → Sentiment labels: labels (evidence: `src/data/prepare_dataset.py`)
- Raw review loader → Raw reviews: reads
- Dataset preparation → Clean labeled data: writes (evidence: `src/data/prepare_dataset.py`)
- Model sampling → Clean labeled data: reads (evidence: `src/data/create_model_sample.py`)
- Model sampling → Model sample: writes (evidence: `src/data/create_model_sample.py`)
- Model training and evaluation → Model sample: trains on (evidence: `README.md`)
- Model training and evaluation → Saved SVM pipeline: saves (evidence: `README.md`)
- FastAPI endpoints → Saved SVM pipeline: loads (evidence: `app/api/main.py`)
- Streamlit dashboard → FastAPI endpoints: requests prediction (evidence: `app/ui/dashboard.py`)
- FastAPI endpoints → Sentiment prediction: routes (evidence: `app/api/main.py`)
- Sentiment prediction → Prediction and analytics: returns sentiment (evidence: `app/api/main.py`)
- Streamlit dashboard → Prediction and analytics: renders (evidence: `app/ui/dashboard.py`)
- Streamlit dashboard → FastAPI endpoints: requests metrics (evidence: `app/ui/dashboard.py`)
- FastAPI endpoints → Model metrics: serves metrics (evidence: `app/api/main.py`)
- Model metrics → Prediction and analytics: provides analytics
