Python wrapper around the clinicaltrials.gov API
Project description
pytrials
Python wrapper around the clinicaltrials.gov API. Documentation for the API can be found here: https://clinicaltrials.gov/api/
Free software: BSD license
Documentation: https://pytrials.readthedocs.io.
Tutorial
To install:
$ pip install pytrials
Basic Usage
from pytrials.client import ClinicalTrials ct = ClinicalTrials() # Get 50 full studies related to Coronavirus and COVID in json format. ct.get_full_studies(search_expr="Coronavirus+COVID", max_studies=50) # Get the NCTId, Condition and Brief title fields from 500 studies related to Coronavirus and Covid, in csv format. corona_fields = ct.get_study_fields( search_expr="Coronavirus+COVID", fields=["NCTId", "Condition", "BriefTitle"], max_studies=500, fmt="csv", ) # Get the count of studies related to Coronavirus and COVID. # ClinicalTrials limits API queries to 1000 records # Count of studies may be useful to build loops when you want to retrieve more than 1000 records ct.get_study_count(search_expr="Coronavirus+COVID") # Read the csv data in Pandas import pandas as pd pd.DataFrame.from_records(corona_fields[1:], columns=corona_fields[0])
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2020-07-06)
First release on PyPI.
0.1.2 (2020-07-11)
Minor fixes
0.2.0 (2021-04-24)
Improved test suite
Added get_study_count function
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytrials-0.2.0.tar.gz
(18.2 kB
view hashes)
Built Distribution
Close
Hashes for pytrials-0.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cdbf7b61883eca6ca10596634f3c87ab02a68216ba7ec706782fc5e39498bfda |
|
MD5 | c8d87315494454d26a1a80793f2a0a2a |
|
BLAKE2b-256 | f9feae46ec74c076ab1ee32fca9f4605fb4d33ef613b1317a8f2992087299e42 |