Skip to content

Fix/dashboard setup#1

Merged
sxhaakee merged 2 commits into
mainfrom
fix/dashboard-setup
Apr 16, 2026
Merged

Fix/dashboard setup#1
sxhaakee merged 2 commits into
mainfrom
fix/dashboard-setup

Conversation

@sxhaakee

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings April 16, 2026 05:06
@sxhaakee
sxhaakee merged commit 61b562f into main Apr 16, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces an end-to-end “NeuroMesh” demo: Python training + inference scripts for multiple sensor models, an orchestration pipeline that generates SITREPs via Mistral, and a new Next.js dashboard to visualize simulated scenarios.

Changes:

  • Add ML training scripts, generated datasets, and saved model artifacts (sklearn/joblib + Keras).
  • Add prediction modules plus a Python pipeline that runs all models and (optionally) calls Mistral to generate SITREPs.
  • Add a new Next.js (dashboard/) app with a scenario-driven “SimulationDashboard” UI and supporting configs/assets.

Reviewed changes

Copilot reviewed 27 out of 45 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
train/train_validator.py Trains and saves an IsolationForest “validator” model.
train/train_survivor.py Trains and saves a survivor presence LogisticRegression + scaler.
train/train_seismic.py Trains and saves a small 1D CNN seismic classifier.
train/train_gas.py Trains and saves a RandomForest gas hazard classifier.
predict/predict_validator.py Loads validator model and returns authenticity + anomaly metrics.
predict/predict_survivor.py Loads survivor model/scaler and returns survivor probability + urgency.
predict/predict_seismic.py Loads Keras model and returns event class + derived magnitude.
predict/predict_gas.py Loads gas model and returns hazard + severity classification.
predict/__pycache__/predict_validator.cpython-313.pyc Adds compiled Python bytecode (should not be committed).
predict/__pycache__/predict_survivor.cpython-313.pyc Adds compiled Python bytecode (should not be committed).
predict/__pycache__/predict_seismic.cpython-313.pyc Adds compiled Python bytecode (should not be committed).
predict/__pycache__/predict_gas.cpython-313.pyc Adds compiled Python bytecode (should not be committed).
pipeline/langgraph_pipeline.py Orchestrates running all predictors + generating a SITREP via Mistral.
models/validator_model.pkl Saved validator model artifact.
models/gas_model.pkl Saved gas model artifact.
models/seismic_model.keras Saved Keras seismic model artifact.
models/survivor_model.pkl Saved survivor model artifact.
models/survivor_scaler.pkl Saved StandardScaler artifact.
data/survivor_data.csv Generated training dataset for survivor model.
data/generate_survivor_data.py Script to generate survivor dataset.
data/generate_seismic_data.py Script to generate seismic dataset.
data/generate_gas_data.py Script to generate gas dataset.
dashboard/tsconfig.json Dashboard TypeScript configuration.
dashboard/src/components/SimulationDashboard.tsx Main interactive scenario/pipeline visualization component.
dashboard/src/app/page.tsx Dashboard home page wiring to SimulationDashboard.
dashboard/src/app/layout.tsx Dashboard root layout + metadata/fonts.
dashboard/src/app/globals.css Dashboard global styles + Tailwind import.
dashboard/src/app/favicon.ico Dashboard favicon asset.
dashboard/public/window.svg Default template asset.
dashboard/public/vercel.svg Default template asset.
dashboard/public/next.svg Default template asset.
dashboard/public/globe.svg Default template asset.
dashboard/public/file.svg Default template asset.
dashboard/postcss.config.mjs PostCSS config for Tailwind.
dashboard/package.json Dashboard dependencies/scripts.
dashboard/next.config.ts Dashboard Next.js config (turbopack root).
dashboard/eslint.config.mjs Dashboard ESLint configuration.
dashboard/README.md Default Next.js README for dashboard app.
dashboard/CLAUDE.md Agent pointer file.
dashboard/AGENTS.md Agent rules file.
dashboard/.gitignore Dashboard-local ignore rules.
README.md Replaces template README with NeuroMesh project overview + setup steps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
source venv/bin/activate # On Windows: venv\Scripts\activate

# Install AI dependencies
pip install scikit-learn tensorflow pandas numpy langgraph

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The setup instructions install unpinned Python dependencies, but the committed sklearn joblib artifacts embed _sklearn_version: 1.8.0. Loading these models can fail or behave differently under other sklearn versions. Consider adding a requirements.txt/lockfile (or at least pinning scikit-learn==1.8.0 etc.) to keep runtime compatible with the saved artifacts.

Suggested change
pip install scikit-learn tensorflow pandas numpy langgraph
# Pin scikit-learn to match the committed joblib artifacts (_sklearn_version: 1.8.0)
pip install scikit-learn==1.8.0 tensorflow pandas numpy langgraph

Copilot uses AI. Check for mistakes.
Comment thread train/train_validator.py
Comment on lines +1 to +3
import numpy as np
import pandas as pd
from sklearn.ensemble import IsolationForest

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pandas is imported but never used in this training script. Please remove the unused import to avoid lint warnings and reduce startup overhead.

Copilot uses AI. Check for mistakes.
Comment thread train/train_seismic.py
Comment on lines +3 to +6
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
import tensorflow as tf
from tensorflow import keras

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LabelEncoder and tensorflow as tf are imported but not used (the script only uses keras). Please remove unused imports to keep the module clean and avoid lint warnings.

