From 2a72aad15e833ff7b9744038240299b265ea732a Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Wed, 3 Apr 2024 11:17:47 -0700 Subject: [PATCH 1/2] Do not add units unless property is in the schema --- pyflask/manageNeuroconv/manage_neuroconv.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pyflask/manageNeuroconv/manage_neuroconv.py b/pyflask/manageNeuroconv/manage_neuroconv.py index 500382e4c..749d69601 100644 --- a/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/pyflask/manageNeuroconv/manage_neuroconv.py @@ -413,15 +413,13 @@ def get_metadata_schema(source_data: Dict[str, dict], interfaces: dict) -> Dict[ ecephys_properties["Electrodes"] = {"type": "object", "properties": {}, "required": []} # Populate Units metadata - metadata["Ecephys"]["Units"] = {} - schema["properties"]["Ecephys"]["required"].append("Units") original_units_schema = ecephys_properties.pop("UnitProperties", None) metadata["Ecephys"].pop("UnitProperties", None) # Always remove top-level UnitProperties from metadata has_units = original_units_schema is not None if has_units: - metadata["Ecephys"] + ecephys_properties["UnitColumns"] = { "type": "array", "minItems": 0, @@ -429,7 +427,11 @@ def get_metadata_schema(source_data: Dict[str, dict], interfaces: dict) -> Dict[ } schema["properties"]["Ecephys"]["required"].append("UnitColumns") + ecephys_properties["Units"] = {"type": "object", "properties": {}, "required": []} + metadata["Ecephys"]["Units"] = {} + schema["properties"]["Ecephys"]["required"].append("Units") + def on_sorting_interface(name, sorting_interface): From bc2a002203af1e41a7b23acd5191ff772780642d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 3 Apr 2024 18:18:27 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyflask/manageNeuroconv/manage_neuroconv.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyflask/manageNeuroconv/manage_neuroconv.py b/pyflask/manageNeuroconv/manage_neuroconv.py index 749d69601..63b361673 100644 --- a/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/pyflask/manageNeuroconv/manage_neuroconv.py @@ -427,12 +427,11 @@ def get_metadata_schema(source_data: Dict[str, dict], interfaces: dict) -> Dict[ } schema["properties"]["Ecephys"]["required"].append("UnitColumns") - + ecephys_properties["Units"] = {"type": "object", "properties": {}, "required": []} metadata["Ecephys"]["Units"] = {} schema["properties"]["Ecephys"]["required"].append("Units") - def on_sorting_interface(name, sorting_interface): unit_columns = get_unit_columns_json(sorting_interface)