From 824992bc7985dec3d33486fe9e71f8e61cbc9cc3 Mon Sep 17 00:00:00 2001 From: leon-k-martin Date: Mon, 30 Sep 2024 17:40:01 +0200 Subject: [PATCH] Refactor InfoBoxComponent to add JournalArticle as a valid type for adding objects to workspace Refactor ExportWorkspaceHandler to include options for exporting bifurcation analysis code in Julia with specified parameters Refactor handlers.py to simplify construct_metadata function and remove unnecessary code --- src/components/InfoBox.tsx | 8 +++++++- tvb_ext_ontology/handlers.py | 12 ++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/InfoBox.tsx b/src/components/InfoBox.tsx index bb2993c..300636c 100644 --- a/src/components/InfoBox.tsx +++ b/src/components/InfoBox.tsx @@ -21,7 +21,13 @@ const InfoBoxComponent: React.FC = ({ }) => { // Valid types for adding objects to workspace // TODO: add valid type for connectivity - const validTypes = ['Neural Mass Model', 'Noise', 'Coupling', 'Integrator']; + const validTypes = [ + 'Neural Mass Model', + 'Noise', + 'Coupling', + 'Integrator', + 'JournalArticle' + ]; const isAddable = selectedNode && validTypes.includes(selectedNode.type); diff --git a/tvb_ext_ontology/handlers.py b/tvb_ext_ontology/handlers.py index 8f85b5c..9482382 100644 --- a/tvb_ext_ontology/handlers.py +++ b/tvb_ext_ontology/handlers.py @@ -144,11 +144,17 @@ def post(self): if export_type == "py": onto_api.experiment.save_code(directory) LOGGER.info("Saved code") + elif export_type == "jl": - onto_api.experiment.save_model_bifurcation_analysis_code(directory) + p = list(onto_api.experiment.model.metadata.parameters.values())[0].name + onto_api.experiment.save_model_bifurcation_analysis_code( + directory, ICS=p, p_min=-10, p_max=10 + ) # TODO: remove hardcoding and add option to type in parameters in frontend + elif export_type == "xml": onto_api.experiment.save_model_specification(directory) LOGGER.info("Saved model specification") + elif export_type == "yaml": onto_api.experiment.save_metadata(directory) LOGGER.info("Saved metadata") @@ -258,9 +264,7 @@ def construct_metadata(nodes_data): "name": custom_get(nodes_data, "parcellation", "DesikanKilliany"), } }, - "tractogram": { - "label": custom_get(nodes_data, "tractogram", "dTOR"), - }, + "tractogram": custom_get(nodes_data, "tractogram", "dTOR"), }, "coupling": { "name": custom_get(nodes_data, "coupling", "Linear"),