Skip to content

comperem/weather-dashboard

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

Weather Dashboard

This project is a comprehensive weather data analysis system that combines a Streamlit web dashboard for visualization, a CLI tool (Meteorix) for data management, and a Discord bot for remote CLI operations. It focuses on analyzing Hurricane Milton wind patterns and provides interactive tools across multiple interfaces.

Table of Contents

  1. Web App Operations
  2. CLI Operations
  3. Discord Bot Operations
  4. Project Structure

Web App Operations

Dashboard

Setup Instructions

  1. Clone the repository and navigate to project folder:

    git clone https://github.com/Sang-Buster/weather-dashboard
    cd weather-dashboard
  2. Install uv first:

    # macOS/Linux
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
    # Windows
    powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
  3. Create a virtual environment:

    uv venv --python 3.12.1
  4. Activate the virtual environment:

    # macOS/Linux
    source .venv/bin/activate
    
    # Windows
    .venv\Scripts\activate
  5. Install the required packages:

    uv pip install -r requirements.txt
  6. Create a .streamlit/secrets.toml file:

    touch .streamlit/secrets.toml
  7. Add MongoDB URI to secrets.toml:

    [mongo]
    uri = "mongodb+srv://<usr>:<pwd>@<xxxxxx.mongodb.net>/?retryWrites=true&w=majority&appName=Cluster0"

Running the Web App

streamlit run src/app.py

CLI Operations

Banner

Setup Instructions

Option 1: Direct Python Command

Simply run the CLI tool directly with Python:

python src/cli.py --help

Option 2: Create CLI Alias (Optional)

For convenience, you can set up an alias named meteorix:

  1. Add Project Root to PYTHONPATH:

    # Get your project root path
    cd /path/to/weather-dashboard
    export PYTHONPATH="$(pwd):$PYTHONPATH"
  2. Create CLI Alias:

    # Create alias for the CLI tool
    alias meteorix="python src/cli.py"
  3. Make Changes Permanent: Add these lines to your shell configuration file (~/.bashrc or ~/.zshrc):

    REPO_DIR="/var/tmp/weather-dashboard"
    PYTHON_PATH="$REPO_DIR/.venv/bin/python"
    CLI_PATH="$REPO_DIR/src/cli.py"
    alias meteorix="$PYTHON_PATH $CLI_PATH"
  4. Apply Changes: Either:

    • Restart your terminal, or
    • Run: source ~/.bashrc (or source ~/.zshrc)
  5. Show Available Commands:

    meteorix --help

Basic Usage

The following commands work with either method (replace meteorix with python src/cli.py if not using the alias):

# Show whoami
meteorix who

# Show available date range and file statistics
meteorix info

# Upload data for a specific date
meteorix upload 2024_03_20

# Show first/last 5 rows of data
meteorix head 2024_03_20
meteorix tail 2024_03_20

Discord Bot Operations

Bot

Setup Instructions

  1. Add Bot Token to .streamlit/secrets.toml:

    [bot_token]
    token = "YOUR_BOT_TOKEN"
    
    [channel_id]
    channel_1_id = "YOUR_CHANNEL_ID_1"
    channel_2_id = "YOUR_CHANNEL_ID_2"
    # add more channels as needed
  2. Create Systemd Service File:

    sudo nano /etc/systemd/system/meteorix-bot.service
  3. Add the following configuration (adjust paths and username):

    [Unit]
    Description=Meteorix Discord Bot
    After=network.target
    
    [Service]
    Type=simple
    User=YOUR_USERNAME
    WorkingDirectory=/path/to/weather-dashboard
    Environment="PATH=/path/to/weather-dashboard/.venv/bin"
    ExecStart=/path/to/weather-dashboard/.venv/bin/python /path/to/weather-dashboard/src/meteorix.py
    Restart=always
    RestartSec=10
    
    [Install]
    WantedBy=multi-user.target
  4. Enable and Start the Service:

    # Enable the service to start on boot
    sudo systemctl enable meteorix-bot
    
    # Start the service
    sudo systemctl start meteorix-bot
    
    # Check service status
    sudo systemctl status meteorix-bot
  5. Common Service Commands:

    # Stop the bot
    sudo systemctl stop meteorix-bot
    
    # Restart the bot (after code changes)
    sudo systemctl restart meteorix-bot
    
    # View live logs
    sudo journalctl -u meteorix-bot -f

Basic Usage

  1. Mention Commands:

    @meteorix help          # Show all commands
    @meteorix info          # Show available date range
    @meteorix head          # Show earliest timestamp
    @meteorix tail          # Show latest timestamp
    
  2. Slash Commands:

    /help                # Show all commands
    /info                # Show available date range
    /head 2024_03_20     # Show first 5 rows of specific date
    /tail                # Show latest timestamp
    

Project Structure

📦weather-dashboard
 ┣ 📂.devcontainer               // Dev container configuration
 ┣ 📂.github                     // GitHub workflows and actions
 ┣ 📂.streamlit                  // Streamlit configuration files
 ┃ ┣ 📄config.toml                  // App configuration
 ┃ ┗ 📄secrets.toml                 // Secrets configuration
 ┣ 📂lib                         // Library and documentation files
 ┃ ┣ 📂fig                          // Plots and images
 ┃ ┣ 📄project_instructions.pdf
 ┃ ┣ 📄project_presentation.pdf
 ┃ ┣ 📄project_proposal.md
 ┃ ┗ 📄project_report.md
 ┣ 📂src                         // Source code files
 ┃ ┣ 📂cli_components               // CLI components
 ┃ ┣ 📂web_components               // Dashboard components
 ┃ ┣ 📂data                         // Data and analysis scripts
 ┃ ┣ 📄app.py                       // Web app main script
 ┃ ┣ 📄cli.py                       // CLI tool main script
 ┃ ┗ 📄meteorix.py                  // Discord bot script
 ┣ 📄.gitignore
 ┣ 📄LICENSE
 ┣ 📄README.md
 ┗ 📄requirements.txt            // Python dependencies

About

A Streamlit Dashboard for Weather/Wind Data Visualization

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%