How stardeep18/cloudburst-prediction-in-western-ghats works
What this project is (type + purpose)
This is a 3-tier, data-driven predictive dashboard:
• Frontend: React (Vite) dashboard for uploading CSV data, tweaking “what-if” parameters, selecting prediction horizon, and visualizing results.
• Backend: Node.js/Express API that accepts prediction requests and invokes a Haskell program.
• Prediction engine: Haskell script that reads/processes meteorological data and outputs risk classification + probability.
• Data: CSV datasets (repo includes dataset/cloudburst_dataset_large.csv and public/sample_dataset.csv).
Frontend (root)
• index.html, vite.config.js, src/main.jsx, src/App.jsx
• UI components:
src/components/OverviewPanel.jsx
src/components/PredictionPanel.jsx
src/components/RiskMap.jsx
src/components/Sidebar.jsx
src/components/Toast.jsx
src/components/UploadPanel.jsx
src/components/VisualizationPanel.jsx
• Prediction client logic: src/lib/prediction.js
• Styling: tailwind.config.js, postcss.config.js, src/index.css
• Static sample data served by Vite: public/sample_dataset.csv
Backend (backend/)
• backend/server.js (Express server entry)
• backend/cloudburst.hs (Haskell engine source co-located with backend)
• backend/package.json (backend dependencies)
• backend/node_modules (runtime deps)
Datasets
• dataset/cloudburst_dataset_large.csv (likely used by engine or for testing)
• public/sample_dataset.csv (frontend demo data)
What the README adds (runtime behavior + interactions)
The README already states the logical pipeline:
Dataset → React Dashboard → Node API → Haskell Engine → Risk Probability → Dashboard Visualization
• Where data is transformed (CSV parsed client-side vs server-side)
• How Haskell is invoked (child process execution from Node)
• Request/response contracts (what frontend sends; what backend returns)
Shows Frontend, Backend API, Haskell Engine, Dataset stores as separate containers with protocols.
Split the frontend into key UI/prediction modules and split the backend into API + engine runner + output parser.
This repo is small enough that Level 2 + Level 3 can be on one page, but keep boundaries clear.
Frontend container (React + Vite + Tailwind)
Subcomponents (from src/components + src/lib):
• UploadPanel: file selection / load sample dataset
• PredictionPanel: horizon selection + sliders (“what-if” params)
• prediction.js: builds request payload + calls backend
• VisualizationPanel / RiskMap / OverviewPanel: renders probability, classification, indicators
• Toast: error/success feedback
• Sidebar: navigation / control grouping
Backend container (Node.js + Express)
Subcomponents (inferred from server.js responsibilities):
• Prediction API endpoint(s) (e.g., POST /predict)
• Haskell Runner: spawn/exec cloudburst.hs (or compiled binary)
• Input adapter: writes temp CSV / passes args/stdin to Haskell
• Output parser/mapper: converts Haskell stdout into JSON response
• CORS + validation: typical Express concerns (include if present in server.js)
Prediction Engine container (Haskell)
• CSV reader/parser
• Feature computations/statistics
• Weighted risk scoring model
• Classification + probability output formatter
Data sources
• User CSV upload (client-side file)
• Repo CSV dataset (dataset/*.csv)
• Public sample dataset (public/sample_dataset.csv)
User → React UI
• “Upload CSV”, “Set horizon”, “Adjust parameters”
React UI → Node API (HTTP/JSON)
• POST /predict
• Payload: { horizon, parameters, dataset } or { horizon, parameters, datasetRef }
• If dataset is large, show it as multipart upload or “CSV text in body” (choose based on actual implementation once you inspect src/lib/prediction.js and backend/server.js).
Node API → Haskell Engine (OS process invocation)
• Mechanism: child_process.spawn/exec
• Inputs: file path / stdin / CLI args
• Output: stdout (risk %, label, maybe factor contributions)
Haskell Engine → Node API
• returns computed results (stdout)
Node API → React UI (HTTP/JSON response)
• Response: { probability, riskLevel, explanation, metrics }