nwb-guide
nwb-guide copied to clipboard
Handle C Elegans validation on metadata page
Readdresses #703 and #705, which were not completed up to a conversion.
This PR implements the linked validation of sex and species on the File Metadata page.
However, an error is thrown by NeuroConv when trying to use these results for a conversion:
[2024-05-02 14:15:16,831] ERROR in app: Exception on /neuroconv/convert [POST]
Traceback (most recent call last):
File "/Users/garrettflynn/Documents/GitHub/nwb-guide/pyflask/apis/neuroconv.py", line 110, in post
return convert_to_nwb(neuroconv_api.payload)
File "/Users/garrettflynn/Documents/GitHub/nwb-guide/pyflask/manageNeuroconv/manage_neuroconv.py", line 766, in convert_to_nwb
converter.run_conversion(
File "/Users/garrettflynn/Documents/GitHub/neuroconv/src/neuroconv/nwbconverter.py", line 171, in run_conversion
self.validate_metadata(metadata=metadata)
File "/Users/garrettflynn/Documents/GitHub/neuroconv/src/neuroconv/nwbconverter.py", line 108, in validate_metadata
validate(instance=decoded_metadata, schema=self.get_metadata_schema())
File "/Users/garrettflynn/miniconda3/envs/nwb-guide/lib/python3.9/site-packages/jsonschema/validators.py", line 1292, in validate
raise error
jsonschema.exceptions.ValidationError: 'XX' is not one of ['M', 'F', 'U', 'O']
Failed validating 'enum' in schema['properties']['Subject']['properties']['sex']:
{'enum': ['M', 'F', 'U', 'O'], 'type': 'string'}
On instance['Subject']['sex']:
'XX'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/garrettflynn/miniconda3/envs/nwb-guide/lib/python3.9/site-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/garrettflynn/miniconda3/envs/nwb-guide/lib/python3.9/site-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/Users/garrettflynn/miniconda3/envs/nwb-guide/lib/python3.9/site-packages/flask_restx/api.py", line 404, in wrapper
resp = resource(*args, **kwargs)
File "/Users/garrettflynn/miniconda3/envs/nwb-guide/lib/python3.9/site-packages/flask/views.py", line 109, in view
return current_app.ensure_sync(self.dispatch_request)(**kwargs)
File "/Users/garrettflynn/miniconda3/envs/nwb-guide/lib/python3.9/site-packages/flask_restx/resource.py", line 46, in dispatch_request
resp = meth(*args, **kwargs)
File "/Users/garrettflynn/Documents/GitHub/nwb-guide/pyflask/apis/neuroconv.py", line 114, in post
neuroconv_api.abort(500, str(exception))
File "/Users/garrettflynn/miniconda3/envs/nwb-guide/lib/python3.9/site-packages/flask_restx/namespace.py", line 153, in abort
abort(*args, **kwargs)
File "/Users/garrettflynn/miniconda3/envs/nwb-guide/lib/python3.9/site-packages/flask_restx/errors.py", line 28, in abort
flask.abort(code)
File "/Users/garrettflynn/miniconda3/envs/nwb-guide/lib/python3.9/site-packages/flask/helpers.py", line 277, in abort
current_app.aborter(code, *args, **kwargs)
File "/Users/garrettflynn/miniconda3/envs/nwb-guide/lib/python3.9/site-packages/werkzeug/exceptions.py", line 861, in __call__
raise self.mapping[code](*args, **kwargs)
werkzeug.exceptions.InternalServerError: 500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.