(refresh_cache: bool = False)
| 630 | |
| 631 | |
| 632 | def main(refresh_cache: bool = False): |
| 633 | build_data_structure(refresh_cache) |
| 634 | |
| 635 | data = [] |
| 636 | with open(DATA_CACHE) as f: |
| 637 | data = [json.loads(line) for line in f] |
| 638 | print(f"Found {len(data)} player-tournament entries in cache.") |
| 639 | |
| 640 | # Analysis 1: Per player-tournament |
| 641 | print("\n=== Active File Ratio Per Player-Arena ===") |
| 642 | per_tournament_df = analyze_per_player_arena(data, N=5) |
| 643 | print(per_tournament_df) |
| 644 | per_tournament_df.to_csv(ASSETS_SUBFOLDER / "active_file_ratio_per_tournament.csv", index=False) |
| 645 | |
| 646 | # Analysis 2: Per player (aggregated) |
| 647 | print("\n=== Active File Ratio Per Player ===") |
| 648 | per_player_df = analyze_per_player(data, N=5) |
| 649 | print(per_player_df) |
| 650 | per_player_df.to_csv(ASSETS_SUBFOLDER / "active_file_ratio_per_player.csv", index=False) |
| 651 | |
| 652 | # Analysis 3: Root level file clutter per player |
| 653 | print("\n=== Root Level File Clutter Per Player ===") |
| 654 | root_clutter_df = analyze_root_clutter_per_player(data) |
| 655 | print(root_clutter_df) |
| 656 | root_clutter_df.to_csv(ASSETS_SUBFOLDER / "root_clutter_ratio_per_player.csv", index=False) |
| 657 | |
| 658 | # Analysis 4: Churn concentration per player |
| 659 | print("\n=== Churn Concentration Per Player ===") |
| 660 | churn_concentration_df = analyze_churn_concentration_per_player(data, use_magnitude=True) |
| 661 | print(churn_concentration_df) |
| 662 | churn_concentration_df.to_csv(ASSETS_SUBFOLDER / "churn_concentration_per_player.csv", index=False) |
| 663 | |
| 664 | # Analysis 5: File reuse ratio per player |
| 665 | print("\n=== File Reuse Ratio Per Player ===") |
| 666 | file_reuse_df = analyze_file_reuse_per_player(data) |
| 667 | print(file_reuse_df) |
| 668 | file_reuse_df.to_csv(ASSETS_SUBFOLDER / "file_reuse_ratio_per_player.csv", index=False) |
| 669 | |
| 670 | # Visualization: Organization metrics |
| 671 | print("\n=== Plotting Organization Metrics ===") |
| 672 | plot_organization_metrics(file_reuse_df, root_clutter_df) |
| 673 | |
| 674 | # Analysis 6: Filename redundancy over rounds |
| 675 | print("\n=== Filename Redundancy Over Rounds Per Player-Tournament ===") |
| 676 | redundancy_df = analyze_filename_redundancy_over_rounds(data) |
| 677 | print(redundancy_df) |
| 678 | redundancy_df.to_csv(ASSETS_SUBFOLDER / "filename_redundancy_per_player.csv", index=False) |
| 679 | |
| 680 | # Visualization: Filename redundancy over rounds |
| 681 | print("\n=== Plotting Filename Redundancy Over Rounds ===") |
| 682 | plot_filename_redundancy_over_rounds(redundancy_df) |
| 683 | |
| 684 | |
| 685 | if __name__ == "__main__": |
no test coverage detected