Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
fix: standarised the flatten of Zoo classifs
Browse files Browse the repository at this point in the history
The species identifications task has a different task number depending on the kso project and workflow selected. Checking if the task is a dictionary is a way to ensure only those species identification tasks get flatten.
  • Loading branch information
victor-wildlife committed Sep 14, 2023
1 parent aadd509 commit 0d3b487
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions kso_utils/zooniverse_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,17 +351,15 @@ def get_workflow_labels(
workflow_info["first_task"] = theworkflow["first_task"].values[0]

# now join workflow structure to workflow label content for each task

for task in tasknames:
# Create an empty dictionary to host the dfs of interest
label_common_name_dict = {"commonName": [], "label": []}

# Create an empty dictionary to host the dfs of interest
label_common_name_dict = {"commonName": [], "label": []}
for choice in workflow_info[task]["choices"]:
label_common_name_dict["label"].append(choice)
choice_name = strings[workflow_info[task]["choices"][choice]["label"]]
label_common_name_dict["commonName"].append(choice_name)
# Check if the task has multiple choices
if isinstance(workflow_info[task], dict):
# Create an empty dictionary to host the dfs of interest
label_common_name_dict = {"commonName": [], "label": []}
for choice in workflow_info[task]["choices"]:
label_common_name_dict["label"].append(choice)
choice_name = strings[workflow_info[task]["choices"][choice]["label"]]
label_common_name_dict["commonName"].append(choice_name)

if task == "T0":
break
Expand Down

0 comments on commit 0d3b487

Please sign in to comment.