R shiny: filtering function does not work after manual data upload

Hello, this is my first time posting a question here.
I am working on an existing R-shiny app. I created a function called "filter_unique_traits" to filter out redundant traits with extensions like *_EBV or *_adj_p_r. The app is connected to a database with many plant species. There are multiple occasions where a single trait is present with multiple extensions like *_gEBV_BayesB, *_EBV, and *_adj_p_r. So, the function prioritizes the extensions and then applies the filter simultaneously when a dataset for a specific crop is loaded in the app from the server. The filtered traits are shown in the "Weights for traits" tab in the Shiny app. It works perfectly when a dataset from a particular species is loaded from the server. But the problem is, when I manually upload an Excel file with new traits, then the filtering function does not run. I checked the manually uploaded dataset. There is no problem with the dataset. The filtering just does not run automatically as it runs when a dataset is loaded from a database server.

I attached two links for two code modules. In the mod_weight_createweight.R at line 118 there is the filtering function "filter_unique_traits". Then, it is applied at line 158. The other two shiny modules mod_weights.R call the mod_weight_createweight.R to run and the mod_dataloader.R deal with loading data for many purposes including manual data upload. In the mod_weights.R at line 18, there is a checkbox, if ticked then the app shows the full list of traits checkboxInput(ns("filterTraits"), label= "Show full list of traits", value = FALSE), # if set to TRUE then the check-box is already marked while launching the app. And at line 39 the module is called to apply the filtering function like this callModule(mod_weights_createweight_server, "weights_createweight_ui_1", filterTraits = !input$filterTraits, placeholdername = placeholdername, data = isolate(reactive_vals$data), reactive_vals, i, Type = Type) #put the ! sign before input$filterTraits to reverse the check-box change.

[mod_weights_createweight.R - Google Drive]
[mod_data_loader.R - Google Drive]

I am not sure where the issue is arising from and how to fix that. It would be really great if you could have a look at the code and suggest some solutions. Thanks and apology in advance for such a long post with large scripts.

Best advise I can give you is to zoom in on the parts of the issue that are critical, foregoing all else, and make yourself the smallest possible shiny application that is capable of performing only that. You are more likely by so doing to correctly identifies challenges along the way, and whether it fully leads to your own improved understanding so you can extend some larger app with analgous functionality, if you should struggle and need support along the way, you would more likely have the sort of minimalistic reproducible example that community members here can use to engage with you.

1 Like

Thank you for the suggestion. I will proceed. Actually, I am new to the Shiny App development. That is why facing some difficulties in working on an already-developed app.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.