GuglielmoTor commited on
Commit
15f85a8
·
verified ·
1 Parent(s): 1c7993b

Update run_agentic_pipeline.py

Browse files
Files changed (1) hide show
  1. run_agentic_pipeline.py +0 -66
run_agentic_pipeline.py CHANGED
@@ -105,69 +105,3 @@ async def run_full_analytics_orchestration(
105
  logger.critical(f"Critical error during analytics orchestration: {e}", exc_info=True)
106
  return None
107
 
108
- # Example of how app.py might call this (for testing this module standalone)
109
- if __name__ == "__main__":
110
- # This block is for testing `run_analytics_pipeline.py` directly.
111
- # In a real scenario, `app.py` would import and call `run_full_analytics_orchestration`.
112
-
113
- # Ensure logging is set up for standalone test
114
- from insight_and_tasks.utils.logging_config import setup_logging
115
- setup_logging()
116
-
117
- if not GOOGLE_API_KEY:
118
- print("Please set the GOOGLE_API_KEY environment variable to run this test.")
119
- else:
120
- # Create mock token_state and filter parameters
121
- mock_token_state = {
122
- "bubble_posts_df": pd.DataFrame({
123
- 'id': [1, 2, 3], 'published_at': pd.to_datetime(['2023-01-01', '2023-07-15', '2023-12-31']),
124
- 'li_eb_label': ['A', 'B', 'A'], 'media_type': ['X', 'Y', 'X'], 'is_ad': [False, True, False],
125
- 'sentiment': ['pos', 'neg', 'neu'], 'engagement': [10,5,8], 'impressionCount': [100,50,80],
126
- 'clickCount': [1,2,3], 'likeCount': [8,3,6], 'commentCount': [1,1,1], 'shareCount': [1,1,1]
127
- }),
128
- "bubble_post_stats_df": pd.DataFrame({'post_id': [1, 2, 3]}), # Simplified
129
- "bubble_mentions_df": pd.DataFrame({
130
- 'date': pd.to_datetime(['2023-06-01', '2023-08-20']), 'sentiment_label': ['Positive 👍', 'Negative 👎']
131
- }),
132
- "bubble_follower_stats_df": pd.DataFrame({
133
- 'category_name': ['2023-01-01', 'Industry A', '2023-02-01'],
134
- 'follower_count_organic': [100, 500, 120],
135
- 'follower_count_paid': [10, 50, 20],
136
- 'follower_count_type': ['follower_gains_monthly', 'follower_industry', 'follower_gains_monthly']
137
- }),
138
- "config_date_col_posts": "published_at",
139
- "config_date_col_mentions": "date",
140
- }
141
- mock_date_filter = "Ultimi 365 Giorni" # Example, adjust prepare_filtered_analytics_data if new options
142
- # For "Ultimi 365 Giorni", prepare_filtered_analytics_data needs to handle it or be updated.
143
- # Let's use a known filter for testing:
144
- mock_date_filter = "Sempre"
145
- mock_custom_start = None
146
- mock_custom_end = None
147
-
148
- logger.info("Running standalone test of run_full_analytics_orchestration...")
149
-
150
- async def test_run():
151
- results = await run_full_analytics_orchestration(
152
- mock_token_state, mock_date_filter, mock_custom_start, mock_custom_end
153
- )
154
-
155
- if results:
156
- print("\n\n" + "="*30 + " MOCK ORCHESTRATION RESULTS " + "="*30)
157
- print("\n--- Comprehensive Analysis Report ---")
158
- print(results.get("comprehensive_analysis_report", "N/A"))
159
-
160
- print("\n--- Actionable OKRs and Tasks ---")
161
- okrs_data = results.get("actionable_okrs_and_tasks")
162
- if okrs_data:
163
- print(json.dumps(okrs_data, indent=2))
164
- else:
165
- print("N/A")
166
-
167
- # Optionally print detailed metrics if needed for debugging
168
- # print("\n--- Detailed Agent Metrics ---")
169
- # print(json.dumps(results.get("detailed_metrics"), indent=2, default=str))
170
- else:
171
- print("Standalone test: Orchestration returned no results or failed.")
172
-
173
- asyncio.run(test_run())
 
105
  logger.critical(f"Critical error during analytics orchestration: {e}", exc_info=True)
106
  return None
107