Dynamic Dataset(s) Accessing
How to Create a file for multiple datafiles remote execution
The order datasets are added when a new experiment is created, corresponds to the order of the datasets in the list dataset_ids. Therefore, in the following case of a new experiment the first dataset is the “RAISE Consortium questionnaire (second…)” and the second dataset is the “Iris”.
The id of the first dataset is in dataset_ids[0] while the second dataset’s in dataset_ids[1]. Make sure the dataset UUIDs are loaded in your script in the correct order to avoid errors or inconsistencies during the execution. This loading method allows you to use multiple datasets of the same type (CSV, TXT, XLS, etc.) within a single script (dynamic dataset accessing).
Python
To read them in python, you have to import json, and follow the next example:
import jsondataset_ids = json.loads(os.getenv("RAISE_DATASET_ID_LIST"))xls = pd.ExcelFile(f"{dataset_ids[0]}/datafile.xlsx", engine = 'openpyxl')To apply the same scripts in another experiment with same files types, you have to create the experiment having as first dataset in the experiment a dataset similar to the “RAISE Consortium questionnaire (second…)” and another one similar to the “Iris” dataset. This way the script will read the corresponding datasets dynamically.