You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
⚠️ Comments will be opened for external users after release.
Migration from tdata to teal_data inside your teal modules
The data argument in both the module UI function and the module server function is used to access the application data. In the recent refactor of teal, we have transitioned from using the tdata class to the teal_data class inside the teal modules. This discussion aims to assist you in modifying your existing modules to be compatible with the new data structure.
Key Changes
Previously, the data obtained was of the tdata class, a named list of reactive data.frame or MultiAssayExperiment objects containing the data after it had been filtered through the filter panel.
After the refactor, the data object received by the UI will be of the teal_data class, which is the same teal_data passed by the teal app developer. While the server will get a reactive(teal_data) which will react to the active filters. This change requires all the modules to adapt the internal module logic and data handling to accommodate the new teal_data structure.
Migration Steps
Quick fix
You could convert the teal_data into tdata using the teal::as_tdata if you need a quick fix to make your module work without making it compatible with teal_data.
# Use this in the ui functiondata<- as_tdata(data)
# Use this in the server functiondata<- as_tdata(data())
But, we recommend making the complete migration as described below.
Complete migration
Here are the potential changes that need to be taken care of.
Ensure that you update your renv.lock or DESCRIPTION with these min-versions of:
TODO: This feature is still not merged, the package versions will be updated once they are merged.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Migration from
tdatatoteal_datainside your teal modulesThe
dataargument in both the module UI function and the module server function is used to access the application data. In the recent refactor of teal, we have transitioned from using thetdataclass to theteal_dataclass inside the teal modules. This discussion aims to assist you in modifying your existing modules to be compatible with the new data structure.Key Changes
Previously, the data obtained was of the
tdataclass, a named list of reactivedata.frameorMultiAssayExperimentobjects containing the data after it had been filtered through the filter panel.After the refactor, the
dataobject received by the UI will be of theteal_dataclass, which is the sameteal_datapassed by the teal app developer. While the server will get areactive(teal_data)which will react to the active filters. This change requires all the modules to adapt the internal module logic and data handling to accommodate the newteal_datastructure.Migration Steps
Quick fix
You could convert the
teal_dataintotdatausing theteal::as_tdataif you need a quick fix to make your module work without making it compatible withteal_data.But, we recommend making the complete migration as described below.
Complete migration
Here are the potential changes that need to be taken care of.
1. Update Data Class Assertions
In UI function
checkmate::assert_class(data, "tdata")checkmate::assert_class(data, "teal_data")In server function
checkmate::assert_class(data, "tdata")checkmate::assert_class(data, "reactive")checkmate::assert_class(isolate(data()), "teal_data")2. Initializing the
qenvobjectThe object
teal_datainherits fromqenvso we don't need to convert thedata->qenvanymore.teal.code::new_qenv(tdata2env(data), code = get_code_tdata(data))data()3. General use of data inside the module server
datadata()data[[dataname]]()data()[[dataname]]length(data)length(datanames(data()))You can have a look at the
tdatatoteal_datamigration in the teal.modules.clinical for reference to these changes.4. Update the package version dependencies
Ensure that you update your
renv.lockorDESCRIPTIONwith these min-versions of:TODO: This feature is still not merged, the package versions will be updated once they are merged.
teal.code>=teal.data>=teal.slice>=teal.transform>=teal>=Beta Was this translation helpful? Give feedback.
All reactions