diff --git a/.gitignore b/.gitignore index 532d13c..8663d13 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,10 @@ obs_exports/ # Python cache __pycache__/ *.pyc +career_stats.json +final_db.json +data/*.db +*.db -*.db \ No newline at end of file +career_stats.json +final_db.json \ No newline at end of file diff --git a/data/__pycache__/__init__.cpython-313.pyc b/data/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 95542ba..0000000 Binary files a/data/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/data/__pycache__/career_db.cpython-313.pyc b/data/__pycache__/career_db.cpython-313.pyc deleted file mode 100644 index 9cc0a8d..0000000 Binary files a/data/__pycache__/career_db.cpython-313.pyc and /dev/null differ diff --git a/data/__pycache__/match_cache.cpython-313.pyc b/data/__pycache__/match_cache.cpython-313.pyc deleted file mode 100644 index 3b2746a..0000000 Binary files a/data/__pycache__/match_cache.cpython-313.pyc and /dev/null differ diff --git a/data/__pycache__/player_history.cpython-313.pyc b/data/__pycache__/player_history.cpython-313.pyc deleted file mode 100644 index 9d0727b..0000000 Binary files a/data/__pycache__/player_history.cpython-313.pyc and /dev/null differ diff --git a/data/__pycache__/season_cache.cpython-313.pyc b/data/__pycache__/season_cache.cpython-313.pyc deleted file mode 100644 index cfaac15..0000000 Binary files a/data/__pycache__/season_cache.cpython-313.pyc and /dev/null differ diff --git a/predictions/__pycache__/prediction_engine.cpython-313.pyc b/predictions/__pycache__/prediction_engine.cpython-313.pyc deleted file mode 100644 index 51f686e..0000000 Binary files a/predictions/__pycache__/prediction_engine.cpython-313.pyc and /dev/null differ diff --git a/storylines.py b/storylines.py deleted file mode 100644 index a8565bc..0000000 --- a/storylines.py +++ /dev/null @@ -1,145 +0,0 @@ -from rankings import load_career_db -from tags.objective_domination import ( - compute_dom_objective_for_career_player, - compute_dom_objective_for_match_player, - compute_dom_objective_team_scores -) - - -def matchup_storyline(teamA_players, teamB_players): - """ - Composition-aware storyline generator. - Accepts two lists of player entries (5 per team). - """ - - if not teamA_players or not teamB_players: - return "Not enough selected players to generate a storyline." - - # --- Helper averages --- - def avg_slayer(players): - return sum(p.get("slayer_score_raw", 0.0) for p in players) / max(1, len(players)) - - def avg_obj_payload(players): - return sum( - p.get("objective_payload_components", {}).get("payload_score_raw", 0.0) - for p in players - ) / max(1, len(players)) - - def avg_sharp(players): - return sum( - p.get("sharpshooter_components", {}).get("accuracy_norm", 0.0) - for p in players - ) / max(1, len(players)) - - def avg_obj_dom(players): - return sum( - compute_dom_objective_for_career_player( - p.get("career_entry", {}) - ).get("dom_score_raw", 0.0) - for p in players - ) / max(1, len(players)) - - def avg_consistency(players): - return sum( - p.get("consistency_components", {}).get("consistency_norm", 0.0) - for p in players - ) / max(1, len(players)) - - def avg_clutch(players): - return sum( - p.get("clutch_components", {}).get("clutch_norm", 0.0) - for p in players - ) / max(1, len(players)) - - - - # --- Compute team averages --- - a_slayer = avg_slayer(teamA_players) - b_slayer = avg_slayer(teamB_players) - - a_obj = avg_obj_payload(teamA_players) - b_obj = avg_obj_payload(teamB_players) - - a_sharp = avg_sharp(teamA_players) - b_sharp = avg_sharp(teamB_players) - - a_dom = avg_obj_dom(teamA_players) - b_dom = avg_obj_dom(teamB_players) - - a_consistency = avg_consistency(teamA_players) - b_consistency = avg_consistency(teamB_players) - - a_clutch = avg_clutch(teamA_players) - b_clutch = avg_clutch(teamB_players) - - # --- Team names --- - team_a = teamA_players[0].get("team", "Team A") - team_b = teamB_players[0].get("team", "Team B") - - # --- Build storyline --- - lines = [] - lines.append(f"MATCH STORYLINE — {team_a} vs {team_b}\n") - - # Slayer storyline - if a_slayer > b_slayer: - lines.append(f"{team_a} bring stronger slaying on paper.") - elif b_slayer > a_slayer: - lines.append(f"{team_b} bring stronger slaying on paper.") - else: - lines.append("Slaying power looks evenly matched.") - - # Payload storyline - if a_obj > b_obj: - lines.append(f"{team_a} have the edge in Payload objective presence.") - elif b_obj > a_obj: - lines.append(f"{team_b} have the edge in Payload objective presence.") - else: - lines.append("Payload objective presence looks evenly matched.") - - # Domination storyline - if a_dom > b_dom: - lines.append(f"{team_a} show stronger Domination objective capability.") - elif b_dom > a_dom: - lines.append(f"{team_b} show stronger Domination objective capability.") - else: - lines.append("Domination objective capability looks evenly matched.") - - - # Consistency storyline - if a_consistency > b_consistency: - lines.append(f"{team_a} bring steadier map-to-map performance.") - elif b_consistency > a_consistency: - lines.append(f"{team_b} bring steadier map-to-map performance.") - else: - lines.append("Both teams show similar consistency across maps.") - - # Clutch Storyline - if a_clutch > b_clutch: - lines.append(f"{team_a} show stronger clutch performance in high-pressure moments.") - elif b_clutch > a_clutch: - lines.append(f"{team_b} show stronger clutch performance in high-pressure moments.") - else: - lines.append("Both teams show similar clutch performance.") - - - # Sharpshooter storyline - sharp_delta = a_sharp - b_sharp - sharp_pct = sharp_delta * 100 - - if sharp_delta > 0.02: - lines.append( - f"{team_a} bring a Sharpshooter Advantage of {sharp_pct:.1f}%, " - f"landing more shots and converting more headshots than {team_b}." - ) - elif sharp_delta < -0.02: - lines.append( - f"{team_b} hold a Sharpshooter Edge of {abs(sharp_pct):.1f}%, " - f"which could punish {team_a} in long‑range duels." - ) - else: - lines.append( - "Both teams are evenly matched in Sharpshooting, so aim consistency " - "won’t be a deciding factor unless someone pops off." - ) - - return "\n".join(lines) \ No newline at end of file diff --git a/tags/__pycache__/__init__.cpython-313.pyc b/tags/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 6c536ec..0000000 Binary files a/tags/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/tags/__pycache__/clutch.cpython-313.pyc b/tags/__pycache__/clutch.cpython-313.pyc deleted file mode 100644 index 62869a9..0000000 Binary files a/tags/__pycache__/clutch.cpython-313.pyc and /dev/null differ diff --git a/tags/__pycache__/consistency.cpython-313.pyc b/tags/__pycache__/consistency.cpython-313.pyc deleted file mode 100644 index 7d4079b..0000000 Binary files a/tags/__pycache__/consistency.cpython-313.pyc and /dev/null differ diff --git a/tags/__pycache__/objective_domination.cpython-313.pyc b/tags/__pycache__/objective_domination.cpython-313.pyc deleted file mode 100644 index 5e93664..0000000 Binary files a/tags/__pycache__/objective_domination.cpython-313.pyc and /dev/null differ diff --git a/tags/__pycache__/objective_payload.cpython-313.pyc b/tags/__pycache__/objective_payload.cpython-313.pyc deleted file mode 100644 index 5401541..0000000 Binary files a/tags/__pycache__/objective_payload.cpython-313.pyc and /dev/null differ diff --git a/tags/__pycache__/sharpshooter.cpython-313.pyc b/tags/__pycache__/sharpshooter.cpython-313.pyc deleted file mode 100644 index 1b1a1bc..0000000 Binary files a/tags/__pycache__/sharpshooter.cpython-313.pyc and /dev/null differ diff --git a/tags/__pycache__/slayer.cpython-313.pyc b/tags/__pycache__/slayer.cpython-313.pyc deleted file mode 100644 index 2a4c9bf..0000000 Binary files a/tags/__pycache__/slayer.cpython-313.pyc and /dev/null differ diff --git a/team_identity.py b/team_identity.py deleted file mode 100644 index a9b01c0..0000000 --- a/team_identity.py +++ /dev/null @@ -1,115 +0,0 @@ -from rankings import load_career_db -from tags.objective_domination import ( - compute_dom_objective_for_career_player, - compute_dom_objective_for_match_player, - compute_dom_objective_team_scores -) - - -def generate_team_identity(player_list): - """ - Returns a dictionary of team identity scores based on the average - identity-tag components of the SELECTED PLAYERS ONLY. - """ - - if not player_list: - return None - - # --- Helper functions for each identity tag --- - def avg_slayer(players): - return sum(p.get("slayer_score_raw", 0.0) for p in players) / max(1, len(players)) - - def avg_payload(players): - return sum( - p.get("objective_payload_components", {}).get("payload_score_raw", 0.0) - for p in players - ) / max(1, len(players)) - - def avg_consistency(players): - return sum( - p.get("consistency_components", {}).get("consistency_norm", 0.0) - for p in players - ) / max(1, len(players)) - - def avg_clutch(players): - return sum( - p.get("clutch_components", {}).get("clutch_norm", 0.0) - for p in players - ) / max(1, len(players)) - - def avg_sharp(players): - return sum( - p.get("sharpshooter_components", {}).get("accuracy_norm", 0.0) - for p in players - ) / max(1, len(players)) - - def avg_objdom(players): - return sum( - compute_dom_objective_for_career_player( - p.get("career_entry", {}) - ).get("dom_score_raw", 0.0) - for p in players - ) / max(1, len(players)) - - # --- Compute identity scores --- - identity = { - "slayer_score": avg_slayer(player_list), - "payload_score": avg_payload(player_list), - "consistency_score": avg_consistency(player_list), - "clutch_score": avg_clutch(player_list), - "sharpshooter_score": avg_sharp(player_list), - "objdom_score": avg_objdom(player_list), - } - - return identity - - -def compare_team_identity(teamA_players, teamB_players): - a = generate_team_identity(teamA_players) - b = generate_team_identity(teamB_players) - - if a is None or b is None: - return "Not enough data to generate team identity comparison." - - team_a_name = teamA_players[0].get("team", "Team A") - team_b_name = teamB_players[0].get("team", "Team B") - - summary = [] - - # --- Slayer --- - if a["slayer_score"] > b["slayer_score"]: - summary.append(f"{team_a_name} lean slayer-heavy.") - elif b["slayer_score"] > a["slayer_score"]: - summary.append(f"{team_b_name} lean slayer-heavy.") - - # --- Payload Objective --- - if a["payload_score"] > b["payload_score"]: - summary.append(f"{team_a_name} show stronger Payload objective focus.") - elif b["payload_score"] > a["payload_score"]: - summary.append(f"{team_b_name} show stronger Payload objective focus.") - - # --- Domination Objective --- - if a["objdom_score"] > b["objdom_score"]: - summary.append(f"{team_a_name} show stronger Domination objective presence.") - elif b["objdom_score"] > a["objdom_score"]: - summary.append(f"{team_b_name} show stronger Domination objective presence.") - - # --- Consistency --- - if a["consistency_score"] > b["consistency_score"]: - summary.append(f"{team_a_name} are the steadier team.") - elif b["consistency_score"] > a["consistency_score"]: - summary.append(f"{team_b_name} are the steadier team.") - - # --- Clutch --- - if a["clutch_score"] > b["clutch_score"]: - summary.append(f"{team_a_name} excel in clutch situations.") - elif b["clutch_score"] > a["clutch_score"]: - summary.append(f"{team_b_name} excel in clutch situations.") - - # --- Sharpshooter --- - if a["sharpshooter_score"] > b["sharpshooter_score"]: - summary.append(f"{team_a_name} bring stronger aim and headshot conversion.") - elif b["sharpshooter_score"] > a["sharpshooter_score"]: - summary.append(f"{team_b_name} bring stronger aim and headshot conversion.") - - return " ".join(summary) \ No newline at end of file