# jb250101/info8665--airplane architecture

> Architecture diagram of the GitHub repository jb250101/info8665--airplane, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jb250101/info8665--airplane
- Repository: https://github.com/jb250101/info8665--airplane

## Overview

##### Main Components
a. Data Sources and Data Management:
- The “data/” directory holds datasets (Excel files, CSVs) and a database script. This indicates that raw and preprocessed data is maintained separately.
- The “docs/” directory—which, although it holds documentation, confirms the presence of a structured process and stakeholder communication.

b. Machine Learning Services:
- The “dev/” directory includes various Python modules for data collection, preprocessing, training, machine learning services, and predictions.
- The README explicitly describes three core Flask-based microservices:
- Preprocessing Service (handles data cleaning/encoding, accessible at port 5002)
- Training Service (trains the flight fare prediction model, accessible at port 5003)
- Prediction Service (returns flight fare predictions based on processed inputs, accessible at port 5004)

c. Model Artifacts:
- The “models/” directory contains the trained model (flight_fare_model.pkl), various encoders (for airline, destination, etc.), and a scaler. This is your ML model repository.

##### Visualizing Relationships and Interactions
- The Training Service uses processed data to train the model, then saves the resulting artifacts into the “models/” repository.
- The Prediction Service uses the trained model (by loading from “models/”) to generate predictions based on incoming requests with already-preprocessed data.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Data ingestion, data transformation, model training, and inference are isolated in their respective components.
- MLOps Pipeline: While not extremely detailed in the file tree, the README and structure imply integration of CI/CD workflows using GitHub and Azure Boards for deployment and collaboration. You could represent this as an external “CI/CD Pipeline” component that interacts with the code repository and deployment environment.

##### Final Elements
- Each component (Preprocessing Service, Training Service, Prediction Service, Data Storage, Model Repository, CI/CD pipeline) should be clearly labeled.
- Adding components or annotations that indicate where and how each service is deployed (e.g., noting the local ports: 5002, 5003, and 5004).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data and Documentation
    DataStorage["Data Storage (data/)"]:::dataFill
    Documentation["Documentation (docs/)"]:::docsFill

    %% External Systems
    CPipeline["CI/CD Pipeline"]:::externalFill
    Client["External Client"]:::externalFill

    %% Microservices Subgraph
    subgraph "Flask Microservices"
        Preprocessing["Preprocessing Service (port 5002)"]:::serviceFill
        Training["Training Service (port 5003)"]:::serviceFill
        Prediction["Prediction Service (port 5004)"]:::serviceFill
    end

    %% Model Artifacts
    ModelRepo["Model Repository (models/)"]:::modelFill

    %% Data Flow Arrows
    DataStorage -->|"raw_to_preprocessing"| Preprocessing
    Preprocessing -->|"to_training"| Training
    Preprocessing -->|"to_prediction"| Prediction
    Training -->|"update_model"| ModelRepo
    Prediction -->|"return_prediction"| Client

    %% CI/CD Deployments
    CPipeline -->|"deploys"| Preprocessing
    CPipeline -->|"deploys"| Training
    CPipeline -->|"deploys"| Prediction

    %% Click Events
    click DataStorage "https://github.com/jb250101/info8665--airplane/tree/main/data/"
    click Documentation "https://github.com/jb250101/info8665--airplane/tree/main/docs/"
    click Preprocessing "https://github.com/jb250101/info8665--airplane/blob/main/dev/preprocessing.py"
    click Training "https://github.com/jb250101/info8665--airplane/blob/main/dev/training_services.py"
    click Prediction "https://github.com/jb250101/info8665--airplane/blob/main/dev/prediction_service.py"
    click ModelRepo "https://github.com/jb250101/info8665--airplane/tree/main/models/"

    %% Styles
    classDef dataFill fill:#f9dcdc, stroke:#333, stroke-width:2px;
    classDef docsFill fill:#fef7e0, stroke:#333, stroke-width:2px;
    classDef serviceFill fill:#dce8fc, stroke:#333, stroke-width:2px;
    classDef modelFill fill:#d5e8d4, stroke:#333, stroke-width:2px;
    classDef externalFill fill:#ffe6cc, stroke:#333, stroke-width:2px;
```
