Usage
Download ClinicalTrials.gov.
- get_studies(*, force: bool = False) list[dict[str, Any]][source]
Get the full ClinicalTrials.gov data dump.
- Parameters:
force – Should the data be re-downloaded (and the cache invalidated?)
- Returns:
A list of raw dictionaries representing studies in ClinicalTrials.gov, as they are returned by the ClinicalTrials.gov API
Warning
The results are cached to
PATH. You should periodically set force=True to re-download the database, since new records are added on a daily basis.Order is not guaranteed, so, unfortunately, this can’t be done incrementally.
If you want more control over how downloading works, see
iterate_download_studies().
- get_studies_slim(*, force: bool = False) list[dict[str, Any]][source]
Get a slimmed-down set of studies based on
SLIM_FIELDS.
- iterate_download_studies(*, page_size: int | None = None, fields: list[str] | None = None) Iterable[dict[str, Any]][source]
Download studies iteratively by paging through the ClinicalTrials.gov API.
- Parameters:
page_size – The page size when hitting the API
fields – the fields to download. See a full list at https://clinicaltrials.gov/data-api/about-api/study-data-structure. For example, a small field list of
["NCTId", "BriefTitle"]is useful for quickly checking the database.
- Yields:
Individual dictionaries corresponding to studies
See also