3.0.0 : Reconstructed Database System.
This commit is contained in:
@@ -1,251 +1,394 @@
|
||||
|
||||
-- L3 Schema: Player Features Data Mart
|
||||
-- Based on FeatureRDD.md
|
||||
-- ============================================================================
|
||||
-- L3 Schema: Player Features Data Mart (Version 2.0)
|
||||
-- ============================================================================
|
||||
-- Based on: L3_ARCHITECTURE_PLAN.md
|
||||
-- Design: 5-Tier Feature Hierarchy (CORE → TACTICAL → INTELLIGENCE → META → COMPOSITE)
|
||||
-- Granularity: One row per player (Aggregated Profile)
|
||||
-- Note: Some features requiring complex Demo parsing (Phase 5) are omitted or reserved.
|
||||
-- Total Columns: 207 features + 6 metadata = 213 columns
|
||||
-- ============================================================================
|
||||
|
||||
-- ============================================================================
|
||||
-- Main Table: dm_player_features
|
||||
-- ============================================================================
|
||||
CREATE TABLE IF NOT EXISTS dm_player_features (
|
||||
-- ========================================================================
|
||||
-- Metadata (6 columns)
|
||||
-- ========================================================================
|
||||
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,
|
||||
basic_avg_adr REAL,
|
||||
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,
|
||||
basic_avg_knife_kill REAL,
|
||||
basic_avg_zeus_kill REAL,
|
||||
basic_zeus_pick_rate REAL,
|
||||
basic_avg_mvps REAL,
|
||||
basic_avg_plants REAL,
|
||||
basic_avg_defuses REAL,
|
||||
basic_avg_flash_assists REAL,
|
||||
|
||||
-- ==========================================
|
||||
-- 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, -- Removed
|
||||
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, -- Currently calculated as K/D
|
||||
side_rating_t REAL,
|
||||
side_kd_ct REAL, -- Explicit K/D
|
||||
side_kd_t REAL,
|
||||
side_win_rate_ct REAL, -- Round Win %
|
||||
side_win_rate_t REAL,
|
||||
side_first_kill_rate_ct REAL,
|
||||
side_first_kill_rate_t REAL,
|
||||
side_kd_diff_ct_t REAL, -- CT KD - T KD
|
||||
|
||||
-- New Side Comparisons
|
||||
side_rating_diff_ct_t REAL,
|
||||
|
||||
-- ==========================================
|
||||
-- 6. Party Size Performance
|
||||
-- ==========================================
|
||||
party_1_win_rate REAL,
|
||||
party_1_rating REAL,
|
||||
party_1_adr REAL,
|
||||
total_matches INTEGER NOT NULL DEFAULT 0,
|
||||
total_rounds INTEGER NOT NULL DEFAULT 0,
|
||||
first_match_date INTEGER, -- Unix timestamp
|
||||
last_match_date INTEGER, -- Unix timestamp
|
||||
last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
party_2_win_rate REAL,
|
||||
party_2_rating REAL,
|
||||
party_2_adr REAL,
|
||||
-- ========================================================================
|
||||
-- TIER 1: CORE (41 columns)
|
||||
-- Direct aggregations from fact_match_players
|
||||
-- ========================================================================
|
||||
|
||||
party_3_win_rate REAL,
|
||||
party_3_rating REAL,
|
||||
party_3_adr REAL,
|
||||
-- Basic Performance (15 columns)
|
||||
core_avg_rating REAL DEFAULT 0.0,
|
||||
core_avg_rating2 REAL DEFAULT 0.0,
|
||||
core_avg_kd REAL DEFAULT 0.0,
|
||||
core_avg_adr REAL DEFAULT 0.0,
|
||||
core_avg_kast REAL DEFAULT 0.0,
|
||||
core_avg_rws REAL DEFAULT 0.0,
|
||||
core_avg_hs_kills REAL DEFAULT 0.0,
|
||||
core_hs_rate REAL DEFAULT 0.0, -- hs/total_kills
|
||||
core_total_kills INTEGER DEFAULT 0,
|
||||
core_total_deaths INTEGER DEFAULT 0,
|
||||
core_total_assists INTEGER DEFAULT 0,
|
||||
core_avg_assists REAL DEFAULT 0.0,
|
||||
core_kpr REAL DEFAULT 0.0, -- kills per round
|
||||
core_dpr REAL DEFAULT 0.0, -- deaths per round
|
||||
core_survival_rate REAL DEFAULT 0.0,
|
||||
|
||||
party_4_win_rate REAL,
|
||||
party_4_rating REAL,
|
||||
party_4_adr REAL,
|
||||
-- Match Stats (8 columns)
|
||||
core_win_rate REAL DEFAULT 0.0,
|
||||
core_wins INTEGER DEFAULT 0,
|
||||
core_losses INTEGER DEFAULT 0,
|
||||
core_avg_match_duration INTEGER DEFAULT 0, -- seconds
|
||||
core_avg_mvps REAL DEFAULT 0.0,
|
||||
core_mvp_rate REAL DEFAULT 0.0,
|
||||
core_avg_elo_change REAL DEFAULT 0.0,
|
||||
core_total_elo_gained REAL DEFAULT 0.0,
|
||||
|
||||
party_5_win_rate REAL,
|
||||
party_5_rating REAL,
|
||||
party_5_adr REAL,
|
||||
|
||||
-- ==========================================
|
||||
-- 7. Rating Distribution (Performance Tiers)
|
||||
-- ==========================================
|
||||
rating_dist_carry_rate REAL, -- > 1.5
|
||||
rating_dist_normal_rate REAL, -- 1.0 - 1.5
|
||||
rating_dist_sacrifice_rate REAL, -- 0.6 - 1.0
|
||||
rating_dist_sleeping_rate REAL, -- < 0.6
|
||||
|
||||
-- ==========================================
|
||||
-- 8. ELO Stratification (Performance vs ELO)
|
||||
-- ==========================================
|
||||
elo_lt1200_rating REAL,
|
||||
elo_1200_1400_rating REAL,
|
||||
elo_1400_1600_rating REAL,
|
||||
elo_1600_1800_rating REAL,
|
||||
elo_1800_2000_rating REAL,
|
||||
elo_gt2000_rating REAL,
|
||||
|
||||
-- ==========================================
|
||||
-- 9. More Side Stats (Restored)
|
||||
-- ==========================================
|
||||
side_kast_ct REAL,
|
||||
side_kast_t REAL,
|
||||
side_rws_ct REAL,
|
||||
side_rws_t REAL,
|
||||
side_first_death_rate_ct REAL,
|
||||
side_first_death_rate_t REAL,
|
||||
side_multikill_rate_ct REAL,
|
||||
side_multikill_rate_t REAL,
|
||||
side_headshot_rate_ct REAL,
|
||||
side_headshot_rate_t REAL,
|
||||
side_defuses_ct REAL,
|
||||
side_plants_t REAL,
|
||||
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,
|
||||
score_eco REAL,
|
||||
score_pace REAL,
|
||||
|
||||
-- ==========================================
|
||||
-- 8. ECO: Economy Efficiency
|
||||
-- ==========================================
|
||||
eco_avg_damage_per_1k REAL,
|
||||
eco_rating_eco_rounds REAL,
|
||||
eco_kd_ratio REAL,
|
||||
eco_avg_rounds REAL,
|
||||
|
||||
-- ==========================================
|
||||
-- 9. PACE: Aggression & Trade
|
||||
-- ==========================================
|
||||
pace_avg_time_to_first_contact REAL,
|
||||
pace_trade_kill_rate REAL,
|
||||
pace_opening_kill_time REAL,
|
||||
pace_avg_life_time REAL,
|
||||
rd_phase_kill_early_share REAL,
|
||||
rd_phase_kill_mid_share REAL,
|
||||
rd_phase_kill_late_share REAL,
|
||||
rd_phase_death_early_share REAL,
|
||||
rd_phase_death_mid_share REAL,
|
||||
rd_phase_death_late_share REAL,
|
||||
rd_phase_kill_early_share_t REAL,
|
||||
rd_phase_kill_mid_share_t REAL,
|
||||
rd_phase_kill_late_share_t REAL,
|
||||
rd_phase_kill_early_share_ct REAL,
|
||||
rd_phase_kill_mid_share_ct REAL,
|
||||
rd_phase_kill_late_share_ct REAL,
|
||||
rd_phase_death_early_share_t REAL,
|
||||
rd_phase_death_mid_share_t REAL,
|
||||
rd_phase_death_late_share_t REAL,
|
||||
rd_phase_death_early_share_ct REAL,
|
||||
rd_phase_death_mid_share_ct REAL,
|
||||
rd_phase_death_late_share_ct REAL,
|
||||
rd_firstdeath_team_first_death_rounds INTEGER,
|
||||
rd_firstdeath_team_first_death_win_rate REAL,
|
||||
rd_invalid_death_rounds INTEGER,
|
||||
rd_invalid_death_rate REAL,
|
||||
rd_pressure_kpr_ratio REAL,
|
||||
rd_pressure_perf_ratio REAL,
|
||||
rd_pressure_rounds_down3 INTEGER,
|
||||
rd_pressure_rounds_normal INTEGER,
|
||||
rd_matchpoint_kpr_ratio REAL,
|
||||
rd_matchpoint_perf_ratio REAL,
|
||||
rd_matchpoint_rounds INTEGER,
|
||||
rd_comeback_kill_share REAL,
|
||||
rd_comeback_rounds INTEGER,
|
||||
rd_trade_response_10s_rate REAL,
|
||||
rd_weapon_top_json TEXT,
|
||||
rd_roundtype_split_json TEXT,
|
||||
map_stability_coef REAL
|
||||
-- Weapon Stats (12 columns)
|
||||
core_avg_awp_kills REAL DEFAULT 0.0,
|
||||
core_awp_usage_rate REAL DEFAULT 0.0,
|
||||
core_avg_knife_kills REAL DEFAULT 0.0,
|
||||
core_avg_zeus_kills REAL DEFAULT 0.0,
|
||||
core_zeus_buy_rate REAL DEFAULT 0.0,
|
||||
core_top_weapon TEXT,
|
||||
core_top_weapon_kills INTEGER DEFAULT 0,
|
||||
core_top_weapon_hs_rate REAL DEFAULT 0.0,
|
||||
core_weapon_diversity REAL DEFAULT 0.0,
|
||||
core_rifle_hs_rate REAL DEFAULT 0.0,
|
||||
core_pistol_hs_rate REAL DEFAULT 0.0,
|
||||
core_smg_kills_total INTEGER DEFAULT 0,
|
||||
|
||||
-- Objective Stats (6 columns)
|
||||
core_avg_plants REAL DEFAULT 0.0,
|
||||
core_avg_defuses REAL DEFAULT 0.0,
|
||||
core_avg_flash_assists REAL DEFAULT 0.0,
|
||||
core_plant_success_rate REAL DEFAULT 0.0,
|
||||
core_defuse_success_rate REAL DEFAULT 0.0,
|
||||
core_objective_impact REAL DEFAULT 0.0,
|
||||
|
||||
-- ========================================================================
|
||||
-- TIER 2: TACTICAL (44 columns)
|
||||
-- Multi-table JOINs, conditional aggregations
|
||||
-- ========================================================================
|
||||
|
||||
-- Opening Impact (8 columns)
|
||||
tac_avg_fk REAL DEFAULT 0.0,
|
||||
tac_avg_fd REAL DEFAULT 0.0,
|
||||
tac_fk_rate REAL DEFAULT 0.0,
|
||||
tac_fd_rate REAL DEFAULT 0.0,
|
||||
tac_fk_success_rate REAL DEFAULT 0.0,
|
||||
tac_entry_kill_rate REAL DEFAULT 0.0,
|
||||
tac_entry_death_rate REAL DEFAULT 0.0,
|
||||
tac_opening_duel_winrate REAL DEFAULT 0.0,
|
||||
|
||||
-- Multi-Kill (6 columns)
|
||||
tac_avg_2k REAL DEFAULT 0.0,
|
||||
tac_avg_3k REAL DEFAULT 0.0,
|
||||
tac_avg_4k REAL DEFAULT 0.0,
|
||||
tac_avg_5k REAL DEFAULT 0.0,
|
||||
tac_multikill_rate REAL DEFAULT 0.0,
|
||||
tac_ace_count INTEGER DEFAULT 0,
|
||||
|
||||
-- Clutch Performance (10 columns)
|
||||
tac_clutch_1v1_attempts INTEGER DEFAULT 0,
|
||||
tac_clutch_1v1_wins INTEGER DEFAULT 0,
|
||||
tac_clutch_1v1_rate REAL DEFAULT 0.0,
|
||||
tac_clutch_1v2_attempts INTEGER DEFAULT 0,
|
||||
tac_clutch_1v2_wins INTEGER DEFAULT 0,
|
||||
tac_clutch_1v2_rate REAL DEFAULT 0.0,
|
||||
tac_clutch_1v3_plus_attempts INTEGER DEFAULT 0,
|
||||
tac_clutch_1v3_plus_wins INTEGER DEFAULT 0,
|
||||
tac_clutch_1v3_plus_rate REAL DEFAULT 0.0,
|
||||
tac_clutch_impact_score REAL DEFAULT 0.0,
|
||||
|
||||
-- Utility Mastery (13 columns)
|
||||
tac_util_flash_per_round REAL DEFAULT 0.0,
|
||||
tac_util_smoke_per_round REAL DEFAULT 0.0,
|
||||
tac_util_molotov_per_round REAL DEFAULT 0.0,
|
||||
tac_util_he_per_round REAL DEFAULT 0.0,
|
||||
tac_util_usage_rate REAL DEFAULT 0.0,
|
||||
tac_util_nade_dmg_per_round REAL DEFAULT 0.0,
|
||||
tac_util_nade_dmg_per_nade REAL DEFAULT 0.0,
|
||||
tac_util_flash_time_per_round REAL DEFAULT 0.0,
|
||||
tac_util_flash_enemies_per_round REAL DEFAULT 0.0,
|
||||
tac_util_flash_efficiency REAL DEFAULT 0.0,
|
||||
tac_util_impact_score REAL DEFAULT 0.0,
|
||||
tac_util_zeus_equipped_count INTEGER DEFAULT 0,
|
||||
-- tac_util_zeus_kills REMOVED
|
||||
|
||||
-- Economy Efficiency (8 columns)
|
||||
tac_eco_dmg_per_1k REAL DEFAULT 0.0,
|
||||
tac_eco_kpr_eco_rounds REAL DEFAULT 0.0,
|
||||
tac_eco_kd_eco_rounds REAL DEFAULT 0.0,
|
||||
tac_eco_kpr_force_rounds REAL DEFAULT 0.0,
|
||||
tac_eco_kpr_full_rounds REAL DEFAULT 0.0,
|
||||
tac_eco_save_discipline REAL DEFAULT 0.0,
|
||||
tac_eco_force_success_rate REAL DEFAULT 0.0,
|
||||
tac_eco_efficiency_score REAL DEFAULT 0.0,
|
||||
|
||||
-- ========================================================================
|
||||
-- TIER 3: INTELLIGENCE (53 columns)
|
||||
-- Advanced analytics on fact_round_events
|
||||
-- ========================================================================
|
||||
|
||||
-- High IQ Kills (9 columns)
|
||||
int_wallbang_kills INTEGER DEFAULT 0,
|
||||
int_wallbang_rate REAL DEFAULT 0.0,
|
||||
int_smoke_kills INTEGER DEFAULT 0,
|
||||
int_smoke_kill_rate REAL DEFAULT 0.0,
|
||||
int_blind_kills INTEGER DEFAULT 0,
|
||||
int_blind_kill_rate REAL DEFAULT 0.0,
|
||||
int_noscope_kills INTEGER DEFAULT 0,
|
||||
int_noscope_rate REAL DEFAULT 0.0,
|
||||
int_high_iq_score REAL DEFAULT 0.0,
|
||||
|
||||
-- Timing Analysis (12 columns)
|
||||
int_timing_early_kills INTEGER DEFAULT 0,
|
||||
int_timing_mid_kills INTEGER DEFAULT 0,
|
||||
int_timing_late_kills INTEGER DEFAULT 0,
|
||||
int_timing_early_kill_share REAL DEFAULT 0.0,
|
||||
int_timing_mid_kill_share REAL DEFAULT 0.0,
|
||||
int_timing_late_kill_share REAL DEFAULT 0.0,
|
||||
int_timing_avg_kill_time REAL DEFAULT 0.0,
|
||||
int_timing_early_deaths INTEGER DEFAULT 0,
|
||||
int_timing_early_death_rate REAL DEFAULT 0.0,
|
||||
int_timing_aggression_index REAL DEFAULT 0.0,
|
||||
int_timing_patience_score REAL DEFAULT 0.0,
|
||||
int_timing_first_contact_time REAL DEFAULT 0.0,
|
||||
|
||||
-- Pressure Performance (9 columns)
|
||||
int_pressure_comeback_kd REAL DEFAULT 0.0,
|
||||
int_pressure_comeback_rating REAL DEFAULT 0.0,
|
||||
int_pressure_losing_streak_kd REAL DEFAULT 0.0,
|
||||
int_pressure_matchpoint_kpr REAL DEFAULT 0.0,
|
||||
int_pressure_clutch_composure REAL DEFAULT 0.0,
|
||||
int_pressure_entry_in_loss REAL DEFAULT 0.0,
|
||||
int_pressure_performance_index REAL DEFAULT 0.0,
|
||||
int_pressure_big_moment_score REAL DEFAULT 0.0,
|
||||
int_pressure_tilt_resistance REAL DEFAULT 0.0,
|
||||
|
||||
-- Position Mastery (14 columns)
|
||||
int_pos_site_a_control_rate REAL DEFAULT 0.0,
|
||||
int_pos_site_b_control_rate REAL DEFAULT 0.0,
|
||||
int_pos_mid_control_rate REAL DEFAULT 0.0,
|
||||
int_pos_favorite_position TEXT,
|
||||
int_pos_position_diversity REAL DEFAULT 0.0,
|
||||
int_pos_rotation_speed REAL DEFAULT 0.0,
|
||||
int_pos_map_coverage REAL DEFAULT 0.0,
|
||||
int_pos_lurk_tendency REAL DEFAULT 0.0,
|
||||
int_pos_site_anchor_score REAL DEFAULT 0.0,
|
||||
int_pos_entry_route_diversity REAL DEFAULT 0.0,
|
||||
int_pos_retake_positioning REAL DEFAULT 0.0,
|
||||
int_pos_postplant_positioning REAL DEFAULT 0.0,
|
||||
int_pos_spatial_iq_score REAL DEFAULT 0.0,
|
||||
int_pos_avg_distance_from_teammates REAL DEFAULT 0.0,
|
||||
|
||||
-- Trade Network (8 columns)
|
||||
int_trade_kill_count INTEGER DEFAULT 0,
|
||||
int_trade_kill_rate REAL DEFAULT 0.0,
|
||||
int_trade_response_time REAL DEFAULT 0.0,
|
||||
int_trade_given_count INTEGER DEFAULT 0,
|
||||
int_trade_given_rate REAL DEFAULT 0.0,
|
||||
int_trade_balance REAL DEFAULT 0.0,
|
||||
int_trade_efficiency REAL DEFAULT 0.0,
|
||||
int_teamwork_score REAL DEFAULT 0.0,
|
||||
|
||||
-- ========================================================================
|
||||
-- TIER 4: META (52 columns)
|
||||
-- Long-term patterns and meta-features
|
||||
-- ========================================================================
|
||||
|
||||
-- Stability (8 columns)
|
||||
meta_rating_volatility REAL DEFAULT 0.0,
|
||||
meta_recent_form_rating REAL DEFAULT 0.0,
|
||||
meta_win_rating REAL DEFAULT 0.0,
|
||||
meta_loss_rating REAL DEFAULT 0.0,
|
||||
meta_rating_consistency REAL DEFAULT 0.0,
|
||||
meta_time_rating_correlation REAL DEFAULT 0.0,
|
||||
meta_map_stability REAL DEFAULT 0.0,
|
||||
meta_elo_tier_stability REAL DEFAULT 0.0,
|
||||
|
||||
-- Side Preference (14 columns)
|
||||
meta_side_ct_rating REAL DEFAULT 0.0,
|
||||
meta_side_t_rating REAL DEFAULT 0.0,
|
||||
meta_side_ct_kd REAL DEFAULT 0.0,
|
||||
meta_side_t_kd REAL DEFAULT 0.0,
|
||||
meta_side_ct_win_rate REAL DEFAULT 0.0,
|
||||
meta_side_t_win_rate REAL DEFAULT 0.0,
|
||||
meta_side_ct_fk_rate REAL DEFAULT 0.0,
|
||||
meta_side_t_fk_rate REAL DEFAULT 0.0,
|
||||
meta_side_ct_kast REAL DEFAULT 0.0,
|
||||
meta_side_t_kast REAL DEFAULT 0.0,
|
||||
meta_side_rating_diff REAL DEFAULT 0.0,
|
||||
meta_side_kd_diff REAL DEFAULT 0.0,
|
||||
meta_side_preference TEXT,
|
||||
meta_side_balance_score REAL DEFAULT 0.0,
|
||||
|
||||
-- Opponent Adaptation (12 columns)
|
||||
meta_opp_vs_lower_elo_rating REAL DEFAULT 0.0,
|
||||
meta_opp_vs_similar_elo_rating REAL DEFAULT 0.0,
|
||||
meta_opp_vs_higher_elo_rating REAL DEFAULT 0.0,
|
||||
meta_opp_vs_lower_elo_kd REAL DEFAULT 0.0,
|
||||
meta_opp_vs_similar_elo_kd REAL DEFAULT 0.0,
|
||||
meta_opp_vs_higher_elo_kd REAL DEFAULT 0.0,
|
||||
meta_opp_elo_adaptation REAL DEFAULT 0.0,
|
||||
meta_opp_stomping_score REAL DEFAULT 0.0,
|
||||
meta_opp_upset_score REAL DEFAULT 0.0,
|
||||
meta_opp_consistency_across_elos REAL DEFAULT 0.0,
|
||||
meta_opp_rank_resistance REAL DEFAULT 0.0,
|
||||
meta_opp_smurf_detection REAL DEFAULT 0.0,
|
||||
|
||||
-- Map Specialization (10 columns)
|
||||
meta_map_best_map TEXT,
|
||||
meta_map_best_rating REAL DEFAULT 0.0,
|
||||
meta_map_worst_map TEXT,
|
||||
meta_map_worst_rating REAL DEFAULT 0.0,
|
||||
meta_map_diversity REAL DEFAULT 0.0,
|
||||
meta_map_pool_size INTEGER DEFAULT 0,
|
||||
meta_map_specialist_score REAL DEFAULT 0.0,
|
||||
meta_map_versatility REAL DEFAULT 0.0,
|
||||
meta_map_comfort_zone_rate REAL DEFAULT 0.0,
|
||||
meta_map_adaptation REAL DEFAULT 0.0,
|
||||
|
||||
-- Session Pattern (8 columns)
|
||||
meta_session_avg_matches_per_day REAL DEFAULT 0.0,
|
||||
meta_session_longest_streak INTEGER DEFAULT 0,
|
||||
meta_session_weekend_rating REAL DEFAULT 0.0,
|
||||
meta_session_weekday_rating REAL DEFAULT 0.0,
|
||||
meta_session_morning_rating REAL DEFAULT 0.0,
|
||||
meta_session_afternoon_rating REAL DEFAULT 0.0,
|
||||
meta_session_evening_rating REAL DEFAULT 0.0,
|
||||
meta_session_night_rating REAL DEFAULT 0.0,
|
||||
|
||||
-- ========================================================================
|
||||
-- TIER 5: COMPOSITE (11 columns)
|
||||
-- Weighted composite scores (0-100)
|
||||
-- ========================================================================
|
||||
score_aim REAL DEFAULT 0.0,
|
||||
score_clutch REAL DEFAULT 0.0,
|
||||
score_pistol REAL DEFAULT 0.0,
|
||||
score_defense REAL DEFAULT 0.0,
|
||||
score_utility REAL DEFAULT 0.0,
|
||||
score_stability REAL DEFAULT 0.0,
|
||||
score_economy REAL DEFAULT 0.0,
|
||||
score_pace REAL DEFAULT 0.0,
|
||||
score_overall REAL DEFAULT 0.0,
|
||||
tier_classification TEXT,
|
||||
tier_percentile REAL DEFAULT 0.0,
|
||||
|
||||
-- Foreign key constraint
|
||||
FOREIGN KEY (steam_id_64) REFERENCES dim_players(steam_id_64)
|
||||
);
|
||||
|
||||
-- Optional: Detailed per-match feature table for time-series analysis
|
||||
CREATE TABLE IF NOT EXISTS fact_match_features (
|
||||
match_id TEXT,
|
||||
-- Indexes for query performance
|
||||
CREATE INDEX IF NOT EXISTS idx_dm_player_features_rating ON dm_player_features(core_avg_rating DESC);
|
||||
CREATE INDEX IF NOT EXISTS idx_dm_player_features_matches ON dm_player_features(total_matches DESC);
|
||||
CREATE INDEX IF NOT EXISTS idx_dm_player_features_tier ON dm_player_features(tier_classification);
|
||||
CREATE INDEX IF NOT EXISTS idx_dm_player_features_updated ON dm_player_features(last_updated DESC);
|
||||
|
||||
-- ============================================================================
|
||||
-- Auxiliary Table: dm_player_match_history
|
||||
-- ============================================================================
|
||||
CREATE TABLE IF NOT EXISTS dm_player_match_history (
|
||||
steam_id_64 TEXT,
|
||||
match_id TEXT,
|
||||
match_date INTEGER, -- Unix timestamp
|
||||
match_sequence INTEGER, -- Player's N-th match
|
||||
|
||||
-- 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,
|
||||
-- Core performance snapshot
|
||||
rating REAL,
|
||||
kd_ratio REAL,
|
||||
adr REAL,
|
||||
kast REAL,
|
||||
is_win BOOLEAN,
|
||||
|
||||
PRIMARY KEY (match_id, steam_id_64)
|
||||
-- Match context
|
||||
map_name TEXT,
|
||||
opponent_avg_elo REAL,
|
||||
teammate_avg_rating REAL,
|
||||
|
||||
-- Cumulative stats
|
||||
cumulative_rating REAL,
|
||||
rolling_10_rating REAL,
|
||||
|
||||
PRIMARY KEY (steam_id_64, match_id),
|
||||
FOREIGN KEY (steam_id_64) REFERENCES dm_player_features(steam_id_64) ON DELETE CASCADE,
|
||||
FOREIGN KEY (match_id) REFERENCES fact_matches(match_id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_player_history_player_date ON dm_player_match_history(steam_id_64, match_date DESC);
|
||||
CREATE INDEX IF NOT EXISTS idx_player_history_match ON dm_player_match_history(match_id);
|
||||
|
||||
-- ============================================================================
|
||||
-- Auxiliary Table: dm_player_map_stats
|
||||
-- ============================================================================
|
||||
CREATE TABLE IF NOT EXISTS dm_player_map_stats (
|
||||
steam_id_64 TEXT,
|
||||
map_name TEXT,
|
||||
|
||||
matches INTEGER DEFAULT 0,
|
||||
wins INTEGER DEFAULT 0,
|
||||
win_rate REAL DEFAULT 0.0,
|
||||
|
||||
avg_rating REAL DEFAULT 0.0,
|
||||
avg_kd REAL DEFAULT 0.0,
|
||||
avg_adr REAL DEFAULT 0.0,
|
||||
avg_kast REAL DEFAULT 0.0,
|
||||
|
||||
best_rating REAL DEFAULT 0.0,
|
||||
worst_rating REAL DEFAULT 0.0,
|
||||
|
||||
PRIMARY KEY (steam_id_64, map_name),
|
||||
FOREIGN KEY (steam_id_64) REFERENCES dm_player_features(steam_id_64) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_player_map_stats_player ON dm_player_map_stats(steam_id_64);
|
||||
CREATE INDEX IF NOT EXISTS idx_player_map_stats_map ON dm_player_map_stats(map_name);
|
||||
|
||||
-- ============================================================================
|
||||
-- Auxiliary Table: dm_player_weapon_stats
|
||||
-- ============================================================================
|
||||
CREATE TABLE IF NOT EXISTS dm_player_weapon_stats (
|
||||
steam_id_64 TEXT,
|
||||
weapon_name TEXT,
|
||||
|
||||
total_kills INTEGER DEFAULT 0,
|
||||
total_headshots INTEGER DEFAULT 0,
|
||||
hs_rate REAL DEFAULT 0.0,
|
||||
|
||||
usage_rounds INTEGER DEFAULT 0,
|
||||
usage_rate REAL DEFAULT 0.0,
|
||||
|
||||
avg_kills_per_round REAL DEFAULT 0.0,
|
||||
effectiveness_score REAL DEFAULT 0.0,
|
||||
|
||||
PRIMARY KEY (steam_id_64, weapon_name),
|
||||
FOREIGN KEY (steam_id_64) REFERENCES dm_player_features(steam_id_64) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_player_weapon_stats_player ON dm_player_weapon_stats(steam_id_64);
|
||||
CREATE INDEX IF NOT EXISTS idx_player_weapon_stats_weapon ON dm_player_weapon_stats(weapon_name);
|
||||
|
||||
-- ============================================================================
|
||||
-- Schema Summary
|
||||
-- ============================================================================
|
||||
-- dm_player_features: 213 columns (6 metadata + 207 features)
|
||||
-- - Tier 1 CORE: 41 columns
|
||||
-- - Tier 2 TACTICAL: 44 columns
|
||||
-- - Tier 3 INTELLIGENCE: 53 columns
|
||||
-- - Tier 4 META: 52 columns
|
||||
-- - Tier 5 COMPOSITE: 11 columns
|
||||
--
|
||||
-- dm_player_match_history: Per-match snapshots for trend analysis
|
||||
-- dm_player_map_stats: Map-level aggregations
|
||||
-- dm_player_weapon_stats: Weapon usage statistics
|
||||
-- ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user