Files
yrtv/database/L3/schema.sql

134 lines
4.5 KiB
MySQL
Raw Normal View History

2026-01-24 02:48:56 +08:00
-- L3 Schema: Player Features Data Mart
-- Based on FeatureRDD.md
-- Granularity: One row per player (Aggregated Profile)
-- Note: Some features requiring complex Demo parsing (Phase 5) are omitted or reserved.
CREATE TABLE IF NOT EXISTS dm_player_features (
steam_id_64 TEXT PRIMARY KEY,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
total_matches INTEGER DEFAULT 0,
-- ==========================================
-- 0. Basic Features (Avg per match)
-- ==========================================
basic_avg_rating REAL,
basic_avg_kd REAL,
2026-01-26 02:13:06 +08:00
basic_avg_adr REAL,
2026-01-24 02:48:56 +08:00
basic_avg_kast REAL,
basic_avg_rws REAL,
basic_avg_headshot_kills REAL,
basic_headshot_rate REAL, -- Headshot kills / Total kills
basic_avg_first_kill REAL,
basic_avg_first_death REAL,
basic_first_kill_rate REAL, -- FK / (FK + FD) or FK / Opening Duels
basic_first_death_rate REAL,
basic_avg_kill_2 REAL,
basic_avg_kill_3 REAL,
basic_avg_kill_4 REAL,
basic_avg_kill_5 REAL,
basic_avg_assisted_kill REAL,
basic_avg_perfect_kill REAL,
basic_avg_revenge_kill REAL,
basic_avg_awp_kill REAL,
basic_avg_jump_count REAL,
2026-01-26 22:04:29 +08:00
basic_avg_mvps REAL,
basic_avg_plants REAL,
basic_avg_defuses REAL,
basic_avg_flash_assists REAL,
2026-01-24 02:48:56 +08:00
-- ==========================================
-- 1. STA: Stability & Time Series
-- ==========================================
sta_last_30_rating REAL,
sta_win_rating REAL,
sta_loss_rating REAL,
sta_rating_volatility REAL, -- StdDev of last 10 ratings
sta_time_rating_corr REAL, -- Correlation between match duration/time and rating
sta_fatigue_decay REAL, -- Perf drop in later matches of same day
-- ==========================================
-- 2. BAT: Battle / Duel Capabilities
-- ==========================================
bat_kd_diff_high_elo REAL,
bat_kd_diff_low_elo REAL,
bat_win_rate_vs_all REAL,
bat_avg_duel_win_rate REAL,
bat_avg_duel_freq REAL,
-- Distance based stats (Placeholder for Classic data)
bat_win_rate_close REAL,
bat_win_rate_mid REAL,
bat_win_rate_far REAL,
-- ==========================================
-- 3. HPS: High Pressure Scenarios
-- ==========================================
hps_clutch_win_rate_1v1 REAL,
hps_clutch_win_rate_1v2 REAL,
hps_clutch_win_rate_1v3_plus REAL,
hps_match_point_win_rate REAL,
hps_undermanned_survival_time REAL,
hps_pressure_entry_rate REAL, -- FK rate when team losing streak
hps_momentum_multikill_rate REAL, -- Multi-kill rate when team winning streak
hps_tilt_rating_drop REAL, -- Rating drop after getting knifed/BM'd
hps_clutch_rating_rise REAL, -- Rating rise after clutch
hps_comeback_kd_diff REAL,
hps_losing_streak_kd_diff REAL,
-- ==========================================
-- 4. PTL: Pistol Round Specialist
-- ==========================================
ptl_pistol_kills REAL, -- Avg per pistol round? Or Total? Usually Avg per match or Rate
ptl_pistol_multikills REAL,
ptl_pistol_win_rate REAL, -- Personal win rate in pistol rounds
ptl_pistol_kd REAL,
ptl_pistol_util_efficiency REAL,
-- ==========================================
-- 5. T/CT: Side Preference
-- ==========================================
side_rating_ct REAL,
side_rating_t REAL,
side_first_kill_rate_ct REAL,
side_first_kill_rate_t REAL,
side_hold_success_rate_ct REAL,
side_entry_success_rate_t REAL,
side_kd_diff_ct_t REAL, -- CT KD - T KD
side_planted_bomb_count INTEGER,
side_defused_bomb_count INTEGER,
-- ==========================================
-- 6. UTIL: Utility Usage
-- ==========================================
util_avg_nade_dmg REAL,
util_avg_flash_time REAL,
util_avg_flash_enemy REAL,
util_avg_flash_team REAL,
util_usage_rate REAL,
-- ==========================================
-- 7. Scores (0-100)
-- ==========================================
score_bat REAL,
score_sta REAL,
score_hps REAL,
score_ptl REAL,
score_tct REAL,
score_util REAL
2026-01-24 02:48:56 +08:00
);
-- Optional: Detailed per-match feature table for time-series analysis
CREATE TABLE IF NOT EXISTS fact_match_features (
match_id TEXT,
steam_id_64 TEXT,
-- Snapshots of the 6 dimensions for this specific match
basic_rating REAL,
sta_trend_pre_match REAL, -- Rating trend entering this match
bat_duel_win_rate REAL,
hps_clutch_success INTEGER,
ptl_performance_score REAL,
PRIMARY KEY (match_id, steam_id_64)
);