Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selectively Enable Source Data Interfaces #502

Merged
merged 30 commits into from
Nov 10, 2023
Merged

Conversation

garrettmflynn
Copy link
Member

@garrettmflynn garrettmflynn commented Nov 7, 2023

This PR generally allows for removing non-required schema object properties (e.g. Interfaces on the source data page) so that they are saved but not passed to subsequent parts of the workflow such as the server.

Specifically, this has been tested with regard to selective enabling / disabling Interfaces across several sessions.

A uniform accordion-style rendering system is now used across all forms, including Global forms like NWBFile and Subject Global Metadata, allowing for us to display the status (error, warning, valid) of those forms as we go.

User Testing Issues

  1. need to add a way for source data to not be required (for an interface to be deleted) at the session level rather than just the data formats page - in case one particular session does not have a certain file/folder available

@garrettmflynn garrettmflynn self-assigned this Nov 7, 2023
@CodyCBakerPhD
Copy link
Collaborator

Looks like validation isn't filtering out the unselected ones

image

otherwise, the appearance of the selector feels fine and the earlier pages, though on initial appearance are a little odd looking outside the context of the session manager, are at least consistent with the later sections (including the later 'localized' global metadata popups)

@garrettmflynn
Copy link
Member Author

garrettmflynn commented Nov 8, 2023

Ah good catch. Should be a simple fix, might've gotten mixed up in the merge

@garrettmflynn
Copy link
Member Author

Hmmm I'm not able to replicate this. Maybe you can show me at our meeting?

Are there two sessions or just one here?

@garrettmflynn
Copy link
Member Author

@CodyCBakerPhD Alright tests should pass now.

@CodyCBakerPhD
Copy link
Collaborator

@garrettmflynn A couple of conflicts with main now

@CodyCBakerPhD
Copy link
Collaborator

CodyCBakerPhD commented Nov 9, 2023

Workflow:

select several interfaces -> define several sessions -> specify a mixture of source files and disabled interfaces for each session -> try to proceed

Screen appears as

image

but received error

Exception on /neuroconv/metadata [POST]
Traceback (most recent call last):
  File "D:\anaconda3\envs\nwb-guide\lib\site-packages\flask\app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "D:\anaconda3\envs\nwb-guide\lib\site-packages\flask\app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "D:\anaconda3\envs\nwb-guide\lib\site-packages\flask_restx\api.py", line 404, in wrapper
    resp = resource(*args, **kwargs)
  File "D:\anaconda3\envs\nwb-guide\lib\site-packages\flask\views.py", line 109, in view
    return current_app.ensure_sync(self.dispatch_request)(**kwargs)
  File "D:\anaconda3\envs\nwb-guide\lib\site-packages\flask_restx\resource.py", line 46, in dispatch_request
    resp = meth(*args, **kwargs)
  File "D:\GitHub\nwb-guide\pyflask\apis\neuroconv.py", line 84, in post
    return get_metadata_schema(neuroconv_api.payload.get("source_data"), neuroconv_api.payload.get("interfaces"))
  File "D:\GitHub\nwb-guide\pyflask\manageNeuroconv\manage_neuroconv.py", line 254, in get_metadata_schema
    converter = instantiate_custom_converter(source_data, interfaces)
  File "D:\GitHub\nwb-guide\pyflask\manageNeuroconv\manage_neuroconv.py", line 217, in instantiate_custom_converter
    return CustomNWBConverter(source_data)
  File "D:\GitHub\neuroconv\src\neuroconv\nwbconverter.py", line 64, in __init__
    self._validate_source_data(source_data=source_data, verbose=self.verbose)
  File "D:\GitHub\neuroconv\src\neuroconv\nwbconverter.py", line 107, in _validate_source_data
    validate(instance=source_data, schema=self.get_source_schema())
  File "D:\anaconda3\envs\nwb-guide\lib\site-packages\jsonschema\validators.py", line 1306, in validate
    raise error
jsonschema.exceptions.ValidationError: Additional properties are not allowed ('__disabled' was unexpected)

Any ideas?

@garrettmflynn
Copy link
Member Author

Forgot to remove the semi-private (__) properties. Should work now that they aren't sent to the server

@CodyCBakerPhD
Copy link
Collaborator

LGTM

@CodyCBakerPhD CodyCBakerPhD merged commit ac5943e into main Nov 10, 2023
7 checks passed
@CodyCBakerPhD CodyCBakerPhD deleted the disable-schema-props branch November 10, 2023 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants