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.
-
Clone the repository and navigate to project folder:
git clone https://github.com/Sang-Buster/weather-dashboard cd weather-dashboard
-
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"
-
Create a virtual environment:
uv venv --python 3.12.1
-
Activate the virtual environment:
# macOS/Linux source .venv/bin/activate # Windows .venv\Scripts\activate
-
Install the required packages:
uv pip install -r requirements.txt
-
Create a
.streamlit/secrets.toml
file:touch .streamlit/secrets.toml
-
Add MongoDB URI to
secrets.toml
:[mongo] uri = "mongodb+srv://<usr>:<pwd>@<xxxxxx.mongodb.net>/?retryWrites=true&w=majority&appName=Cluster0"
streamlit run src/app.py
Simply run the CLI tool directly with Python:
python src/cli.py --help
For convenience, you can set up an alias named meteorix
:
-
Add Project Root to PYTHONPATH:
# Get your project root path cd /path/to/weather-dashboard export PYTHONPATH="$(pwd):$PYTHONPATH"
-
Create CLI Alias:
# Create alias for the CLI tool alias meteorix="python src/cli.py"
-
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"
-
Apply Changes: Either:
- Restart your terminal, or
- Run:
source ~/.bashrc
(orsource ~/.zshrc
)
-
Show Available Commands:
meteorix --help
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
-
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
-
Create Systemd Service File:
sudo nano /etc/systemd/system/meteorix-bot.service
-
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
-
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
-
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
-
Mention Commands:
@meteorix help # Show all commands @meteorix info # Show available date range @meteorix head # Show earliest timestamp @meteorix tail # Show latest timestamp
-
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
📦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