openneuro icon indicating copy to clipboard operation
openneuro copied to clipboard

Add 'number of sessions' to search options

Open jbwexler opened this issue 2 years ago • 1 comments

What would you like to see added?

I would like to see 'number of sessions' added as an option in search.

Alternatives

No response

Do you have any interest in helping implement the feature?

Yes, but I would need guidance

Additional information / screenshots

No response

jbwexler avatar Feb 15 '23 19:02 jbwexler

The indexing side is pretty simple, there's a mapping that needs the field added: https://github.com/OpenNeuroOrg/openneuro/blob/master/packages/openneuro-search/src/mappings/datasets-mapping.json

And a query that grabs those values from OpenNeuro and does any transformation needed to write it to the index: https://github.com/OpenNeuroOrg/openneuro/blob/master/packages/openneuro-search/src/query.ts

This field already exists and contains an array of sessions identified by bids-validator.

latestSnapshot {
  summary {
    sessions
  }
}

That should be it for making it available via the API. You can test this with docker-compose, it runs ElasticSearch and the indexer.

Client side is here: https://github.com/OpenNeuroOrg/openneuro/tree/master/packages/openneuro-app/src/scripts/search - advancedSearch is the GraphQL query that runs queries. Sessions would just need the right UI component hooked up here and defaults added for the Apollo state.

nellh avatar Feb 15 '23 19:02 nellh