enh: Improve Config File Integration and Unify Hardcoded Parameters#68
Open
enh: Improve Config File Integration and Unify Hardcoded Parameters#68
Conversation
- replace `constants` module with new `settings` configuration class - update imports and references across preprocessing components Signed-off-by: Carlson Büth <commit@cbueth.de>
- replace hardcoded column names, patterns, and constants with `settings` attributes across preprocessing components Signed-off-by: Carlson Büth <commit@cbueth.de>
Signed-off-by: Carlson Büth <commit@cbueth.de>
cbueth
commented
Feb 25, 2026
Comment on lines
117
to
120
| "# get the data collection name from the settings and create the path to the data folder\n", | ||
| "this_repo = Path().resolve()\n", | ||
| "data_collection_name = settings.DATA_COLLECTION_NAME\n", | ||
| "data_folder_path = settings.DATASET_DIR" | ||
| "print(f\"Active Data Collection: {settings.DATA_COLLECTION_NAME}\")\n", | ||
| "print(f\"Dataset Directory: {settings.DATASET_DIR}\")" | ||
| ] |
Collaborator
Author
There was a problem hiding this comment.
Changed preoprocessing notebook to directly use settings. See here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR largly improves the configuration management and code maintainability. It introduces a centralized, flexible configuration system and replaces hardcoded literals across the codebase with unified settings.
Key Changes
Configuration System
preprocessing/config.pynow has a Settings Object, replacing the staticconstants.pywith a dynamicSettingsclass exposed as a singletonsettingsat the package level.Settings can be flexibly loaded with a fixed precedence/priority order.
--config_pathor programmaticsettings.load(path).MULTIPLEYE_CONFIG.multipleye_settings_preprocessing.yamlin the CWD.DeprecationWarning). This is the only option as of now.Configuration is only loaded upon the first access to a setting, avoiding side effects during package import. Configuration changes are logged to the log txt.
Hardcoded Parameters
Several hardcoded strings, regex patterns, and numeric thresholds are now centralised into
config.py.This includes: Column Names:
TRIAL_COL,STIMULUS_COL,PAGE_COL,ACTIVITY_COL,WORD_IDX_COL, etc. Regex Patterns. Thresholds: sanity check bounds for calibrations, validations, and data loss. Experiment Logic:NUM_TRIALSandNUM_QUESTIONS_EXPERIMENT.Usage and Documentation
To uses thes one must import
from preprocessing import settingsto access or modify any parameter. The notebooks are refactored (preprocessing.ipynb) to demonstrate the new configuration workflow.docs/guide/configuration.mdhas been updated.Also
run_multipleye_preprocessing.pycan use external configuration files.Testing
Added
tests/unit/preprocessing/test_config.py.Migration
multipleye_settings_preprocessing.yamlat the repository root is still supported but triggers a deprecation warning!--config_pathargument.Closes #59