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

Refactor custom heuristics #216

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

kaitj
Copy link
Collaborator

@kaitj kaitj commented Feb 27, 2024

I'm happy to leave things as is, but wanted to implement this in a branch if we wanted to change how custom heursitics are provided. Resolves #213.

For a study to use a custom heuristic, a user / admin needs to upload it to the heuristics repository via a PR and it needs to be selected from the study config dropdown. In addition to requiring a maintainer to approve and merge the PR (which I think should be kept in place since every study heuristic is exposed here), an admin also has to manually hit the "update custom heuristics" button on the portal for the heuristics to be immmediately updated. Alternatively, the user can wait until the next day, at which point the cron job to update the heuristics should have run. This provides a bit of a safety net incase there are issues, but there is still a burden on the admin as well as a delay in finding out whether or not an update to a custom heuristic would work.

This PR refactors the custom heuristic to be stored in the database, similar to the custom .bidsignore. If a custom heuristic isn't defined, it will use cfmm_base.py as it was before. If a custom heuristic is required, instead of the drop down, users can input their custom heuristic directly to the study config. At the time when tar2bids is run, the custom heuristic file will be written out to a temporary file to be read. In doing this, any cron jobs or buttons related to updating an externally saved heuristic can be eliminated and also removes some of the admin burden. Some downsides to this:

  • no clear guide to end-users at the moment of how to define these custom heuristics
  • potentially more prone to mapping errors
  • requires some python familiarity and formatting - this is a generic textbox right now and users have to manually input formatting (e.g. 4 spaces)
  • any existing study will need to be updated to use either the default template or applicable custom heuristic

I've included a screenshot of what this looks like (testing locally).

image

The template can be found here, which strips all of the custom content, but provides a starting point.

@kaitj kaitj added the enhancement New feature or request label Feb 27, 2024
@kaitj kaitj requested a review from akhanf February 27, 2024 18:01
@kaitj kaitj self-assigned this Feb 27, 2024
Heuristic column should not be nullable. Refactored slightly to set
default to be whatever is stored under study.custom_heuristic, and
making the column non-nullable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom heuristics
1 participant