Snowflake-Labs/sfguide-ai-powered-predictive-grid-maintenance
Python
Captured source
source ↗Snowflake-Labs/sfguide-ai-powered-predictive-grid-maintenance
Language: Python
License: Apache-2.0
Stars: 10
Forks: 5
Open issues: 0
Created: 2026-01-08T18:37:40Z
Pushed: 2026-02-19T16:20:11Z
Default branch: main
Fork: no
Archived: no
README:
AI-Powered Energy Utilities Predictive Grid Maintenance
A complete predictive maintenance solution for power grid transformers built on Snowflake's AI Data Cloud.
Built By: Sri Subramanian, Senior Solution Engineer GitHub | LinkedIn
---
Overview
This solution demonstrates how utilities can leverage Snowflake to build an end-to-end predictive maintenance system combining:
- Structured Data: Sensor readings, asset metadata, maintenance history
- Unstructured Data: Technical manuals, maintenance logs, visual inspections
- Machine Learning: XGBoost failure prediction, Isolation Forest anomaly detection, RUL estimation
- Cortex Agents: Natural language queries via Snowflake Intelligence
- Real-time Dashboard: Streamlit-powered monitoring and alerting
Business Value
| Metric | Impact | |--------|--------| | Cost Avoidance | $400K+ per prevented failure | | SAIDI Improvement | Reduced outage duration | | Customer Protection | Proactive maintenance for 100 transformers | | ROI | 10x+ return on predictive maintenance investment |
---
Repository Structure
sfguide-ai-powered-predictive-grid-maintenance/ │ ├── deploy.sh # Main deployment script ├── clean.sh # Teardown script ├── run.sh # Runtime operations (validate, status, test) ├── requirements.txt # Python dependencies │ ├── scripts/ # SQL Scripts │ ├── 01_infrastructure_setup.sql │ ├── 02_structured_data_schema.sql │ ├── 03_unstructured_data_schema.sql │ ├── 04_ml_feature_engineering.sql │ ├── 05_ml_training_prep.sql │ ├── 06_ml_models.sql │ ├── 06b_update_score_assets.sql │ ├── 07_business_views.sql │ ├── 08_semantic_model.sql │ ├── 09_intelligence_agent.sql │ ├── 10_security_roles.sql │ ├── 10_streamlit_dashboard.sql │ ├── 11_load_structured_data.sql │ ├── 12_load_unstructured_data.sql │ ├── 13_populate_reference_data.sql │ ├── 14_generate_recent_sensor_data.sql │ └── 99_sample_queries.sql │ ├── streamlit/ # Streamlit dashboard │ ├── grid_reliability_dashboard.py │ └── environment.yml │ ├── data_generators/ # Data generation scripts │ ├── generate_asset_data.py │ ├── generate_maintenance_logs.py │ ├── generate_technical_manuals.py │ ├── generate_visual_inspections.py │ └── load_unstructured_full.py │ └── utilities/ # Utility scripts └── test_snowflake_connection.py
---
Prerequisites
- Snowflake Account with
ACCOUNTADMINrole (sign up for free trial) - Python 3.8+ (download)
- OS: macOS, Linux, or Windows (with WSL or Git Bash)
Verify installation:
python3 --version pip --version
---
Setup Guide
Step 1: Install Snowflake CLI
pip install snowflake-cli
Or download installer from Snowflake CLI releases
Verify: snow --version
---
Step 2: Configure Snowflake Connection
snow connection add
| Prompt | Value | |--------|-------| | Connection name | default | | Account | Your account identifier | | User | Your username | | Password | Your password | | Role | ACCOUNTADMIN | | Other prompts | Press Enter to skip |
> Find your account identifier in the URL: https://.snowflakecomputing.com
---
Step 3: Test Connection
snow connection test -c default
---
Step 4: Download Repository
Option A: Clone with Git
git clone https://github.com/Snowflake-Labs/sfguide-ai-powered-predictive-grid-maintenance.git
Navigate into the cloned folder:
cd sfguide-ai-powered-predictive-grid-maintenance
Option B: Download ZIP 1. Go to GitHub Repository 2. Click Code → Download ZIP 3. Extract the ZIP file
Navigate to the extracted folder:
cd /path/to/sfguide-ai-powered-predictive-grid-maintenance
> Note: Replace /path/to/ with the actual location where you cloned or extracted the repository (e.g., ~/Downloads/ or ~/Desktop/). All subsequent commands should be run from inside this folder.
---
Step 5: Deploy
chmod +x deploy.sh ./deploy.sh -c default
> Note: The deployment script automatically creates a Python virtual environment and installs all required dependencies. If dependency installation fails, you can manually run: > ``bash > pip install -r requirements.txt >
| Phase | Description | Duration | |-------|-------------|----------| | 1 | Infrastructure setup | ~1 min | | 2-3 | Data schemas | ~2 min | | 4-5 | ML pipeline | ~2 min | | 6 | Analytics views | ~1 min | | 7 | Data generation & loading | ~5 min | | 8 | ML training | ~3 min | | 9 | Streamlit dashboard | ~1 min |
Total: ~15-20 minutes
---
Step 6: Validate Deployment
./run.sh validate -c default
---
Step 7: Access the Solution
Streamlit App:
- Snowflake UI → Projects → Streamlit → GRID_RELIABILITY_DASHBOARD
- Role:
GRID_ANALYST,GRID_OPERATOR, orGRID_ADMIN
Cortex Agent (Snowflake Intelligence):
- Snowflake UI → Projects → Snowflake Intelligence → Grid Reliability Intelligence Agent
- Role:
GRID_ANALYST,GRID_OPERATOR, orGRID_ML_ENGINEER
---
What Gets Deployed
Database Schemas
| Schema | Purpose | |--------|---------| | RAW | Sensor readings, asset master, maintenance history | | UNSTRUCTURED | Technical manuals, maintenance logs, inspections | | FEATURES | Engineered ML features | | ML | Model registry, predictions, training data | | ANALYTICS | Business views, semantic model |
ML Models
| Model | Purpose | |-------|---------| | XGBoost Classifier | Failure probability prediction | | Isolation Forest | Anomaly detection | | Linear Regression | Remaining Useful Life (RUL) |
Risk Score
Risk Score = (Anomaly × 0.3) + (Failure_Prob × 0.5) + (RUL_Factor × 0.2) 0-40: Low (routine monitoring) 41-70: Medium (increased monitoring) 71-85: High (schedule maintenance) 86-100: Critical (immediate action)
---
Explore the Solution
Streamlit App Pages
| Page |…
Excerpt shown — open the source for the full document.
Notability
notability 2.0/10Low-stars guide repo, not notable