med-material / rshiny_application_demo

An R Shiny demo application with shiny modules and documentation
0 stars 9 forks source link

[Utils] loadrawdata: Design for both single CSV and multi-CSV loading #1

Open bastianilso opened 3 years ago

bastianilso commented 3 years ago

This issue is used for discussing how to handle multi-CSV loading (meta, event, sample) and single-CSV loading (e.g. just sample) using the same utility functions in loadrawdata.R.

The use case is for multi-CSV loading is larger, complex projects like Whack-A-Mole VR, BCI Games, etc. The use case for single-CSV loading is e.g. external CSV files from other applications, or CSV files provided by the Arduino Logger.

bastianilso commented 3 years ago

Here are the concepts of the data frames: df_metafiles only have 1 row of data, written for the entire dataset. df_event logs “events happening”, at an inconsistent time interval, based on fx user interactions. df_sample logs data which is continuously sampled at a fixed time interval.

Therefore, naturally the arduino logger CSV file, would correspond to the df_sampleconcept. The arduino logger logs continuously at a fixed time interval, until the user tells it to stop.

So for Arduino Logger, the following structure would apply:

Meta = NULL
Event = NULL
Sample = “log.csv”

The Participant ID on the arduino data can be extracted from the folder name. However, right now the function “assumes” that Meta CSV files always exist. Therefore, we should design the function such that it can extract folder names regardless of whether Meta CSV files exist.

Here is one idea:

if(!is.null(meta)){
# if we have meta file csv, great, do the usual
} else {
# we dont have meta file, but still need folder/filename information.
# lets establish a df_meta with only these info 
# e.g. use the “Dir” variable, and the same “separate()” functions to to divide the folder path into columns.
  df_meta <- .....
}