Set of parsers and classes for clinical trials data from ClinicalTrials.gov
pip install -e .
Tested on Python 3.8 .
This package is mainly intended for working with clinical trials data dump in xml files.
from CTnlp.parsers import parse_clinical_trials_from_folder
TRIALS_FOLDER = "PATH/TO/TRIALS/IN/XML/"
cts = parse_clinical_trials_from_folder(folder_name=TRIALS_FOLDER)
cts
will be a list of ClinicalTrials
objects.
In order to convert clinical trials to dictionary you can use asdict
method from dataclasses
:
from dataclasses import asdict
[asdict(ct) for ct in cts]
To download data for your analysis, follow the description from here.
Description of the ClinicalTrials schema: https://prsinfo.clinicaltrials.gov/ProtocolRecordSchema.xsd