Copilot uses AI. Check for mistakes.
Comment on lines +13 to +15
# Setup Mistral
client = MistralClient(api_key="H2z0gd6ieaMgUAAByONNnDtnmwLtonuW")

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coded Mistral API key is committed in source. This is a credential leak and will be harvested from git history; rotate the key immediately and load it from an environment variable/secret manager at runtime instead of in code.

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +11
import sys
sys.path.append('.')
from predict.predict_seismic import predict_seismic
from predict.predict_gas import predict_gas
from predict.predict_survivor import predict_survivor
from predict.predict_validator import predict_validator

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys.path.append('.') to make imports work is brittle (depends on current working directory) and can cause import shadowing. Prefer packaging the project (or using explicit relative imports / PYTHONPATH) so pipeline can import predict reliably in different execution environments.

Copilot uses AI. Check for mistakes.
Comment thread README.md
Comment on lines +14 to 36
## 🚨 Problem Statement / Idea

---
**What is the problem?**
During critical disasters (earthquakes, structural collapses, gas leaks), first responders are blinded by chaotic data, broken communication lines, and false alarms. Misallocating rescue teams to a "false alarm" while a real crisis unfolds costs lives.

### Instructions for the teams:
**Why is it important?**
The "Golden Day" (first 24 hours) is crucial for survival. Emergency response systems need filtered, validated, and highly accurate situation reports (SitReps) to deploy Urban Search and Rescue (USAR) teams safely and dynamically.

- Fork the Repository and name the forked repo in this convention: hacktofuture4-team_id (for eg: hacktofuture4-A01)
**Who are the target users?**
- National Disaster Response Force (NDRF) / FEMA
- Emergency Command Centers
- First Responders & Hazmat (CBRN) Teams

---

## Rules

- Work must be done ONLY in the forked repository
- Only Four Contributors are allowed.
- After 36 hours, Please make PR to the Main Repository. A Form will be sent to fill the required information.
- Do not copy code from other teams
- All commits must be from individual GitHub accounts
- Please provide meaningful commits for tracking.
- Do not share your repository with other teams
- Final submission must be pushed before the deadline
- Any violation may lead to disqualification

---
## 💡 Proposed Solution

# The Final README Template
**What are we building?**
**NeuroMesh** is a comprehensive hardware-software simulation platform representing a deployed mesh network of environmental sensors. It feeds raw telemetry (seismic vibrations, gas PPM, PIR survivor movement) into a multi-stage AI pipeline.

## Problem Statement / Idea
**How does it solve the problem?**
Raw data is processed by specialized ML models (CNNs for seismic, Random Forests for gas). Crucially, an **Isolation Forest** validator checks the aggregated outputs to flag hardware glitches or false alarms. If authenticated, an LLM (Mistral) generates an actionable, military-grade Situation Report (SitRep).

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR title suggests this is a dashboard setup fix, but the change set introduces a full ML training/prediction pipeline, model artifacts, and datasets as well. Consider updating the PR title/description to reflect the actual scope (or splitting into smaller PRs) so reviewers can assess risk and intent accurately.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +5
import numpy as np
import tensorflow as tf

model = tf.keras.models.load_model('models/seismic_model.keras')

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TensorFlow model is loaded at import time, so importing this module will raise immediately if models/seismic_model.keras is missing/corrupt (and it adds import-time latency). Consider lazy-loading the model inside predict_seismic (or behind a cached getter) with a clearer error message for missing artifacts.

Copilot uses AI. Check for mistakes.
Comment on lines +140 to +152
const runScenario = (key: keyof typeof SCENARIOS) => {
setActiveScenario(key);
setPipelineState('transmitting');
setResult(null);

// Staggered visual pipeline execution
setTimeout(() => setPipelineState('models'), 1500);
setTimeout(() => setPipelineState('validating'), 3000);
setTimeout(() => setPipelineState('llm'), 4500);
setTimeout(() => {
setResult(SCENARIOS[key].output);
setPipelineState('complete');
}, 6000);

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runScenario schedules multiple setTimeout calls but never clears them. If the component unmounts (or you later allow restarting a scenario) this can trigger state updates on an unmounted component. Consider storing the timeout IDs and clearing them in a useEffect cleanup (and/or cancelling pending timeouts when starting a new scenario).

Copilot uses AI. Check for mistakes.
Comment thread predict/predict_gas.py
Comment on lines +3 to +5

model = joblib.load('models/gas_model.pkl')
LABELS = ['safe', 'LPG_leak', 'smoke_fire']

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loading a joblib/pickle model at import time has two concrete downsides: (1) importing the module will crash with a FileNotFoundError if the model file isn't present, and (2) untrusted pickle/joblib files can execute arbitrary code during deserialization. Consider lazy-loading inside predict_gas with a clear error (and/or verifying the model artifact integrity / using a safer serialization format for distributed artifacts).

Copilot uses AI. Check for mistakes.
<ShieldCheck className={`w-8 h-8 ${(result?.validation.is_genuine_event ?? SCENARIOS[activeScenario].output.validation.is_genuine_event) ? 'text-emerald-400' : 'text-amber-400'}`} />
<div>
<h4 className="text-sm font-bold text-white uppercase tracking-wider">Isolation Forest Validation</h4>
<p className="text-xs text-slate-400 font-mono">Anomaly Score: {result?.validation.anomaly_score || SCENARIOS[activeScenario].output.validation.anomaly_score}</p>

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anomaly score display uses || for fallback; if the score is ever 0 it will incorrectly fall back to the scenario value. Use ?? here to only fall back on null/undefined.

Suggested change
<p className="text-xs text-slate-400 font-mono">Anomaly Score: {result?.validation.anomaly_score || SCENARIOS[activeScenario].output.validation.anomaly_score}</p>
<p className="text-xs text-slate-400 font-mono">Anomaly Score: {result?.validation.anomaly_score ?? SCENARIOS[activeScenario].output.validation.anomaly_score}</p>

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants