I'm working for a retail company that is implementing an algorithm that determines which one of our warehouses to ship orders from. The logic is going do develop over time and we need to attach the logic version to the order so that our data team can evaluate which algorithm version is the most effective.
Our current code is in a very large rails application, but rather than put the algorithm in there, I'm thinking about building a small gem so the logic is self-contained and the version tagging is clear and easy to use for the data team. The rails logic would then look at the version of the gem and attach that to the order in the database.
One weakness of this approach is that it might be difficult to do concurrent A/B testing. In that case, it would make more sense to have a big class, and each iteration of the algorithm is a separate function, but I worry that someone might make a mistake and it compromises the validity of the data.
Which approach would be best for this problem? Is there another approach that would be better?