# jerwingubat/ldaxgboostdemo architecture

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

- Interactive diagram: https://gitdiagram.com/jerwingubat/ldaxgboostdemo
- Repository: https://github.com/jerwingubat/ldaxgboostdemo

## Overview

This repository is a Flask-based student academic-standing and attrition-risk prediction web app. Its main workflow accepts student details and school-environment feedback, transforms them into model features, predicts an academic-standing label, and renders guidance. A separate batch workflow accepts CSV files and returns row-level predictions. The three sampled app files appear to be alternative implementations; the graph centers the more complete app.py implementation and includes the documented-in-source maintenance pages. Model artifacts and templates are shown as dependencies. No README was provided, so capabilities beyond the sampled apps cannot be confirmed.

Main entry points: [`app.py`](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/app.py) (Single prediction), [`web_ready_xgboost_model.pkl`](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/web_ready_xgboost_model.pkl) (XGBoost classifier), [`target_encoder.pkl`](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/target_encoder.pkl) (Target label decoder), [`templates/index.html`](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/templates/index.html) (Student input form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web workflows"]
  node_app["Flask app<br/>[app.py]"]
  node_single["Single prediction<br/>[app.py]"]
  node_batch["Batch prediction<br/>[app.py]"]
  node_maintenance["Maintenance pages<br/>[app.py]"]
  node_csvfile["Uploaded CSV"]
end

subgraph group_features["Feature preparation"]
  node_encoding["Input encoding<br/>[app.py]"]
  node_textprep["Feedback preprocessing<br/>[app.py]"]
  node_topics["Topic extraction<br/>[app.py]"]
end

subgraph group_prediction["Prediction and guidance"]
  node_classifier["XGBoost classifier"]
  node_targetencoder["Target label decoder<br/>[target_encoder.pkl]"]
  node_recommendations["Risk guidance<br/>[app.py]"]
end

subgraph group_assets["Models and views"]
  node_form["Student input form<br/>[index.html]"]
  node_batchview["Batch results view<br/>[batch_predict.html]"]
  node_maintview["Maintenance view<br/>[maintenance.html]"]
  node_labelencoders["Feature label encoders<br/>[label_encoders.pkl]"]
  node_bigram["Bigram model<br/>[bigram_mod.pkl]"]
  node_trigram["Trigram model<br/>[trigram_mod.pkl]"]
  node_dictionary["Topic dictionary"]
  node_ldamodel["LDA model<br/>[lda_model.gensim]"]
end

node_user(("Student or staff"))

node_user -->|"submits request"| node_app
node_app -->|"renders"| node_form
node_app -->|"routes prediction"| node_single
node_app -->|"routes batch"| node_batch
node_app -->|"routes pages"| node_maintenance
node_single -->|"renders result"| node_form
node_batch -->|"renders results"| node_batchview
node_maintenance -->|"renders"| node_maintview
node_single -->|"encodes inputs"| node_encoding
node_single -->|"cleans feedback"| node_textprep
node_batch -->|"saves upload"| node_csvfile
node_batch -->|"encodes columns"| node_encoding
node_batch -->|"cleans feedback"| node_textprep
node_textprep -->|"applies"| node_bigram
node_textprep -->|"applies"| node_trigram
node_single -->|"extracts topics"| node_topics
node_batch -->|"extracts topics"| node_topics
node_topics -->|"creates bag of words"| node_dictionary
node_topics -->|"gets topic scores"| node_ldamodel
node_encoding -->|"uses"| node_labelencoders
node_single -->|"predicts label"| node_classifier
node_batch -->|"predicts rows"| node_classifier
node_single -->|"decodes prediction"| node_targetencoder
node_batch -->|"decodes predictions"| node_targetencoder
node_single -->|"selects guidance"| node_recommendations
node_classifier -->|"returns prediction"| node_single
node_classifier -->|"returns predictions"| node_batch

click node_app "https://github.com/jerwingubat/ldaxgboostdemo/blob/main/app.py"
click node_single "https://github.com/jerwingubat/ldaxgboostdemo/blob/main/app.py"
click node_batch "https://github.com/jerwingubat/ldaxgboostdemo/blob/main/app.py"
click node_maintenance "https://github.com/jerwingubat/ldaxgboostdemo/blob/main/app.py"
click node_form "https://github.com/jerwingubat/ldaxgboostdemo/blob/main/templates/index.html"
click node_batchview "https://github.com/jerwingubat/ldaxgboostdemo/blob/main/templates/batch_predict.html"
click node_maintview "https://github.com/jerwingubat/ldaxgboostdemo/blob/main/templates/maintenance.html"
click node_encoding "https://github.com/jerwingubat/ldaxgboostdemo/blob/main/app.py"
click node_textprep "https://github.com/jerwingubat/ldaxgboostdemo/blob/main/app.py"
click node_topics "https://github.com/jerwingubat/ldaxgboostdemo/blob/main/app.py"
click node_csvfile "https://github.com/jerwingubat/ldaxgboostdemo/tree/main/uploads"
click node_classifier "https://github.com/jerwingubat/ldaxgboostdemo/blob/main/web_ready_xgboost_model.pkl"
click node_targetencoder "https://github.com/jerwingubat/ldaxgboostdemo/blob/main/target_encoder.pkl"
click node_recommendations "https://github.com/jerwingubat/ldaxgboostdemo/blob/main/app.py"
click node_labelencoders "https://github.com/jerwingubat/ldaxgboostdemo/blob/main/label_encoders.pkl"
click node_bigram "https://github.com/jerwingubat/ldaxgboostdemo/blob/main/bigram_mod.pkl"
click node_trigram "https://github.com/jerwingubat/ldaxgboostdemo/blob/main/trigram_mod.pkl"
click node_dictionary "https://github.com/jerwingubat/ldaxgboostdemo/blob/main/lda_dictionary.gensim"
click node_ldamodel "https://github.com/jerwingubat/ldaxgboostdemo/blob/main/lda_model.gensim"

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_app,node_single,node_batch,node_maintenance,node_csvfile toneBlue
class node_encoding,node_textprep,node_topics toneAmber
class node_classifier,node_targetencoder,node_recommendations toneMint
class node_form,node_batchview,node_maintview,node_labelencoders,node_bigram,node_trigram,node_dictionary,node_ldamodel toneRose
class node_user toneIndigo
```

## Components

### Web workflows

- [Flask app](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/app.py): `app.py`
- [Single prediction](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/app.py): `app.py`
- [Batch prediction](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/app.py): `app.py`
- [Maintenance pages](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/app.py): `app.py`
- [Uploaded CSV](https://github.com/jerwingubat/ldaxgboostdemo/tree/main/uploads): `uploads`

### Feature preparation

- [Input encoding](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/app.py): `app.py`
- [Feedback preprocessing](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/app.py): `app.py`
- [Topic extraction](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/app.py): `app.py`

### Prediction and guidance

- [XGBoost classifier](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/web_ready_xgboost_model.pkl): `web_ready_xgboost_model.pkl`
- [Target label decoder](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/target_encoder.pkl): `target_encoder.pkl`
- [Risk guidance](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/app.py): `app.py`

### Models and views

- [Student input form](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/templates/index.html): `templates/index.html`
- [Batch results view](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/templates/batch_predict.html): `templates/batch_predict.html`
- [Maintenance view](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/templates/maintenance.html): `templates/maintenance.html`
- [Feature label encoders](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/label_encoders.pkl): `label_encoders.pkl`
- [Bigram model](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/bigram_mod.pkl): `bigram_mod.pkl`
- [Trigram model](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/trigram_mod.pkl): `trigram_mod.pkl`
- [Topic dictionary](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/lda_dictionary.gensim): `lda_dictionary.gensim`
- [LDA model](https://github.com/jerwingubat/ldaxgboostdemo/blob/main/lda_model.gensim): `lda_model.gensim`

### Other components

- **Student or staff**

## Connections

- Student or staff → Flask app: submits request (evidence: `app.py`)
- Flask app → Student input form: renders (evidence: `app.py`)
- Flask app → Single prediction: routes prediction (evidence: `app.py`)
- Flask app → Batch prediction: routes batch (evidence: `app.py`)
- Flask app → Maintenance pages: routes pages (evidence: `app.py`)
- Single prediction → Student input form: renders result (evidence: `app.py`)
- Batch prediction → Batch results view: renders results (evidence: `app.py`)
- Maintenance pages → Maintenance view: renders (evidence: `app.py`)
- Single prediction → Input encoding: encodes inputs (evidence: `app.py`)
- Single prediction → Feedback preprocessing: cleans feedback (evidence: `app.py`)
- Batch prediction → Uploaded CSV: saves upload (evidence: `app.py`)
- Batch prediction → Input encoding: encodes columns (evidence: `app.py`)
- Batch prediction → Feedback preprocessing: cleans feedback (evidence: `app.py`)
- Feedback preprocessing → Bigram model: applies (evidence: `app.py`)
- Feedback preprocessing → Trigram model: applies (evidence: `app.py`)
- Single prediction → Topic extraction: extracts topics (evidence: `app.py`)
- Batch prediction → Topic extraction: extracts topics (evidence: `app.py`)
- Topic extraction → Topic dictionary: creates bag of words (evidence: `app.py`)
- Topic extraction → LDA model: gets topic scores (evidence: `app.py`)
- Input encoding → Feature label encoders: uses (evidence: `app.py`)
- Single prediction → XGBoost classifier: predicts label (evidence: `app.py`)
- Batch prediction → XGBoost classifier: predicts rows (evidence: `app.py`)
- Single prediction → Target label decoder: decodes prediction (evidence: `app.py`)
- Batch prediction → Target label decoder: decodes predictions (evidence: `app.py`)
- Single prediction → Risk guidance: selects guidance (evidence: `app.py`)
- XGBoost classifier → Single prediction: returns prediction (evidence: `app.py`)
- XGBoost classifier → Batch prediction: returns predictions (evidence: `app.py`)
