I'm writing a clinical trials simulator. The user defines future trial options, eg a trial with 100 placebo patients, 200 treatment patients, "optimistic" outcome scenario, etc. There can be 1-20,000 of such options. For each option 10,000 - 100,000 trial results are simulated. The simulated data are later used for analytics, for each assumed option.
It's an Angular/Electron desktop app (in future, there'll be a web extension). The front-end sends a REST API request with trial options. The Python back-end performs the simulations in parallel. It stores the results in a PostgreSQL database, with a row per option. The database is either on the user laptop or on external storage. There is a single user working on a simulation.
The simulations can take long, with their results needing a lot of memory. Therefore once the user adds the trial options, I'd only simulate for these additions, rather than for every option. I also allow to abort a running simulation.
What the user assumes the inputs - trial options - are must coincide with the inputs to the latest saved simulations (and to subsequent analytics). Therefore I want to always notify the user about a difference between the front-end and the database. So analytics would be disabled if there's a difference.
How could I ensure this consistency? For example, the front-end could track three sets of trial options: (1) for the finished simulations; (2) for simulations in progress and (3) for current user inputs without started simulations. But this seems fragile. Also, I'm not comfortable with using the front-end, rather than the back-end and database as the source of truth. Does this front-end approach make sense, or should I go with the back-end? Or what else would work better?
Note: Architecting a predictive modeling software discusses a similar software, although with stable user inputs and a focus on performance. Besides this, I haven't found much relevant info on SE.