ashokkrish / spatialEpisim

spatialEpisim: Spatial Tracking of Infectious Disease Epidemics using Mathematical Models
GNU General Public License v3.0
8 stars 5 forks source link

server.R and ui.R need to be refactored for correctness and readability #1

Open bryce-carson opened 2 months ago

bryce-carson commented 2 months ago

The server and UI code is chaotic and not written in a clear style using the syntax of R to its fullest. The server and UI code needs to be refactored so that it is more maintainable after I leave the project.

https://github.com/ashokkrish/spatialEpisim/blob/df70041f2dddf2ce5e449c06a22d7b374b76a6d5/server.R#L846-L865

If the names of the countries are added as a new column to the epiparms data file, these lines can be simplified to the following pipeline.

lambdaValue <-
filter(epiparms, model == input$modelSelect, country == input$selectedCountry)[1, "lambda"] |>
as.numeric()
bryce-carson commented 2 months ago

This is just an example of what can be improved in server.

bryce-carson commented 9 hours ago

This is just an example of what can be improved in server.

To justify this issue being an example I am labelling it duplicate of the less specific #32 which represents the needed work to refactor the entire application architecture and implementation.

bryce-carson commented 9 hours ago

I removed the duplicate label and renamed the issue to make it clearer that this issue was originally opened to track the refactoring of the server and UI code. At the time I opened this issue I was unaware that the contents of the R/ sub-folder would need to be refactored as well, so this issue tracks a separate but linked refactoring.

The server code will take advantage of the functionality provided by the functions defined in one or more files in the R/ sub-folder, so this issue is related to the refactoring occurring in #32 in that way and they will be closed at the same time when the unstable branch is merged in to main.