# ta-wiah/aviator_predictor architecture

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

- Interactive diagram: https://gitdiagram.com/ta-wiah/aviator_predictor
- Repository: https://github.com/ta-wiah/aviator_predictor

## Overview

#### Purpose and entry point
This is a standalone Python desktop predictor for 1Win Aviator multipliers. It collects historical/current game data, trains an LSTM model, and displays ongoing predictions in a GUI. The executable entry point is `aviator_predictor.py`.

#### Application orchestration
`aviator_predictor.py` contains the application lifecycle and the README-named functional stages: history retrieval, current-state polling, model training, real-time prediction, and GUI startup. It is the primary integration boundary between network I/O, ML inference, and user interaction.

#### External data acquisition
Historical multiplier data and live Aviator state are obtained over HTTP through the `requests` dependency, represented by `fetch_history()` and `fetch_current_state()` in `aviator_predictor.py`. The upstream 1Win Aviator service is an external, runtime-dependent boundary; failures, response changes, or unavailable live data affect predictions directly.

#### ML training and prediction pipeline
The predictor uses TensorFlow/Keras LSTM neural-network capabilities to learn from prior multiplier sequences. `train_model()` in `aviator_predictor.py` prepares/trains the model, while `real_time_prediction()` applies the trained model to newly observed state. Numerical/tabular processing is supplied by NumPy and pandas.

#### Real-time control flow
The expected flow is: start application → fetch historical rounds → train or initialize the LSTM → open GUI → repeatedly fetch current multiplier state → generate/display the next-multiplier prediction. The GUI loop and live polling must coexist without blocking user interaction; both are coordinated from `aviator_predictor.py`.

#### Runtime and UI boundary
The project targets 64-bit Python 3.7–3.10. Its GUI requires Tk support on Ubuntu (`python3-tk`), making the desktop environment a material runtime dependency. Python package dependencies are declared in `requirements.txt`; the main runtime implementation remains `aviator_predictor.py`.

#### Delivery and automation
The repository is intentionally compact, with no separate service, API, or persistence layer visible. CI packaging/environment validation is configured at `.github/workflows/python-package-conda.yml`, but production use is launched locally via `python aviator_predictor.py`.

Main entry points: [`aviator_predictor.py`](https://github.com/ta-wiah/aviator_predictor/blob/main/aviator_predictor.py) (Application entry), [`requirements.txt`](https://github.com/ta-wiah/aviator_predictor/blob/main/requirements.txt) (Package dependencies), [`.github/workflows/python-package-conda.yml`](https://github.com/ta-wiah/aviator_predictor/blob/main/.github/workflows/python-package-conda.yml) (CI environment validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop Predictor"]
  node_entry["Application entry<br/>Python executable"]
  node_history["History retrieval<br/>fetch_history&#40;&#41;"]
  node_current["Live-state polling<br/>fetch_current_state&#40;&#41;"]
  node_training["LSTM training<br/>train_model&#40;&#41;"]
  node_prediction["Real-time prediction<br/>real_time_prediction&#40;&#41;"]
  node_gui["Prediction GUI<br/>Tk desktop UI"]
end

subgraph group_runtime["Runtime Dependencies"]
  node_aviator{{"1Win Aviator service<br/>external HTTP service"}}
  node_requests["HTTP client<br/>requests"]
  node_ml["LSTM framework<br/>TensorFlow/Keras"]
  node_data["Data processing<br/>NumPy / pandas"]
  node_desktop["Python desktop runtime<br/>Python 3.7–3.10 + Tk"]
end

subgraph group_delivery["Delivery"]
  node_requirements["Package dependencies<br/>requirements manifest<br/>[requirements.txt]"]
  node_ci["CI environment validation<br/>GitHub Actions workflow"]
end

node_entry -->|"starts"| node_history
node_entry -->|"trains or initializes"| node_training
node_entry -->|"opens"| node_gui
node_entry -->|"schedules polling"| node_current
node_history -->|"uses"| node_requests
node_current -->|"uses"| node_requests
node_requests -->|"HTTP requests"| node_aviator
node_history -->|"historical rounds"| node_training
node_data -->|"sequence preparation"| node_training
node_training -->|"builds and trains"| node_ml
node_training -->|"trained model"| node_prediction
node_current -->|"new state"| node_prediction
node_prediction -->|"runs inference"| node_ml
node_prediction -->|"prediction result"| node_gui
node_desktop -->|"executes locally"| node_entry
node_requirements -.->|"declares"| node_requests
node_requirements -.->|"declares"| node_ml
node_requirements -.->|"declares"| node_data
node_ci -->|"validates environment"| node_requirements

click node_entry "https://github.com/ta-wiah/aviator_predictor/blob/main/aviator_predictor.py"
click node_history "https://github.com/ta-wiah/aviator_predictor/blob/main/aviator_predictor.py"
click node_current "https://github.com/ta-wiah/aviator_predictor/blob/main/aviator_predictor.py"
click node_training "https://github.com/ta-wiah/aviator_predictor/blob/main/aviator_predictor.py"
click node_prediction "https://github.com/ta-wiah/aviator_predictor/blob/main/aviator_predictor.py"
click node_gui "https://github.com/ta-wiah/aviator_predictor/blob/main/aviator_predictor.py"
click node_requirements "https://github.com/ta-wiah/aviator_predictor/blob/main/requirements.txt"
click node_ci "https://github.com/ta-wiah/aviator_predictor/blob/main/.github/workflows/python-package-conda.yml"

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_entry,node_history,node_current,node_training,node_prediction,node_gui toneBlue
class node_aviator,node_requests,node_ml,node_data,node_desktop toneAmber
class node_requirements,node_ci toneMint
```

## Components

### Desktop Predictor

Local application lifecycle, data flow, and UI.

- [Application entry](https://github.com/ta-wiah/aviator_predictor/blob/main/aviator_predictor.py): Python executable · Coordinates startup, polling, prediction, and GUI lifecycle. · `aviator_predictor.py`
- [History retrieval](https://github.com/ta-wiah/aviator_predictor/blob/main/aviator_predictor.py): fetch_history() · Retrieves prior multiplier rounds over HTTP. · `aviator_predictor.py`
- [Live-state polling](https://github.com/ta-wiah/aviator_predictor/blob/main/aviator_predictor.py): fetch_current_state() · Polls the current Aviator multiplier state. · `aviator_predictor.py`
- [LSTM training](https://github.com/ta-wiah/aviator_predictor/blob/main/aviator_predictor.py): train_model() · Prepares historical sequences and trains the model. · `aviator_predictor.py`
- [Real-time prediction](https://github.com/ta-wiah/aviator_predictor/blob/main/aviator_predictor.py): real_time_prediction() · Applies the trained model to fresh observed state. · `aviator_predictor.py`
- [Prediction GUI](https://github.com/ta-wiah/aviator_predictor/blob/main/aviator_predictor.py): Tk desktop UI · Displays ongoing next-multiplier predictions without blocking polling. · `aviator_predictor.py`

### Runtime Dependencies

External services and local execution requirements.

- **1Win Aviator service**: external HTTP service · Supplies historical and live game data.
- **HTTP client**: requests
- **LSTM framework**: TensorFlow/Keras
- **Data processing**: NumPy / pandas
- **Python desktop runtime**: Python 3.7–3.10 + Tk · Requires 64-bit Python and Tk support for the local GUI.

### Delivery

Dependency declaration and CI validation.

- [Package dependencies](https://github.com/ta-wiah/aviator_predictor/blob/main/requirements.txt): requirements manifest · `requirements.txt`
- [CI environment validation](https://github.com/ta-wiah/aviator_predictor/blob/main/.github/workflows/python-package-conda.yml): GitHub Actions workflow · `.github/workflows/python-package-conda.yml`

## Connections

- Application entry → History retrieval: starts
- Application entry → LSTM training: trains or initializes
- Application entry → Prediction GUI: opens
- Application entry → Live-state polling: schedules polling
- History retrieval → HTTP client: uses
- Live-state polling → HTTP client: uses
- HTTP client → 1Win Aviator service: HTTP requests
- History retrieval → LSTM training: historical rounds
- Data processing → LSTM training: sequence preparation
- LSTM training → LSTM framework: builds and trains
- LSTM training → Real-time prediction: trained model
- Live-state polling → Real-time prediction: new state
- Real-time prediction → LSTM framework: runs inference
- Real-time prediction → Prediction GUI: prediction result
- Python desktop runtime → Application entry: executes locally
- Package dependencies → HTTP client: declares
- Package dependencies → LSTM framework: declares
- Package dependencies → Data processing: declares
- CI environment validation → Package dependencies: validates environment
