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
Python 3.9+
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 clinicaltrialsInstall 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 clinicaltrialsExecute pytest to run the tests.
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)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 |
- AdverseEvent
- AdverseEventsModule
- AgencyClass
- AgreementRestrictionType
- AnalysisDispersionType
- AnnotationModule
- AnnotationSection
- ArmGroup
- ArmGroupType
- ArmsInterventionsModule
- AvailIpd
- BaselineCharacteristicsModule
- BaselineMeasure
- BioSpec
- BioSpecRetention
- BooleanStats
- BrowseBranch
- BrowseLeaf
- BrowseLeafRelevance
- BrowseModule
- CertainAgreement
- ConditionsModule
- ConfidenceIntervalNumSides
- Contact
- ContactRole
- ContactsLocationsModule
- DateStats
- DateStruct
- DateType
- Denom
- DenomCount
- DerivedSection
- DescriptionModule
- DesignAllocation
- DesignInfo
- DesignMasking
- DesignModule
- DesignTimePerspective
- DistItem
- DocumentSection
- DropWithdraw
- EligibilityModule
- EnrollmentInfo
- EnrollmentType
- EnumInfo
- EnumItem
- EnumStats
- EventAssessment
- EventGroup
- EventStats
- ExpandedAccessInfo
- ExpandedAccessStatus
- ExpandedAccessTypes
- FieldNode
- FieldStatsType
- FieldValuesStats
- FirstMcpInfo
- FlowGroup
- FlowMilestone
- FlowPeriod
- FlowStats
- GeoPoint
- GzipStats
- IdentificationModule
- IntegerStats
- Intervention
- InterventionType
- InterventionalAssignment
- IpdSharing
- IpdSharingInfoType
- IpdSharingStatementModule
- LargeDoc
- LargeDocumentModule
- LimitationsAndCaveats
- ListSize
- ListSizes
- Location
- LongestString
- MaskingBlock
- MeasureAnalysis
- MeasureCategory
- MeasureClass
- MeasureDispersionType
- MeasureGroup
- MeasureParam
- Measurement
- Mesh
- MiscInfoModule
- MoreInfoModule
- NonInferiorityType
- NumberStats
- ObservationalModel
- Official
- OfficialRole
- OrgStudyIdInfo
- OrgStudyIdType
- Organization
- Outcome
- OutcomeMeasure
- OutcomeMeasureType
- OutcomeMeasuresModule
- OutcomesModule
- OversightModule
- PagedStudies
- PartialDateStruct
- ParticipantFlowModule
- Phase
- PointOfContact
- PrimaryPurpose
- ProtocolSection
- RecruitmentStatus
- Reference
- ReferenceType
- ReferencesModule
- ReportingStatus
- ResponsibleParty
- ResponsiblePartyType
- ResultsSection
- Retraction
- SamplingMethod
- SearchArea
- SearchDocument
- SearchPart
- SecondaryIdInfo
- SecondaryIdType
- SeeAlsoLink
- Sex
- Sponsor
- SponsorCollaboratorsModule
- StandardAge
- Status
- StatusModule
- StringStats
- Study
- StudySize
- StudyType
- SubmissionInfo
- SubmissionTracking
- UnpostedAnnotation
- UnpostedEvent
- UnpostedEventType
- ValueCount
- Version
- ViolationAnnotation
- ViolationEvent
- ViolationEventType
- WebLink
- WhoMasked
Endpoints do not require authorization.