fix: circumstance data extraction
Browse files
app/mode_simple.py
CHANGED
|
@@ -437,7 +437,7 @@ with gr.Blocks(theme='shivi/calm_seafoam') as simple:
|
|
| 437 |
error_icon,
|
| 438 |
error_box,
|
| 439 |
gr.Text(mode, visible=False)],
|
| 440 |
-
outputs=[
|
| 441 |
# ---------------------------------------------------------
|
| 442 |
#CREDITS
|
| 443 |
with Modal(visible=False) as modal_creds:
|
|
|
|
| 437 |
error_icon,
|
| 438 |
error_box,
|
| 439 |
gr.Text(mode, visible=False)],
|
| 440 |
+
outputs=[error_icon, error_box])
|
| 441 |
# ---------------------------------------------------------
|
| 442 |
#CREDITS
|
| 443 |
with Modal(visible=False) as modal_creds:
|
app/validation_submission/processing.py
CHANGED
|
@@ -1,24 +1,23 @@
|
|
| 1 |
#### PROCESS FUNCTIONS
|
| 2 |
|
| 3 |
def process_circumstance(data):
|
| 4 |
-
print(data)
|
| 5 |
fields_to_check = ["option_dropdown", "open_field", "extra"]
|
| 6 |
reformatted ={}
|
| 7 |
if ("circumstance_radio" in data.keys()) and ("circumstance" in data.keys()) and ("circumstance_type" in data.keys()) and (data["circumstance_radio"] == "Yes"):
|
| 8 |
reformatted["circumstance_radio"] = data["circumstance_radio"]
|
| 9 |
reformatted["circumstance"] = data["circumstance"]
|
| 10 |
reformatted["circumstance_type"] = {}
|
|
|
|
|
|
|
| 11 |
for field in fields_to_check:
|
| 12 |
if not data["circumstance_type"][field+"_label"] == "NA":
|
| 13 |
val = data[f"circumstance_{field}"]
|
| 14 |
key = data["circumstance_type"][field+"_label"]
|
| 15 |
-
print("TYPE: ", key)
|
| 16 |
reformatted["circumstance_type"][key] = val
|
| 17 |
else:
|
| 18 |
reformatted["circumstance_radio"] = None
|
| 19 |
reformatted["circumstance"] = None
|
| 20 |
reformatted["circumstance_type"] = {}
|
| 21 |
-
print (reformatted)
|
| 22 |
return reformatted
|
| 23 |
|
| 24 |
def process_behaviors(data):
|
|
|
|
| 1 |
#### PROCESS FUNCTIONS
|
| 2 |
|
| 3 |
def process_circumstance(data):
|
|
|
|
| 4 |
fields_to_check = ["option_dropdown", "open_field", "extra"]
|
| 5 |
reformatted ={}
|
| 6 |
if ("circumstance_radio" in data.keys()) and ("circumstance" in data.keys()) and ("circumstance_type" in data.keys()) and (data["circumstance_radio"] == "Yes"):
|
| 7 |
reformatted["circumstance_radio"] = data["circumstance_radio"]
|
| 8 |
reformatted["circumstance"] = data["circumstance"]
|
| 9 |
reformatted["circumstance_type"] = {}
|
| 10 |
+
if "type" in data["circumstance_type"]:
|
| 11 |
+
reformatted["circumstance_type"]["type"] = data["circumstance_type"]["type"]
|
| 12 |
for field in fields_to_check:
|
| 13 |
if not data["circumstance_type"][field+"_label"] == "NA":
|
| 14 |
val = data[f"circumstance_{field}"]
|
| 15 |
key = data["circumstance_type"][field+"_label"]
|
|
|
|
| 16 |
reformatted["circumstance_type"][key] = val
|
| 17 |
else:
|
| 18 |
reformatted["circumstance_radio"] = None
|
| 19 |
reformatted["circumstance"] = None
|
| 20 |
reformatted["circumstance_type"] = {}
|
|
|
|
| 21 |
return reformatted
|
| 22 |
|
| 23 |
def process_behaviors(data):
|
app/validation_submission/submission.py
CHANGED
|
@@ -10,7 +10,7 @@ def validate_save_individual(data, error_icon, error_box, mode):
|
|
| 10 |
if individual:
|
| 11 |
print("pushing to hugging face")
|
| 12 |
push_to_dataset_hf(individual.model_dump())
|
| 13 |
-
return
|
| 14 |
|
| 15 |
|
| 16 |
def push_to_dataset_hf(individual):
|
|
|
|
| 10 |
if individual:
|
| 11 |
print("pushing to hugging face")
|
| 12 |
push_to_dataset_hf(individual.model_dump())
|
| 13 |
+
return error_icon, error_box
|
| 14 |
|
| 15 |
|
| 16 |
def push_to_dataset_hf(individual):
|