Skip to content

FlaPLeT is an open-source, full-stack web platform that enables end-to-end machine learning workflows for solar flare prediction through an interactive user interface. Its modular design also provides a general blueprint for AI-driven web services, such as large language model applications, where asynchronous task execution is essential.

License

Notifications You must be signed in to change notification settings

samresume/FlaPLeT

Repository files navigation

FlaPLeT: A Full-Stack Web Platform for End-to-End Time Series Data Processing and Machine Learning in Solar Flare Prediction

FlaPLeT Demo

📄 Publication Status

The paper describing this platform is currently under review at SoftwareX.

📹 Demo Videos

1. FlaPLeT Architecture Overview
This video presents a high-level explanation of the system architecture, including how Django, React, Celery, PostgreSQL, Redis, Nginx, and Waitress work together to support asynchronous machine learning workflows.

▶️ Watch on YouTube

2. FlaPLeT Functionality Demonstration
In this video, I log in to the FlaPLeT platform and demonstrate every feature: dataset upload, preprocessing, data augmentation (SMOTE), graph generation, ML training (GRU, SVM, Node2Vec), and downloading reports or models.

▶️ Watch on YouTube

🏗️ System Architecture

The platform, FlaPLeT (Flare Prediction by Learning from Time Series), is a modular web application designed for AI-based multivariate time series (MVTS) analysis and solar flare prediction.

The system architecture includes:

  • Frontend: Built with React JS and styled using Material UI (MUI), enabling a clean, responsive, and component-based user interface.
  • Backend: Developed using Django and served with Waitress, the backend handles routing, user sessions, RESTful APIs, and database interactions via Django's ORM.
  • Asynchronous Processing: Long-running tasks such as preprocessing, augmentation, graph construction, and ML training are managed by Celery with Redis as the message broker.
  • Web Server: NGINX serves static files, manages HTTPS traffic, and proxies API requests to the backend.
  • Database: All data, including users, datasets, and results, are stored in a PostgreSQL database, ensuring reliability, transactional integrity, and scalability.

This architecture ensures seamless interaction between components while supporting scalable, real-time AI workflows.

AI Web App Architecture

FlaPLeT Deployment Guide (Windows)

We explain how to set up FlaPLeT on a Windows server with a static IP mapped to a domain (e.g., flaplet.com).
It covers installing prerequisites, cloning the repo, configuring environment variables, running the backend/frontend, Celery workers, and deploying with Nginx.

0) Prerequisites

Install the following on Windows:

  • Python 3.9 – 3.11
    Download

  • Node.js 18+ (with npm)
    Download

  • PostgreSQL 13+
    Download

  • Redis (Windows build)
    Download

  • Nginx (Windows build)
    Download

    C:\nginx\           # Nginx installation folder
    
  • Git
    Download

  • Waitress (production WSGI server for Django)

    pip install waitress
    

1) Clone the Repository

cd C:\
git clone https://github.com/samresume/FlaPLeT.git

Folder layout after cloning:

C:\nginx\           # Nginx installation folder
C:\FlaPLeT\         # Cloned repo

2) IP and DNS Configuration

Your server must be reachable on the internet with a dedicated static IP address. All incoming HTTP (port 80) and HTTPS (port 443) traffic should be routed to your server.

  • If you are deploying on a local Windows machine at home or in an office, you need:
    1. An internet connection with a static IP address (assigned by your ISP).
    2. A router configured with port forwarding so that external traffic on ports 80 and 443 is forwarded to your computer’s local IP address.

In our case, we configured the router’s Port Forwarding rules so that external requests on ports 80 and 443 are forwarded to the local server at 192.168.0.50.

Port Forwarding rules

We also set up DNS records so that our domain flaplet.org (for the frontend) and api.flaplet.org (for the backend) both point to our static public IP address.

DNS records

⚠️ Important: If your ISP provides only a shared IP address (e.g., behind Carrier-Grade NAT), inbound requests from the internet cannot reach your network. To host a public-facing service, you must obtain a dedicated static IP from your ISP.

3) SSL Certificate

We purchased two SSL certificates from https://www.sslforfree.com/:

  • One for the frontend domain (flaplet.org)
  • One for the backend domain (api.flaplet.org)

These certificates provide the necessary key and certificate files that will be referenced in the Nginx configuration to enable HTTPS. Once configured, Nginx will terminate SSL/TLS and ensure that all traffic is served securely over HTTPS only.

4) Nginx Configuration

Please check the nginx_settings folder in this repository, which contains all required Nginx configuration files for both the frontend and backend.

  1. Replace the default C:\nginx\conf\nginx.conf with the one provided in nginx_settings\nginx.conf.
    Update this file as needed for your environment:
  • Domain name: flaplet.org
  • SSL certificate/key paths (e.g., change from C:/Users/eskan/CI/frontend/certs to C:/FlaPLeT/frontend/certs)
  • React build root (e.g., change from C:/Users/eskan/CI/frontend/build to C:/FlaPLeT/frontend/build)
  1. Create two folders in your Nginx root directory (C:\nginx\):
    C:\nginx\sites-available\
    C:\nginx\sites-enabled\
    
  2. Copy nginx_settings\webproject_nginx.conf into C:\nginx\sites-available\ and then place a copy into C:\nginx\sites-enabled\ . Update both as needed:
  • Domain name: api.flaplet.org
  • SSL certificate/key paths (e.g., change from C:/Users/eskan/CI/backend/certs to C:/FlaPLeT/backend/certs)
  • Backend root (e.g., change from C:/Users/eskan/CI/backend to C:/FlaPLeT/backend)

Also make sure these empty directories exist under C:\FlaPLeT\backend:

