feat: Data Management tab — purge endpoints for all major data stores
Backend — new DELETE /purge-all endpoints:
- /api/logs/purge-all → truncate system_logs (immediate, no 30d wait)
- /api/reports/purge-all → cycle_reports + ai_reports
- /api/portfolio/purge-all → portfolio + trade_entry_prices
- /api/analytics/purge-all → pattern_score_history, regime_clusters,
pattern_embeddings, cycle_runs,
macro_regime_history, geo_alert_history
- /api/var/purge-all → var_snapshots + pnl_snapshots
- /api/pattern-lab/purge-all → backtest_lab_runs
Frontend — Config.tsx: new 'Data Management' tab
- PurgeButton component with inline double-confirm (click Purge → confirm)
- Shows table names affected + row count deleted
- 6 purge actions: Logs, AI Reports, Portfolio, Analytics, VaR, Pattern Lab
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -164,6 +164,17 @@ def get_run(run_id: str):
|
||||
return _row_to_dict(_get_run(run_id))
|
||||
|
||||
|
||||
@router.delete("/purge-all")
|
||||
def purge_all_runs():
|
||||
"""Delete all Pattern Lab runs."""
|
||||
conn = get_conn()
|
||||
conn.execute("DELETE FROM backtest_lab_runs")
|
||||
n = conn.total_changes
|
||||
conn.commit()
|
||||
conn.close()
|
||||
return {"deleted": n}
|
||||
|
||||
|
||||
@router.delete("/runs/{run_id}")
|
||||
def delete_run(run_id: str):
|
||||
conn = get_conn()
|
||||
|
||||
Reference in New Issue
Block a user