2.0.0 Alpha: Data Refinery

This commit is contained in:
2026-08-08 21:31:56 +08:00
parent fa75081d4d
commit 562775e5db
48 changed files with 4172 additions and 661 deletions
BIN
View File
Binary file not shown.
+13 -3
View File
@@ -7,14 +7,20 @@ from dataclasses import dataclass, field
from typing import List, Dict, Optional, Any, Tuple
from datetime import datetime
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT)
from database.paths import L1_DB, L2_DB, L2_SCHEMA
# Setup logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
# Constants
L1A_DB_PATH = 'database/L1/L1.db'
L2_DB_PATH = 'database/L2/L2.db'
SCHEMA_PATH = 'database/L2/schema.sql'
L1A_DB_PATH = str(L1_DB)
L2_DB_PATH = str(L2_DB)
SCHEMA_PATH = str(L2_SCHEMA)
# --- Data Structures for Unification ---
@@ -1238,6 +1244,10 @@ def process_matches():
l1_conn.close()
l2_conn.close()
logger.info(f"\nDone. Processed {count} matches ({success_count} success, {error_count} errors).")
if error_count:
raise RuntimeError(
f"L2 build failed for {error_count}/{count} matches"
)
if __name__ == "__main__":
process_matches()
+21
View File
@@ -636,3 +636,24 @@ SELECT
FROM fact_match_players fmp
JOIN fact_matches fm ON fmp.match_id = fm.match_id
GROUP BY fmp.steam_id_64, fm.map_name;
-- ==========================================
-- Operational query indexes
-- ==========================================
CREATE INDEX IF NOT EXISTS idx_match_players_player_match
ON fact_match_players(steam_id_64, match_id);
CREATE INDEX IF NOT EXISTS idx_match_players_match_team
ON fact_match_players(match_id, team_id, steam_id_64);
CREATE INDEX IF NOT EXISTS idx_match_players_party
ON fact_match_players(match_id, match_team_id, steam_id_64);
CREATE INDEX IF NOT EXISTS idx_round_events_victim
ON fact_round_events(victim_steam_id, match_id);
CREATE INDEX IF NOT EXISTS idx_economy_player_match
ON fact_round_player_economy(steam_id_64, match_id, round_num);
CREATE INDEX IF NOT EXISTS idx_matches_map_time
ON fact_matches(map_name, start_time DESC);