Spaces:
Sleeping
Sleeping
Update dashboard.py
Browse files- dashboard.py +14 -10
dashboard.py
CHANGED
@@ -592,28 +592,32 @@ def load_Task_Method_trends(topic, **kwargs):
|
|
592 |
|
593 |
task_data = dict()
|
594 |
|
|
|
|
|
|
|
|
|
|
|
595 |
topic2toptasks = load_topic2toptasks()
|
596 |
|
597 |
|
598 |
#load the task_timeseries dataframe for each of the task mapped from the selected topic in the dict topic2toptasks
|
599 |
-
for task in topic2toptasks
|
600 |
-
task_data[task]=loadTaskMethodTimeSeries(
|
601 |
|
602 |
# Create Panel UI with dropdown selection
|
603 |
-
task_dropdown = pn.widgets.Select(
|
|
|
|
|
|
|
604 |
|
605 |
@pn.depends(task_dropdown.param.value)
|
606 |
def load_task_overlays(task):
|
607 |
-
|
608 |
-
|
609 |
-
return create_overlay_plot(task_method_df)
|
610 |
-
|
611 |
-
return hv.Text(0.5, 0.5, "No data available", halign="center")
|
612 |
|
613 |
return pn.Column(
|
614 |
task_dropdown,
|
615 |
-
pn.bind(load_task_overlays, task_dropdown,)
|
616 |
-
align="center",
|
617 |
)
|
618 |
|
619 |
mapping = {
|
|
|
592 |
|
593 |
task_data = dict()
|
594 |
|
595 |
+
# Check if macro_topics_mapping exists
|
596 |
+
if topic not in macro_topics_mapping:
|
597 |
+
raise ValueError(f"Topic '{topic}' not found in macro_topics_mapping")
|
598 |
+
macro_topic_str = str(macro_topics_mapping[topic])
|
599 |
+
|
600 |
topic2toptasks = load_topic2toptasks()
|
601 |
|
602 |
|
603 |
#load the task_timeseries dataframe for each of the task mapped from the selected topic in the dict topic2toptasks
|
604 |
+
for task in topic2toptasks.get(macro_topic_str, []):
|
605 |
+
task_data[task] = loadTaskMethodTimeSeries(macro_topic_str, task)
|
606 |
|
607 |
# Create Panel UI with dropdown selection
|
608 |
+
task_dropdown = pn.widgets.Select(
|
609 |
+
name="Select TASK",
|
610 |
+
options=[key for key in task_data.keys()] if task_data else ["No available tasks"]
|
611 |
+
)
|
612 |
|
613 |
@pn.depends(task_dropdown.param.value)
|
614 |
def load_task_overlays(task):
|
615 |
+
task_method_df = task_data.get(task)
|
616 |
+
return create_overlay_plot(task_method_df) if task_method_df else hv.Text(0.5, 0.5, "No data available", halign="center")
|
|
|
|
|
|
|
617 |
|
618 |
return pn.Column(
|
619 |
task_dropdown,
|
620 |
+
pn.bind(load_task_overlays, task_dropdown,)
|
|
|
621 |
)
|
622 |
|
623 |
mapping = {
|