Closed xiamaz closed 2 days ago
@xiamaz Complete ticket and create more specific tickets for actual design.
Currently configuration parameters are defined in many different locations. In the future, a consistent interface should exist to define configuration parameters at the following levels:
Configuration models should be defined once and be linked to either site level, project level or user level. When accessing configuration parameters, always the user level should be obtained and this will take project level configuration if no specific user configurations are defined.
Integer
, String
, Boolean
which probably needs to be extended.FLOAT
, and more complex data types or we detach the settings from SODAR core for this.Who should be able to edit issues is clear now.
Way forward for complex data types is JSON, we just need to find the correct data type to store in SODAR core.
Configuration cascade is:
We should collect configuration parameters in documentation and define their configurability regarding these four aspects. New configuration parameters need to always update documentation first.
Currently open tasks:
RE: datatypes in SODAR core: https://github.com/bihealth/sodar-core/issues/1439
VARFISH_*
(they are not intended to be set as superuser and won't interfere with any other settings a user might make)PROJECT
)variants
) - owner/delegatevariants
) - owner/delegatevariants
) - owner/delegatevariants
) - owner/delegatePROJECT_USER
)USER
)RE: datatypes in SODAR core: apparently JSON
already exists. String max length is 255 but will be bumped in the next version.
Editing SODAR core app settings is possible via the AppSettingAPI
. This allows us to build an interface around that. The more complex SiteApp
settings can receive a link-out.
from projectroles.app_settings import AppSettingAPI
app_settings = AppSettingAPI()
app_settings.get('app_name', 'setting_name', project_object)
Technically all settings can that can fit in a JSON dict can be registered as settings in an ProjectAppPlugin
or SiteAppPlugin
. The hierarchy can be derived from the scope. Currently there are no interfering settings where this would come into play.
class Configuration(models.Model):
scope = selection[SITE/PROJECT/PROJECT_USER/USER]
name = CharField
ForeignKey
to the new Configuration
model.SiteAppPlugin
and ProjectAppPlugin
s are scanned for app_settings
but not registered in the model.Configuration
(currently this only would be QuickPresets
, GenePanels
and BeaconSite
) and all app_settings
that are registered with a SiteAppPlugin
or ProjectAppPlugin
.AppSettingsAPI
.Dimensions of sodar-core
configuration:
project=None
)
user=obj
=> editable by useruser=None
=> global configuration setting editable by admin onlyproject=None, user=obj
=> editable by userproject=obj, user=obj
=> editable by userproject=obj, user=None
=> editable by project owner/delegateWhat are default values not stored in the database?
Discussion 27.06.2024
I just pushed the first implementation of the cascaded configuration parameter design (WIP).
It is based on parameter names in SODAR core app_settings that end on
__site | __user | __project_user | __user
This allows us to use the same parameter name throughout all levels and establish a cascade of what value is returned, depending if a parameter is being set on a certain level. The cascade is as follows:
site < user < project < project_user
Currently, it is accessible through an REST API which defines 6 endpoints:
settings/api/site/
settings/api/user/
settings/api/project/{project_uuid}/
settings/api/project-user/{project_uuid}/
settings/api/all/
settings/api/all/{project_uuid}/
All endpoints except the api/all ones have also PUT and PATCH methods and can take a
?a=reset
with the GET which deletes all settings in the scope which will make it return
default values set in the app_settings. The api/all endpoints only return values and
differentiate whether a project uuid has been passed or not. In that case it will return
project-specific and project-user-specific values, otherwise defaults.
The Settings API has different functions to return setting objects to:
For now the implementation is stalled because I need more input:
What remains is when a parameter is configured across all scopes, when should it return a setting and when a default? The SODAR core AppSettingsAPI returns a value when a parameter is queried, either the set value or the default. It is only distinguishable with a trick (looking up the existence in the AppSetting table).
I could construct something that looks whether a parameter is set on a level and if not return the default of the lowest (least worth) level possible, but I don't know if this intended or if we currently run into something that is not solvable easily. Maybe parameters shouldn't live across all scope levels, or only project and project-user are connected and site and user.
@holtgrewe @xiamaz
Discussion 18.07.2024
First focus on improving filter presets:
After discussion, this can be closed.
Post-mortem: complex tickets only with very specific use cases in the future
Is your feature request related to a problem? Please describe. Currently certain settings are set site wide, project wide or per user. This is often an issue, as in different scenarious configuration settings might need to be preset at different levels. A more consistent design is needed here to serve different needs that might arise.
Describe the solution you'd like Configurations should be available on site, project, user level. Each should override the previous one.
Describe alternatives you've considered Only defining configurations at site level might not be sufficient for customization.
Only defining configurations at user level does not allow projects to enforce that certain configurations are applied.
Additional context