Main function to simulate and save feedback
(user_id: str = "test_user_001", days: int = 7)
| 120 | |
| 121 | |
| 122 | def simulate_and_save(user_id: str = "test_user_001", days: int = 7): |
| 123 | """Main function to simulate and save feedback""" |
| 124 | print(f"Simulating {days} days of feedback for user {user_id}...") |
| 125 | |
| 126 | logs = simulate_daily_feedback(user_id, days) |
| 127 | |
| 128 | # Save to data/logs directory |
| 129 | output_dir = Path(__file__).parent.parent / "data" / "logs" |
| 130 | output_dir.mkdir(parents=True, exist_ok=True) |
| 131 | |
| 132 | output_path = output_dir / f"simulated_feedback_{user_id}.json" |
| 133 | save_feedback_logs(logs, str(output_path)) |
| 134 | |
| 135 | # Print summary |
| 136 | total_selected = sum(len(log["selected"]) for log in logs) |
| 137 | total_papers = len(SAMPLE_PAPERS) * days |
| 138 | overall_rate = total_selected / total_papers |
| 139 | |
| 140 | print(f"\nSummary:") |
| 141 | print(f" Total papers shown: {total_papers}") |
| 142 | print(f" Total selected: {total_selected}") |
| 143 | print(f" Overall selection rate: {overall_rate:.1%}") |
| 144 | |
| 145 | |
| 146 | if __name__ == "__main__": |
no test coverage detected