Converts CDISC Rules Engine Excel datasets to JSON for TEST command
The ExcelToJsonConverter is a Python script designed to convert CDISC Rules Engine Excel datasets into JSON format. This tool is particularly useful for preparing datasets for the TEST command.
To use the ExcelToJsonConverter, you need to provide the paths to the directories containing the rule files and dataset files. The script will process these directories, find the corresponding Excel files, convert them to JSON, and save the JSON files in a specified folder.
--rules: Path to the directory containing rule files.--datasets: Path to the directory containing dataset files.
python XSLX-to-JSON.py --rules path/to/rules --datasets path/to/datasetsThe script expects the following directory structure for the rule and dataset folders:
The rules directory should contain subfolders, each named after a specific rule ID. Each subfolder can contain multiple rule files.
rules_directory/
βββ rule1/
β βββ rule_file1.json
β βββ rule_file2.json
βββ rule2/
β βββ rule_file1.json
β βββ rule_file2.json
βββ rule3/
βββ rule_file1.json
βββ rule_file2.json
The datasets directory should contain subfolders, each named after a specific dataset. Each subfolder can contain multiple dataset files.
datasets_directory/
βββ dataset1/
β βββ dataset_file1.xlsx
β βββ dataset_file2.xlsx
βββ dataset2/
β βββ dataset_file1.xlsx
β βββ dataset_file2.xlsx
βββ dataset3/
βββ dataset_file1.xlsx
βββ dataset_file2.xlsx
The converted JSON files will be saved in a folder named json_datasets, with subfolders named after the rule IDs.
json_datasets/
βββ rule1/
β βββ converted_dataset.json
βββ rule2/
β βββ converted_dataset.json
βββ rule3/
βββ converted_dataset.json
- pandas
- argparse
- json
- shutil
- os
You can install the required dependencies using pip: