# retro099/ml-projects architecture

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

- Interactive diagram: https://gitdiagram.com/retro099/ml-projects
- Repository: https://github.com/retro099/ml-projects

## Overview

This portfolio contains four independent ML demos. Users submit transaction features, customer details, Japanese text, or a document question and receive a prediction or grounded answer. The RAG project has the richest workflow: document preparation and Japanese-aware chunking feed vector retrieval, then an API coordinates retrieval and answer generation; a Streamlit interface is also documented. Fraud and sentiment load pretrained models, while churn trains its baseline from sample data at startup. Some RAG ingestion and UI wiring is documented but not shown in source excerpts, so those relationships are cited to the README or left unverified.

Main entry points: [`Japanese_RAG_Production/api.py`](https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/api.py) (Ask API), [`Japanese_RAG_Production/src/embedding_store.py`](https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/src/embedding_store.py) (Embedding Store), [`Japanese_RAG_Production/app/streamlit_app.py`](https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/app/streamlit_app.py) (Streamlit UI), [`Japanese_RAG_Production/src/ingestion.py`](https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/src/ingestion.py) (Document Ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_rag["Japanese Document Q&amp;A"]
  node_rag_ui["Streamlit UI<br/>[streamlit_app.py]"]
  node_rag_api["Ask API<br/>[api.py]"]
  node_pdfs["Company PDFs"]
  node_ingestion["Document Ingestion<br/>[ingestion.py]"]
  node_chunking["Japanese Chunking<br/>[chunking.py]"]
  node_chunk_import["Chunk Import"]
  node_vector_store[("Embedding Store<br/>[embedding_store.py]")]
  node_retriever["Retriever<br/>[retrieval.py]"]
  node_generator["Answer Generator<br/>[generation.py]"]
  node_groq{{"Groq LLM"}}
end

subgraph group_fraud["Credit Card Fraud"]
  node_fraud_app["Fraud Demo<br/>[app.py]"]
  node_fraud_model["Fraud Model"]
end

subgraph group_churn["Customer Churn"]
  node_churn_app["Churn Demo<br/>[app.py]"]
  node_churn_data["Sample Customers<br/>[Customer_Churn.csv]"]
end

subgraph group_sentiment["Japanese Sentiment"]
  node_sentiment_app["Sentiment Demo<br/>[app.py]"]
  node_sentiment_model{{"Hugging Face Model"}}
end

node_questioner(("Questioner"))
node_fraud_user(("Transaction User"))
node_churn_user(("Churn User"))
node_sentiment_user(("Text User"))

node_questioner -->|"asks question"| node_rag_ui
node_rag_ui -.->|"submits question"| node_rag_api
node_rag_api -->|"retrieves context"| node_retriever
node_rag_api -->|"requests answer"| node_generator
node_retriever -->|"queries vectors"| node_vector_store
node_generator -->|"generates answer"| node_groq
node_pdfs -.->|"provides documents"| node_ingestion
node_ingestion -.->|"chunks text"| node_chunking
node_chunking -.->|"embeds chunks"| node_vector_store
node_chunk_import -->|"adds chunks"| node_vector_store
node_fraud_user -->|"enters features"| node_fraud_app
node_fraud_app -->|"loads model"| node_fraud_model
node_churn_user -->|"enters details"| node_churn_app
node_churn_app -->|"reads training data"| node_churn_data
node_sentiment_user -->|"submits text"| node_sentiment_app
node_sentiment_app -->|"classifies text"| node_sentiment_model

click node_rag_ui "https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/app/streamlit_app.py"
click node_rag_api "https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/api.py"
click node_ingestion "https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/src/ingestion.py"
click node_chunking "https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/src/chunking.py"
click node_chunk_import "https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/ingest_chunks_jsonl.py"
click node_vector_store "https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/src/embedding_store.py"
click node_retriever "https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/src/retrieval.py"
click node_generator "https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/src/generation.py"
click node_fraud_app "https://github.com/retro099/ml-projects/blob/main/Credit_Card_Fraud_Detection/app.py"
click node_fraud_model "https://github.com/retro099/ml-projects/blob/main/Credit_Card_Fraud_Detection/artifacts/fraud_model_v1.joblib"
click node_churn_app "https://github.com/retro099/ml-projects/blob/main/Customer_Churn_Prediction/app.py"
click node_churn_data "https://github.com/retro099/ml-projects/blob/main/Customer_Churn_Prediction/data_sample/Customer_Churn.csv"
click node_sentiment_app "https://github.com/retro099/ml-projects/blob/main/Japanese_Sentiment_Analysis/app.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_rag_ui,node_rag_api,node_pdfs,node_ingestion,node_chunking,node_chunk_import,node_vector_store,node_retriever,node_generator,node_groq,node_fraud_user,node_churn_user,node_sentiment_user toneBlue
class node_fraud_app,node_fraud_model toneAmber
class node_churn_app,node_churn_data toneMint
class node_sentiment_app,node_sentiment_model toneRose
class node_questioner toneIndigo
```

## Components

### Japanese Document Q&A

- [Streamlit UI](https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/app/streamlit_app.py): `Japanese_RAG_Production/app/streamlit_app.py`
- [Ask API](https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/api.py): `Japanese_RAG_Production/api.py`
- **Company PDFs**
- [Document Ingestion](https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/src/ingestion.py): `Japanese_RAG_Production/src/ingestion.py`
- [Japanese Chunking](https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/src/chunking.py): `Japanese_RAG_Production/src/chunking.py`
- [Chunk Import](https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/ingest_chunks_jsonl.py): `Japanese_RAG_Production/ingest_chunks_jsonl.py`
- [Embedding Store](https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/src/embedding_store.py): `Japanese_RAG_Production/src/embedding_store.py`
- [Retriever](https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/src/retrieval.py): `Japanese_RAG_Production/src/retrieval.py`
- [Answer Generator](https://github.com/retro099/ml-projects/blob/main/Japanese_RAG_Production/src/generation.py): `Japanese_RAG_Production/src/generation.py`
- **Groq LLM**

### Credit Card Fraud

- [Fraud Demo](https://github.com/retro099/ml-projects/blob/main/Credit_Card_Fraud_Detection/app.py): `Credit_Card_Fraud_Detection/app.py`
- [Fraud Model](https://github.com/retro099/ml-projects/blob/main/Credit_Card_Fraud_Detection/artifacts/fraud_model_v1.joblib): `Credit_Card_Fraud_Detection/artifacts/fraud_model_v1.joblib`

### Customer Churn

- [Churn Demo](https://github.com/retro099/ml-projects/blob/main/Customer_Churn_Prediction/app.py): `Customer_Churn_Prediction/app.py`
- [Sample Customers](https://github.com/retro099/ml-projects/blob/main/Customer_Churn_Prediction/data_sample/Customer_Churn.csv): `Customer_Churn_Prediction/data_sample/Customer_Churn.csv`

### Japanese Sentiment

- [Sentiment Demo](https://github.com/retro099/ml-projects/blob/main/Japanese_Sentiment_Analysis/app.py): `Japanese_Sentiment_Analysis/app.py`
- **Hugging Face Model**

### Other components

- **Questioner**
- **Transaction User**
- **Churn User**
- **Text User**

## Connections

- Questioner → Streamlit UI: asks question (evidence: `README.md`)
- Streamlit UI → Ask API: submits question (evidence: `README.md`)
- Ask API → Retriever: retrieves context (evidence: `Japanese_RAG_Production/api.py`)
- Ask API → Answer Generator: requests answer (evidence: `Japanese_RAG_Production/api.py`)
- Retriever → Embedding Store: queries vectors (evidence: `Japanese_RAG_Production/src/retrieval.py`)
- Answer Generator → Groq LLM: generates answer (evidence: `Japanese_RAG_Production/src/generation.py`)
- Company PDFs → Document Ingestion: provides documents (evidence: `README.md`)
- Document Ingestion → Japanese Chunking: chunks text (evidence: `README.md`)
- Japanese Chunking → Embedding Store: embeds chunks (evidence: `README.md`)
- Chunk Import → Embedding Store: adds chunks (evidence: `Japanese_RAG_Production/ingest_chunks_jsonl.py`)
- Transaction User → Fraud Demo: enters features (evidence: `Credit_Card_Fraud_Detection/app.py`)
- Fraud Demo → Fraud Model: loads model (evidence: `Credit_Card_Fraud_Detection/app.py`)
- Churn User → Churn Demo: enters details (evidence: `Customer_Churn_Prediction/app.py`)
- Churn Demo → Sample Customers: reads training data (evidence: `Customer_Churn_Prediction/app.py`)
- Text User → Sentiment Demo: submits text (evidence: `Japanese_Sentiment_Analysis/app.py`)
- Sentiment Demo → Hugging Face Model: classifies text (evidence: `Japanese_Sentiment_Analysis/app.py`)
