1.0.0 : Web Implemented.

This commit is contained in:
2026-01-26 02:13:06 +08:00
parent 026a8fe65d
commit 8dabf0b097
55 changed files with 4545 additions and 3 deletions

View File

@@ -659,6 +659,13 @@ class MatchParser:
stats.team_id = team_id_value
stats.kills = safe_int(get_stat('kill'))
stats.deaths = safe_int(get_stat('death'))
# Force calculate K/D
if stats.deaths > 0:
stats.kd_ratio = stats.kills / stats.deaths
else:
stats.kd_ratio = float(stats.kills)
stats.assists = safe_int(get_stat('assist'))
stats.headshot_count = safe_int(get_stat('headshot'))

View File

@@ -43,6 +43,7 @@ def calculate_basic_features(df):
'total_matches': count,
'basic_avg_rating': df['rating'].mean(),
'basic_avg_kd': df['kd_ratio'].mean(),
'basic_avg_adr': df['adr'].mean() if 'adr' in df.columns else 0.0,
'basic_avg_kast': df['kast'].mean(),
'basic_avg_rws': df['rws'].mean(),
'basic_avg_headshot_kills': df['headshot_count'].sum() / count,

48
ETL/refresh.py Normal file
View File

@@ -0,0 +1,48 @@
import os
import sys
import subprocess
import time
def run_script(script_path, args=None):
cmd = [sys.executable, script_path]
if args:
cmd.extend(args)
print(f"\n[REFRESH] Running: {' '.join(cmd)}")
start_time = time.time()
result = subprocess.run(cmd)
elapsed = time.time() - start_time
if result.returncode != 0:
print(f"[REFRESH] Error running {script_path}. Exit code: {result.returncode}")
sys.exit(result.returncode)
else:
print(f"[REFRESH] Finished {script_path} in {elapsed:.2f}s")
def main():
base_dir = os.path.dirname(os.path.abspath(__file__))
project_root = os.path.dirname(base_dir)
print("="*50)
print("STARTING FULL DATABASE REFRESH")
print("="*50)
# 1. L1A --force (Re-ingest all raw data)
l1a_script = os.path.join(base_dir, 'L1A.py')
run_script(l1a_script, ['--force'])
# 2. L2 Builder (Rebuild Fact Tables with fixed K/D logic)
l2_script = os.path.join(base_dir, 'L2_Builder.py')
run_script(l2_script)
# 3. L3 Builder (Rebuild Feature Store)
l3_script = os.path.join(base_dir, 'L3_Builder.py')
run_script(l3_script)
print("="*50)
print("DATABASE REFRESH COMPLETED SUCCESSFULLY")
print("="*50)
if __name__ == "__main__":
main()