Skip to content

everygene/clinicaltrials-python

Repository files navigation

clinicaltrials

This API is made available to provide users meta data, statistics, and the most recent version of the clinical trials available on ClinicalTrials.gov.

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 2.0.3
  • Package version: 1.0.0
  • Generator version: 7.14.0-SNAPSHOT
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python 3.9+

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import clinicaltrials

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import clinicaltrials

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:

import clinicaltrials
from clinicaltrials.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://clinicaltrials.gov/api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = clinicaltrials.Configuration(
    host = "https://clinicaltrials.gov/api/v2"
)



# Enter a context with an instance of the API client
with clinicaltrials.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = clinicaltrials.StatsApi(api_client)
    types = [] # List[FieldStatsType] | Filter by field types (optional) (default to [])
    fields = ['[\"Phase\"]'] # List[str] | Filter by piece names or field paths of leaf fields. See [Data Structure](/data-api/about-api/study-data-structure) for the available values.  If specified, must be non-empty comma- or pipe-separated list of fields to return. (optional)

    try:
        # Field Values
        api_response = api_instance.field_values_stats(types=types, fields=fields)
        print("The response of StatsApi->field_values_stats:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling StatsApi->field_values_stats: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://clinicaltrials.gov/api/v2

Class Method HTTP request Description
StatsApi field_values_stats GET /stats/field/values Field Values
StatsApi list_field_sizes_stats GET /stats/field/sizes List Field Sizes
StatsApi size_stats GET /stats/size Study Sizes
StudiesApi enums GET /studies/enums Enums
StudiesApi fetch_study GET /studies/{nctId} Single Study
StudiesApi list_studies GET /studies Studies
StudiesApi search_areas GET /studies/search-areas Search Areas
StudiesApi studies_metadata GET /studies/metadata Data Model Fields
VersionApi version GET /version Version

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Author

About

Clinicaltrials.gov python client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors