Wake up to AI-generated insights from your Supabase database every morning. This ZenML pipeline uses OpenAI's GPT-4 to analyze yesterday's database activity, compare it to historical trends, and deliver concise summaries directly to your Slack channels.
NightWatch transforms raw database activity into actionable business intelligence while you sleep. Instead of manually querying and analyzing your Supabase database each morning, let AI do the heavy lifting:
- 🔍 Automated Analysis: Daily summaries of your database activity delivered to Slack
- 📊 Trend Detection: Compare today's insights with historical patterns
- 🧠 AI-Powered: Leverage OpenAI's GPT-4 to extract meaningful insights
- 🔄 Version Control: Track changes over time with ZenML's data versioning
- ⚙️ Customizable: Adapt to your specific database schema and business needs
- 🚀 Production-Ready: Scale from local development to enterprise deployment
Transform support tickets and customer feedback into actionable insights. Identify common pain points, track sentiment trends, and prioritize product improvements based on real user feedback.
Monitor product performance, track inventory movements, and identify purchasing patterns. Get daily summaries of sales trends, popular products, and inventory alerts.
Understand what content resonates with your audience. NightWatch can analyze user engagement data to identify trending topics, popular creators, and content performance patterns.
Track user behavior, error rates, and performance metrics. Receive daily summaries highlighting potential issues before they become critical problems.
- Python 3.8+
- Access to a Supabase database
- OpenAI API key with GPT-4 access
- ZenML account (free tier available)
-
Install required packages:
pip install -r src/requirements.txt
-
Connect to your ZenML deployment:
zenml login https://your-zenml-instance.com
-
Set up your secrets:
# Configure Supabase connection zenml secret create supabase \ --supabase_url=$SUPABASE_URL \ --supabase_key=$SUPABASE_KEY # Configure OpenAI access zenml secret create openai --api_key=$OPENAPI_API_KEY
-
Run your first summary:
python run.py
Tailor the database queries to focus on the metrics that matter most to your business by modifying the importer
step:
# Example: Focus on high-priority customer tickets
query = """
SELECT * FROM support_tickets
WHERE created_at > NOW() - INTERVAL '24 hours'
AND priority = 'high'
"""
Customize how the AI interprets your data by adjusting the prompts in the generate_summary
step:
# Example: Focus on actionable insights
system_prompt = """
Analyze the database activity and identify:
1. Urgent issues requiring immediate attention
2. Emerging trends compared to previous periods
3. Recommended actions based on the data
"""
Configure where and how your summaries are delivered by customizing the alerter component.
NightWatch seamlessly scales from local development to production environments. Deploy on production-ready orchestrators:
-
Install required integrations:
zenml integration install gcp slack -y
-
Configure cloud storage:
zenml artifact-store register gcp_store -f gcp --path=gs://YOUR_BUCKET_PATH
-
Set up Slack notifications:
zenml alerter register slack_alerter -f slack \ --slack_token=YOUR_SLACK_TOKEN \ --default_slack_channel_id=YOUR_CHANNEL_ID
-
Register your production stack:
zenml stack register -a gcp_store -o default --alerter=slack_alerter --active
Set up GitHub Actions to run NightWatch automatically every day:
- Store your secrets in your GitHub repository
- Create a workflow file (
.github/workflows/nightwatch.yml
):
name: NightWatch Daily Summary
on:
schedule:
- cron: '0 5 * * *' # Run at 5 AM UTC daily
jobs:
run_pipeline:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Additional configuration steps...
- name: Run NightWatch
run: python run.py
NightWatch is built on ZenML, giving you access to a complete MLOps ecosystem:
- Orchestration: Scale with Airflow or Kubeflow
- Storage: Store artifacts on cloud storage
- Tracking: Monitor experiments with MLflow integration
- Alerting: Customize notifications through various channels
NightWatch handles sensitive database information with care:
- All credentials are stored securely using ZenML's secret management
- Data processing occurs within your infrastructure
- No sensitive data is shared with external services except for the specific prompts sent to OpenAI
Stop manually analyzing database logs and start your day with AI-powered insights that drive better business decisions.
Ready to wake up to smarter insights? Get started with NightWatch today!