MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / simulate_and_save

Function simulate_and_save

experiments/simulation/simulate_feedback.py:122–143  ·  view source on GitHub ↗

Main function to simulate and save feedback

(user_id: str = "test_user_001", days: int = 7)

Source from the content-addressed store, hash-verified

120
121
122def 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
146if __name__ == "__main__":

Callers 1

Calls 2

simulate_daily_feedbackFunction · 0.85
save_feedback_logsFunction · 0.85

Tested by

no test coverage detected