Splitting Up Bessy Eeg_data
This is a bit of planning about what we want Bessy to be, not necessarily next steps. It was heavily influenced by the planning meeting of Greg, Eli, Anup, and Brian on Nov 15, 2023.
One of the issues right now is that Bessy it is essentially a single object with far too much responsibility. In its current form Bessy EEG_data is responsible for:
- Running the BCI main loop
- Maintaining inlets and outlets for LSL
- Pre-processing the incoming EEG
- Reshaping incoming EEG
- Storing the reshaped EEG
- Training the classifier
- Making selections with the classifier
- Sending those selections back through the outlet
- Storing settings for everything listed above
This is contrary to the Single Responsibility Principle (SRP), which states “a class should have only one reason to change”. In fact, this class is something like the opposite, if you want to change anything then you need to change this class.
To come into better alignment with the SRP we should start splitting EEG_data up into separate classes that change for different reasons (ie. “I want to change the preprocessing parameters.”). These classes can then be injected into the machine that is Bessy. This is shown below where reshaping, pre-processing, and classifier all have their own classes which are injected into Bessy.

Or, in code it might look something like this.
reshaper = reshaping(paradigm, window_length, …)
preprocessor = preprocessing(filter, filter_cutoffs, filter_order, …)
classifier = classifier(classifier_type, n_folds, …)
inlet = inlet("LSL")
outlet = outlet ("LSL")
run_the_bci(inlet, outlet, reshaper, preprocessor, classifier)
This gives the opportunity to change only what we want to change, following the SRP. This is also beneficial because we can make these classes function for offline processing in MOABB so that we can test them on large amounts of data then integrate them for online use.