diff --git a/scripts/mofin_health.py b/scripts/mofin_health.py index 0e1871c6..ef2bfaf2 100644 --- a/scripts/mofin_health.py +++ b/scripts/mofin_health.py @@ -19,6 +19,58 @@ CRON_FILES = [ "/home/hmo/.hermes/cron/jobs.json", ] +# 数据实体作用说明 +TABLES_DESC = { + "holdings": "当前持仓(权威源)", + "holding_strategies": "每只股票的完整策略参数", + "portfolio_summary": "总资产/现金/仓位汇总", + "portfolio_state": "组合状态快照(只读派生)", + "strategy_evaluations": "策略重评历史记录", + "strategy_feedback": "策略效果反馈", + "watchlist_stocks": "自选股列表", + "candidates": "潜力股候选池(小果扫描产出)", + "live_prices": "所有持仓+自选最新实时价", + "price_events": "价格区间突破事件日志", + "market_snapshots": "大盘指数快照(每10分)", + "sector_snapshots": "行业板块数据", + "sector_signals": "行业信号(趋势检测产出)", + "signal_news": "信号相关新闻", + "macro_raw_news": "宏观新闻原始数据", + "macro_context_log": "宏观上下文(大盘偏向/指数)", + "stocks": "全量股票代码", + "stock_daily": "日线行情", + "stock_weekly": "周线行情", + "stock_monthly": "月线行情", + "stock_fundamentals": "基本面数据(PE/PB)", + "stock_sectors": "股票行业映射", + "capital_flow_cache": "资金流缓存", + "xiaoguo_scan_tracker": "小果扫描跟踪", + "advice_timeline": "建议执行时间线", + "accuracy_stats": "建议准确率统计", + "todos": "自愈任务队列", + "health_check_log": "健康检查日志", + "cash_log": "资金变动记录", + "mtf_cache": "多周期均线缓存", + "state_meta": "系统状态元数据", +} + +JSON_DESC = { + "decisions.json": "策略决策(DB→JSON同步,兼容层)", + "portfolio.json": "持仓汇总(兼容层)", + "market.json": "市场概况数据", + "xiaoguo_insights.json": "小果分析洞察", + "candidate_pool.json": "潜力股候选池完整数据", + "zone_breach.json": "价格区间突破状态", + "strategy_staleness_report.json": "策略过期报告", + "alerts.json": "告警列表", + "macro_risk_state.json": "宏观风险状态(采集器写入)", + "capital_flow_cache.json": "资金流缓存", + "multi_tf_cache.json": "多周期均线缓存", + "macro_context.json": "宏观上下文JSON(旧兼容层)", + "system_inventory.json": "全量系统清单", + "mofin_health.json": "健康监控数据", +} + now = datetime.now() def load_cron_jobs(): @@ -164,6 +216,7 @@ def build_report(): orphan = (not has_input or not has_output) and not is_system and cnt > 0 entities.append({ "name": tname, + "desc": TABLES_DESC.get(tname, ""), "rows": cnt, "readers": readers[:10], "writers": writers[:10], @@ -182,6 +235,7 @@ def build_report(): size = jf.stat().st_size / 1024 json_entities.append({ "name": jf.name, + "desc": JSON_DESC.get(jf.name, ""), "size_kb": round(size, 1), "readers": readers[:10], "writers": [], # 难以精确追踪 diff --git a/static/mofin_health.html b/static/mofin_health.html new file mode 100644 index 00000000..0357d771 --- /dev/null +++ b/static/mofin_health.html @@ -0,0 +1,128 @@ + + +MoFin 健康监控 + + +

📊 MoFin 系统健康监控

+
加载中...
+
+
🌳 功能+流程
+
🗃️ 数据实体
+
+ +
+
+ + +