How ayushsyntax/skycast works
Project Type and Purpose
• This is a monolithic full-stack web application built with Streamlit (Python) for real-time rainfall prediction.
• It bundles a trained XGBoost model (final_model.pkl), data preprocessing/EDA utilities (projectrain.py), and a Streamlit front-end (app.py).
File Structure
• Top-level files:
• app.py – main Streamlit application (UI, input handling, prediction, post-processing, display).
• projectrain.py – standalone scripts for exploratory data analysis and preprocessing.
• final_model.pkl – serialized XGBoost classifier.
• requirements.txt – Python dependencies (streamlit, xgboost, pandas, numpy, seaborn, matplotlib, etc.).
• venv/ – Python virtual environment.
• No separate frontend/backend directories: everything runs together under a single Python process.
• No external database: model and preprocessing run in memory, inputs come from user via Streamlit widgets.
Extract Architecture Insights from README
• Streamlit framework handles HTTP requests, renders UI, and calls Python functions.
• Input validation is built into app.py using Streamlit form controls and Python checks.
• Preprocessing and feature engineering: part built into app.py, extended by code in projectrain.py.
• Prediction stage: load final_model.pkl and run XGBoost inference.
• Post-processing: map probability → risk level → advice.
Main Components and Relationships
a. User Interface (Streamlit Frontend)
• Widgets: date picker, sliders, dropdowns.
• Submits input to the application logic.
b. Input Validation & Preprocessing Module
• Performs sanity checks on user data.
• Transforms date to cyclical features.
• Combines humidity, temperature range, cloud cover into engineered features.
c. Model Inference Engine
• Loads final_model.pkl once at startup.
• Executes XGBoost classifier to produce probability score.
d. Post-Processing & Output Renderer
• Applies risk thresholds.
• Chooses advice text.
• Renders probability, risk level, and advice back to UI.
e. Exploratory Data Analysis Toolkit (projectrain.py)
• Separate component for offline data analysis (not called in production flow).
• Uses pandas, numpy, seaborn, matplotlib to generate plots.
f. Runtime Environment
• Python 3.x in virtual environment.
• Streamlit’s HTTP server exposes app.py.
Architectural Patterns and Principles
• Monolithic modular design: clear separation between UI, preprocessing, inference, and post-processing, but all within one service.
• Single-process, event-driven I/O via Streamlit.
• Dependency injection at import time: final_model.pkl loaded once.
• Reusable EDA scripts kept separate to avoid runtime overhead.