Scripts Reference
Standalone scripts in the project root. Run with .venv/bin/python3 <script>.
Data Refresh Scripts
| Script | Description |
|---|---|
refresh_risk.py | Recomputes cluster risk scores using cluster_risk_rules.yaml |
refresh_scores.py | Recomputes health scores using health_rules.yaml |
refresh_unified.py | Runs the unified scoring pipeline (unified_rules.yaml) -- merges health + risk + alerts |
seed_issues.py | Seeds/rebuilds the issues table from current alerts and issue rules |
Alert Pipeline Scripts
| Script | Description |
|---|---|
load_lark_alerts.py | Parses Lark alert messages and inserts into alerts.lark_alerts. Core parser: parse_alert_card(msg) extracts fields from interactive card JSON. |
process_lark_page.py | Batch processor for saved MCP result files. Usage: .venv/bin/python3 process_lark_page.py <filepath> |
daily_alert_pipeline.py | Orchestrates the daily alert ingestion and processing pipeline |
alert_webhook.py | Webhook receiver for real-time alert ingestion |
populate_recommendations.py | Generates daily recommendations per alert type into alerts.alert_recommendations |
Reporting Scripts
| Script | Description |
|---|---|
build_digest_card.py | Builds a Lark digest card summarizing daily alert activity |
create_alerts_sheet.py | Exports alert data to a spreadsheet format |
Usage Examples
# Refresh all scores
.venv/bin/python3 refresh_unified.py
# Process a new page of Lark alerts
.venv/bin/python3 process_lark_page.py /path/to/mcp_result.json
# Run the daily pipeline
.venv/bin/python3 daily_alert_pipeline.py
# Seed issues from current alerts
.venv/bin/python3 seed_issues.py
Notes
- All scripts require an active SSH tunnel to StarRocks (or
STARROCKS_HOST=127.0.0.1with tunnel running) - Scripts read connection details from
.env process_lark_page.pyoutputs a summary line:msgs=N alerts=N range=X to Y has_more=boolfollowed byPAGE_TOKEN=...orDONE=true