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).
The template can be found here, which strips all of the custom content, but provides a starting point.
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 usecfmm_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 whentar2bids
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:I've included a screenshot of what this looks like (testing locally).
The template can be found here, which strips all of the custom content, but provides a starting point.