Files
yrtv/docs/事件结构统一方案.md
2026-01-27 02:20:55 +08:00

44 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 3. 统一处理方案 (Unified Pipeline Strategy)
为了解决互斥问题,建议在 ETL `L2_Builder` 中建立一个 **中间抽象层 (Unified Event Model)**
### 3.1 统一事件结构
无论来源是 Classic 还是 Leetify都解析为以下标准结构存入 `fact_round_events`
```python
@dataclass
class UnifiedKillEvent:
match_id: str
round_num: int
tick: int = 0 # Web数据通常为0或估算
seconds: float = 0.0 # 回合开始后的秒数
attacker_steam_id: str
victim_steam_id: str
assister_steam_id: str = None
weapon: str
is_headshot: bool
is_wallbang: bool
is_blind: bool # Classic: attackerblind, Leetify: AttackerBlind
is_through_smoke: bool # Classic: throughsmoke, Leetify: ThroughSmoke
is_noscope: bool
# 空间数据 (Classic 有值, Leetify 为 Null)
attacker_pos: Tuple[float, float, float] = None
victim_pos: Tuple[float, float, float] = None
distance: float = None # 有坐标时自动计算
# 来源标记
source_type: str # 'classic' | 'leetify'
```
### 3.2 降级策略 (Graceful Degradation)
在 Web 前端或 API 层:
1. **热力图/站位分析**: 检查 `match.data_source_type`。如果是 `leetify`,显示“该场次不支持热力图数据”,或隐藏相关 Tab。
2. **距离分析**: 同上Leetify 场次不计入“平均交战距离”统计。
3. **经济分析**: Leetify 场次可提供更精准的经济走势图(因为有确切的 `Money` 字段Classic 场次可能需显示估算值。
### 3.3 推荐补充
对于 **反应时间**、**拉枪线**、**精确道具覆盖** 等 `❌` 项,建议列入 **Phase 5 (Demo Parser)** 开发计划,不强行通过 Web 数据拟合,以免误导用户。