Lex Jansen's public Github repository for CDISC 360i Proof of Concepts.
This project consists of example programs to try out steps in the 360i pipeline.
Here's the official CDISC 360i repository
Note: The Windows commands provided in this README are written for PowerShell. While most commands are compatible with both PowerShell and Command Prompt, some adjustments may be necessary when using Command Prompt. If you encounter any issues running these commands in Command Prompt, try using PowerShell or consult the Command Prompt documentation for equivalent commands.
These programs are designed to function as command-line applications that can run as standalone applications or can be chained together to function as a pipeline of sorts. Everything in this repo should be considered sandbox development work in support of the 360i program.
bc_dss2crf:
- cdash_poc_odm20.py: script to create ODM XML v2.0 XML, CRFs in HTML, and annotated CRFs in HTML.
- cdash_poc_odm132.py: script to create ODM XML v1.3.2 XML, CRFs in HTML, and annotated CRFs in HTML.
The scripts use the odmlib Python library. A good introduction to this library can be found in Sam Hume's "Using odmlib to Create ODM and Define-XML Tools in Python" paper and presentation.
config:
- config.py loads the configuration settings
- config.ini: configuration settings withy relative paths (copy of config-relative-paths.ini)
- config-relative-paths.ini, config-absolute-paths.ini: templates for configuration settings. Either copy config-relative-paths.ini to config.ini, or copy config-absolute-paths.ini to config.ini, and edit the paths to match your environment.
crf: Output folder for generated CRF files. Every form will get it's own subfolder.
metadata: Metadata used by the scripts.
- cdisc_crf_specializations_draft.xlsx: CRF Specialization metadata. Generated from the draft CDISC CRF Specializations (see: https://github.com/cdisc-org/COSMoS/tree/main/curation/draft).
- cdisc_crf_specilizations_forms.xlsx: Forms metadata.
schema:
- XML Schema files to validate ODM XML v1.3.2 and v2.0 files.
stylesheet:
- XSLT stylesheets to convert ODM XML CRF files to HTML CRFs and annotated CRFs.
utilities:
- Utilities used by scripts to create directories, validate XML, convert XML to HTML.
-
Clone the repository:
git clone https://github.com/lexjansen/cdisc360i-pocs.git -
Create a virtual environment:
python -m venv <virtual_environment_name>
NOTE: if you have multiple versions of python on your machine, you can call python 3.12 for the virtual environment's creation instead of the above command:
python3.12 -m venv <virtual_environment_name>
-
Activate the environment:
Linux:source <virtual_environment_name>/bin/activate
Windows:<virtual_environment_name>/Scripts/Activate -
Install requirements:
python -m pip install -r requirements.txt
Parameters for the cdash_poc_odm20.py and cdash_poc_odm132.py scripts:
--help Show the parameters
-ucm, --update-crf-metatadata Update CRF metadata from the remote source.
The file will be save in the metadata folder with a timestamp in the name
-cp, --crf-metadata-path The path to the file with CRF metadata (optional)
When not specified, the path from the configuration file will be used.
-cs, --crf-metadata-sheet The name of the Excel sheet containing crf metadata (optional)
When not specified, the sheet namefrom the configuration file will be used.
-fp, --form-metadata-path The path to the file with form metadata (optional)
When not specified, the path from the configuration file will be used.
-fs, --form-metadata-sheet The name of the Excel sheet containing form metadata (optional)
When not specified, the sheet name from the configuration file will be used.
-f, --form TEXT The ID of the CRF to process (required)
-p, --prefix TEXT The lowercase prefix to use for the output filenames (required)
When not specified, the lowercase CRF ID will be used.
The following command-line example uses CRF Specializations and Forms metadata (VS1) to generate an ODM v2.0 XML CRF, and HTML renditions of the CRF and annotated CRF in the crf/VS1 folder.:
python ./bc_dss2crf/cdash_poc_odm20.py -f VS1 -p vital_signsThe same, but then additionally specifying CRF and form metadata:
python ./bc_dss2crf/cdash_poc_odm20.py -cp metadata/crf_qrs_kfss_draft.xlsx -cs CRF_QRS_KFSS -fp metadata/form_qrs_kfss_draft.xlsx -fs Forms-KFSS -f KFSS_01 -p kfssThe following command-line examples do the same, but then for ODM v 1.3.2:
python ./bc_dss2crf/cdash_poc_odm132.py -f VS1 -p vital_signs
python ./bc_dss2crf/cdash_poc_odm132.py -cp metadata/crf_qrs_kfss_draft.xlsx -cs CRF_QRS_KFSS -fp metadata/form_qrs_kfss_draft.xlsx -fs Forms-KFSS-f KFSS_01 -p kfssThe following command-line examples get the latest CRF metadata spreadsheet from the COSMoS GitHub repo.
The file wil be saved as metadata\cdisc_crf_specializations_draft_<time stamp>.xlsx:
python ./bc_dss2crf/cdash_poc_odm132.py --update-crf-metatadata
python ./bc_dss2crf/cdash_poc_odm132.py -ucm
python ./bc_dss2crf/cdash_poc_odm20.py --update-crf-metatadata
python ./bc_dss2crf/cdash_poc_odm20.py -ucm
This project uses the MIT
license (see
LICENSE) for code and scripts.