Spaces:
Running
Running
Update services/report_data_handler.py
Browse files
services/report_data_handler.py
CHANGED
@@ -35,34 +35,26 @@ def fetch_latest_agentic_analysis(org_urn: str):
|
|
35 |
return report_data_df, None # Return full dataframe and no error
|
36 |
|
37 |
|
38 |
-
def
|
39 |
org_urn: str,
|
40 |
report_markdown: str,
|
41 |
-
|
42 |
-
|
43 |
-
generation_timestamp: pd.Timestamp
|
44 |
):
|
45 |
"""Saves the agentic pipeline results to Bubble."""
|
46 |
if not org_urn:
|
47 |
logger.error("Cannot save agentic results: org_urn missing.")
|
48 |
return False
|
49 |
|
50 |
-
# Extract what you need from orchestration_raw_results
|
51 |
-
actionable_okrs_dict = orchestration_raw_results.get("actionable_okrs_and_tasks", {})
|
52 |
-
# Assuming key_results_for_selection is also part of orchestration_raw_results or passed separately
|
53 |
-
key_results_selection_list = orchestration_raw_results.get("key_results_for_selection", [])
|
54 |
-
|
55 |
-
|
56 |
payload = {
|
57 |
-
"
|
58 |
-
BUBBLE_AGENTIC_TIMESTAMP_COLUMN: generation_timestamp.isoformat(), # Store as ISO string
|
59 |
"report_markdown": report_markdown if report_markdown else "N/A",
|
60 |
-
"
|
61 |
-
"
|
62 |
# Add other fields as needed
|
63 |
}
|
64 |
logger.info(f"Attempting to save agentic analysis to Bubble for org_urn: {org_urn}")
|
65 |
-
success_ids = bulk_upload_to_bubble([payload],
|
66 |
|
67 |
if success_ids and success_ids[0]: # bulk_upload_to_bubble returns list of IDs or False
|
68 |
logger.info(f"Successfully saved agentic analysis to Bubble. Record ID: {success_ids[0]}")
|
|
|
35 |
return report_data_df, None # Return full dataframe and no error
|
36 |
|
37 |
|
38 |
+
def save_report_results(
|
39 |
org_urn: str,
|
40 |
report_markdown: str,
|
41 |
+
quarter,
|
42 |
+
year,
|
|
|
43 |
):
|
44 |
"""Saves the agentic pipeline results to Bubble."""
|
45 |
if not org_urn:
|
46 |
logger.error("Cannot save agentic results: org_urn missing.")
|
47 |
return False
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
payload = {
|
50 |
+
"organization_urn": org_urn,
|
|
|
51 |
"report_markdown": report_markdown if report_markdown else "N/A",
|
52 |
+
"quarter": quarter,
|
53 |
+
"year": year,
|
54 |
# Add other fields as needed
|
55 |
}
|
56 |
logger.info(f"Attempting to save agentic analysis to Bubble for org_urn: {org_urn}")
|
57 |
+
success_ids = bulk_upload_to_bubble([payload], BUBBLE_REPORT_TABLE_NAME)
|
58 |
|
59 |
if success_ids and success_ids[0]: # bulk_upload_to_bubble returns list of IDs or False
|
60 |
logger.info(f"Successfully saved agentic analysis to Bubble. Record ID: {success_ids[0]}")
|