Snowflake-Labs/sfguide-intelligent-production-assistant-for-oil-gas
Python
Captured source
source ↗Snowflake-Labs/sfguide-intelligent-production-assistant-for-oil-gas
Language: Python
License: Apache-2.0
Stars: 0
Forks: 1
Open issues: 0
Created: 2026-02-16T18:56:13Z
Pushed: 2026-03-03T04:37:52Z
Default branch: main
Fork: no
Archived: no
README:
Intelligent Production Assistant (IPA) - Oil & Gas Operational Intelligence
> An AI-powered operational intelligence platform for oil & gas production, built entirely in Snowflake. This solution combines Cortex AI, Cortex Analyst, and Cortex Search to deliver autonomous monitoring of production assets, real-time safety compliance, and proactive cost optimization. From detecting rod pump failures to enforcing H2S permit limits, IPA transforms raw SCADA data into actionable insights through natural language conversations.
---
What You Build
This demo creates a complete operational intelligence platform with:
- 5-Page Streamlit Application: Mission Control dashboard, asset monitoring, safety inspection, and natural language Q&A
- 3 Detection Services: Sentinel (production), Guardian (safety), Fiscal (costs) - Python stored procedures using AI_COMPLETE
- 1 Cortex Agent (IPA_AGENT): True Cortex Agent combining text-to-SQL (Cortex Analyst) + document search (Cortex Search)
- Document Search Service: Cortex Search over technical documents for RAG capabilities
- Complete Data Pipeline: SCADA sensor data, work permits, financial records, and alert management
---
What You Will Learn
By implementing this demo, you'll gain hands-on experience with:
1. AI Complete: Generate AI insights using AI_COMPLETE() in Python stored procedures 2. Cortex Analyst: Build semantic models for natural language to SQL conversion 3. Cortex Search: Create vector search services for document retrieval (RAG) 4. Cortex Agents: Combine multiple AI tools (Analyst + Search) into unified agents 6. Streamlit in Snowflake: Deploy multi-page applications with Git integration 7. Python Stored Procedures: Automate workflows using Snowpark Python 8. Time-Series Analysis: Process and analyze industrial sensor data 9. Alert Management: Implement deduplication, severity classification, and workflow automation 10. Multimodal AI: Process both text and images using AI_COMPLETE() with vision models
---
Prerequisites
Snowflake Account Requirements
- Snowflake Account: Free trial account or existing account
- Role: ACCOUNTADMIN (for initial setup only - creates IPA_DEMO_ROLE for ongoing usage)
---
Quick Start
Step 1: Run Setup SQL
1. Open Snowsight SQL Worksheet 2. Copy and paste entire contents of `scripts/setup.sql` 3. Run the script as ACCOUNTADMIN
- Creates database with sample SCADA data
- Creates IPA_DEMO_ROLE with proper access controls
- Deploys Streamlit app from Git
- Creates and registers Cortex Agent
Step 2: Access the Application
1. In Snowsight, navigate to Projects → Streamlit 2. Click on Intelligent Production Assistant to open the application 3. Start exploring the 5-page dashboard!
*Note: After setup, users with IPA_DEMO_ROLE can access all demo features without requiring ACCOUNTADMIN privileges.*
Step 3: Access Snowflake Intelligence
Once deployed, you can also interact with the IPA_AGENT through Snowflake Intelligence:
1. Navigate to Snowsight → AI & ML → Snowflake Intelligence 2. Look for IPA_AGENT in your available agents 3. Ask questions like:
- "What are the current critical alerts?"
- "Show me H2S readings in Zone-B"
- "Find documents about Well-RP-05 failures"
4. The agent combines SQL queries (via Cortex Analyst) with document search (via Cortex Search)
---
Technical Implementation
The setup script automatically creates:
- Database: IPA with 3 schemas (SCADA_CORE, KNOWLEDGE_BASE, APP)
- Tables: Asset master, tags, time-series data, documents, alerts, permits, financials
- Detection Services: Sentinel, Guardian, Fiscal (Python stored procedures)
- Cortex Search: Document retrieval service for RAG
- Cortex Agent: IPA_AGENT (true Cortex Agent with text-to-SQL + document search)
- Streamlit App: 5-page dashboard deployed from Git
- Snowflake Intelligence: Agent registered for natural language queries
---
📱 Application Pages
1. 🖥️ Mission Control
Purpose: Unified command center showing alerts from all 3 detection services
Features:
- Real-time alert dashboard with critical/warning/info counts
- Scenario generators for demo storytelling (inject synthetic failures)
- "Run All Services" button to trigger Sentinel, Guardian, and Fiscal scans
- Live alert feed with acknowledge workflow
Demo Flow: 1. Click "🤖 Run All Services" to scan current conditions 2. Or click scenario buttons to inject test events:
- "🔴 Sentinel – Rod Pump Failure"
- "⚠️ Guardian – H₂S Safety Event"
- "💰 Fiscal – Cost Variance"
3. Review alerts in live feed, acknowledge critical items
---
2. 🛡️ Production Sentinel
Purpose: Asset-specific diagnostics for rod pumps and drilling rigs
Features:
- Asset selector with 4 key assets (RIG-9, WELL-A10, WELL-B03, WELL-RP-05)
- Rod Pump: Dynamometer chart shows failure patterns (fluid pound → rod part)
- Drilling Rig: ROP (Rate of Penetration) analysis detects NPT (Non-Productive Time)
- Time range selector (24h, 48h, 7 days)
- Active alert count per asset
Demo Flow: 1. Select "WELL-RP-05" → See rod pump failure pattern (load drops to zero) 2. Select "RIG-9" → See 6-hour NPT event (zero ROP) with business impact calculation 3. Click "Run All Services" on Mission Control → Sentinel generates alerts for these anomalies
---
3. 🦺 HSE Guardian
Purpose: Safety monitoring with permit-gas correlation
Features:
- Real-time H2S gas monitoring
- Active work permit tracking with safety constraints
- Permit violation detection (e.g., Hot Work Permit allows max 10 ppm H2S)
- Zone status map showing geographic zones
Demo Flow: 1. Observe H2S spike > 15 ppm in Zone-B (violates Hot Work Permit HWP-2026-001) 2. See "STOP WORK REQUIRED" alert 3. Review permit details and corrective actions 4. Check Guardian alert history
Value Prop: Prevents fatal H2S incidents through real-time safety barrier monitoring
---
4. 👁️ Visual Inspector
Purpose: AI-powered…
Excerpt shown — open the source for the full document.
Notability
notability 2.0/10Routine domain-specific guide repo