pytrials package¶
Submodules¶
pytrials.client module¶
- class pytrials.client.ClinicalTrials[source]¶
Bases:
object
ClinicalTrials API client
Provides functions to easily access the ClinicalTrials.gov API (https://classic.clinicaltrials.gov/api/) in Python.
- Attributes:
study_fields: List of all study fields you can use in your query. api_info: Tuple containing the API version number and the last time the database was updated.
- get_full_studies(search_expr, max_studies=50, fmt='csv')[source]¶
Returns all content for a maximum of 100 study records.
Retrieves information from the full studies endpoint, which gets all study fields. This endpoint can only output JSON (Or not-supported XML) format and does not allow requests for more than 100 studies at once.
- Args:
- search_expr (str): A string containing a search expression as specified by
- max_studies (int): An integer indicating the maximum number of studies to return.
Defaults to 50.
- Returns:
dict: Object containing the information queried with the search expression.
- Raises:
ValueError: The number of studies can only be between 1 and 100
- get_study_fields(search_expr, fields, max_studies=50, fmt='csv')[source]¶
Returns study content for specified fields
Retrieves information from the study fields endpoint, which acquires specified information from a large (max 1000) studies. To see a list of all possible fields, check the class’ study_fields attribute.
- Args:
- search_expr (str): A string containing a search expression as specified by
fields (list(str)): A list containing the desired information fields. max_studies (int): An integer indicating the maximum number of studies to return.
Defaults to 50.
- min_rnk (int): Minimum Rank sets the lower limit on the range of study records used to return results.
If absent, defaults to 1.
fmt (str): A string indicating the output format, csv or json. Defaults to csv.
- Returns:
Either a dict, if fmt=’json’, or a list of records (e.g. a list of lists), if fmt=’csv. Both containing the maximum number of study fields queried using the specified search expression.
- Raises:
ValueError: The number of studies can only be between 1 and 1000 ValueError: One of the fields is not valid! Check the study_fields attribute
for a list of valid ones.
ValueError: Format argument has to be either ‘csv’ or ‘json’
- property study_fields¶
List of all study fields you can use in your query.
pytrials.utils module¶
Basic utilities module
Module contents¶
Top-level package for pytrials.