C:\FlaPLeT\backend\static
C:\FlaPLeT\backend\media
C:\FlaPLeT\backend\bugreport
C:\FlaPLeT\backend\datasets
C:\FlaPLeT\backend\file_results

5) Frontend (React)

Install the frontend dependencies and build the production bundle:

cd C:\FlaPLeT\frontend
npm install
npm run build

The compiled site will be in: C:\FlaPLeT\frontend\build\

6) Configure Backend Environment

Create or update C:\FlaPLeT\backend\backend\.env with the following (edit the values):

--- Django core ---
SECRET_KEY= replace-with-a-strong-random-string (generate using https://djecrety.ir/)
ALLOWED_HOSTS=localhost,127.0.0.1,api.flaplet.org,flaplet.org (change as necessary)

--- Database (PostgreSQL) ---
Create a database and user in PostgreSQL, then use those values here
DB_NAME=Database_NAME
DB_USER=Database_USER
DB_PASSWORD=Database_PASSWORD
DB_HOST=127.0.0.1
DB_PORT=5432

--- Redis / Celery ---
CELERY_BROKER_URL=redis://127.0.0.1:6379

--- Security: CSRF / CORS ---
CORS_ORIGIN_WHITELIST=https://flaplet.org,https://api.flaplet.org,https://139.64.170.58
CSRF_TRUSTED_ORIGINS=https://api.flaplet.org,https://flaplet.org,https://139.64.170.58

--- reCAPTCHA (server-side secret) ---
RECAPTCHA_SECRET=your-google-recaptcha-secret

7) Backend (Django)

Install backend dependencies and create a Django superuser (for the admin panel).
Always use the virtual environment so the correct packages (e.g., TensorFlow) are used.

cd C:\FlaPLeT\backend

# Create & activate a virtual environment
py -m venv venv
Set-ExecutionPolicy Unrestricted -Scope Process
.\venv\Scripts\activate

# Install Python dependencies into the venv
python -m pip install --upgrade pip
pip install -r requirements.txt

# Apply database migrations and create an admin user
python manage.py migrate
python manage.py createsuperuser

# Collect static files for production (Nginx will serve these)
python manage.py collectstatic --noinput

8) Running the Application

To bring the whole system online, you need to run three processes:

  1. Nginx (serves frontend and proxies requests to backend)
  2. Django backend (serves API at 127.0.0.1:8000)
  3. Celery worker (handles background tasks)

Open three separate Command Prompt / PowerShell windows and run:

1. Start Nginx

cd C:\nginx
start nginx

If Nginx is already running, reload instead of starting:

nginx -s reload
  1. Start Django backend
cd C:\FlaPLeT\backend
.\venv\Scripts\activate
python manage.py runserver
  1. Start Celery worker
cd C:\FlaPLeT\backend
.\venv\Scripts\activate
celery -A backend.celery worker --pool=solo -l info

🚀 Platform Features

The platform provides an end-to-end environment for working with multivariate time series (MVTS) data, tailored for solar flare prediction. It supports data upload, preprocessing, augmentation, graph-based transformation, and machine learning classification, all through an interactive web interface.

1. Dataset Upload & Preprocessing

  • Upload .pkl-format MVTS datasets (up to 25MB).
  • Missing value handling: mean imputation or sample removal.
  • Normalization options: z-score or min-max scaling.
  • Output: Processed dataset and downloadable summary report (data shape, label distribution, normalization stats).

2. Data Augmentation

  • Supports SMOTE and TimeGAN techniques.
  • Configurable parameters:
    • SMOTE: k_neighbors
    • TimeGAN: batch_size, num_layers, iteration
  • Output: Augmented dataset and detailed report (class distribution before/after, technique used, runtime).

3. Functional Network Generation

  • Constructs graph-based datasets via Pearson correlation analysis.
  • User-defined correlation threshold and max neighbors.
  • Output: Graph (.gpickle), labels, and report (nodes, edges, label stats).

4. Machine Learning Classification

  • GRU (for MVTS): customizable layers, hidden size, dropout, learning rate, batch size, epochs, and optimizer (Adam, SGD).
  • SVM (for MVTS): kernel selection and regularization strength.
  • Node2Vec + Logistic Regression (for graph data): embedding dimensions, walk length, window size, batch size, regularization penalty, solver, and iteration count.
  • Output: Trained model and evaluation report (Accuracy, Precision, Recall, AUC, TSS, HSS, GS).

5. Task Management & Reporting

  • All tasks run asynchronously and are tracked by status (running, completed, failed).
  • Users can view task metadata, download results, and manage completed tasks.

📑 Project Funding

This platform was developed as part of a research effort supported by the National Science Foundation (NSF) under the Office of Advanced Cyberinfrastructure (OAC), aimed at providing researchers with seamless access to time series data preprocessing, augmentation, and machine learning workflows through a user-friendly web interface.

  • Recipient Institution: Utah State University
  • Award Number: 2305781
  • Project Title: CRII: OAC: Cyberinfrastructure for Machine Learning on Multivariate Time Series Data and Functional Networks
  • Award Period: October 1, 2022 – May 31, 2025 (estimated)
  • Total Award Amount: $174,984.00

🤝 Collaboration & Contact

If you're working on a similar AI-based web application and are looking for guidance, collaboration, or have any questions, feel free to reach out.

📧 Contact: Sam EskandariNasab
✉️ Email: [email protected]

License

This project is licensed under the MIT License.

About

FlaPLeT is an open-source, full-stack web platform that enables end-to-end machine learning workflows for solar flare prediction through an interactive user interface. Its modular design also provides a general blueprint for AI-driven web services, such as large language model applications, where asynchronous task execution is essential.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published