National Institutes of Health (NIH) Stats API
Data statistics
Data statistics
openapi: 3.0.3
info:
title: ClinicalTrials.gov REST BioSample Stats API
description: This API is made available to provide users meta data, statistics, and the most recent version of the clinical trials available on ClinicalTrials.gov.
version: 2.0.5
servers:
- url: https://clinicaltrials.gov/api/v2
description: This server
tags:
- name: Stats
description: Data statistics
paths:
/stats/size:
get:
summary: Study Sizes
description: Statistics of study JSON sizes.
tags:
- Stats
operationId: sizeStats
parameters: []
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/GzipStats'
'400':
description: Bad Request
content:
text/plain:
schema:
$ref: '#/components/schemas/errorMessage'
/stats/field/values:
get:
summary: Field Values
description: Value statistics of the study leaf fields.
tags:
- Stats
operationId: fieldValuesStats
parameters:
- name: types
in: query
style: pipeDelimited
explode: false
description: Filter by field types
required: false
schema:
type: array
default: []
items:
$ref: '#/components/schemas/FieldStatsType'
examples:
example1:
value:
- ENUM
- BOOLEAN
example2:
value:
- INTEGER
- NUMBER
- name: fields
in: query
style: pipeDelimited
explode: false
description: '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.'
required: false
schema:
type: array
minItems: 1
items:
type: string
pattern: ^[a-zA-Z][a-zA-Z0-9\-. ]*$
examples:
example1:
value:
- Phase
example2:
value:
- Condition
- InterventionName
example3:
value:
- protocolSection.armsInterventionsModule.armGroups.interventionNames
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/FieldValuesStatsList'
'400':
description: Bad Request
content:
text/plain:
schema:
$ref: '#/components/schemas/errorMessage'
'404':
description: Not Found
content:
text/plain:
schema:
$ref: '#/components/schemas/errorMessage'
/stats/field/sizes:
get:
summary: List Field Sizes
description: 'Sizes of list/array fields.
To search studies by a list field size, use `AREA[FieldName:size]` search operator.
For example, [AREA\[Phase:size\] 2](https://clinicaltrials.gov/search?term=AREA%5BPhase:size%5D%202)
query finds studies with 2 phases.'
tags:
- Stats
operationId: listFieldSizesStats
parameters:
- name: fields
in: query
style: pipeDelimited
explode: false
description: '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.
If unspecified, all available stats will be returned.'
required: false
schema:
type: array
items:
type: string
pattern: ^[a-zA-Z][a-zA-Z0-9\-. ]*$
minLength: 1
examples:
example1:
value:
- Phase
example2:
value:
- Condition
- Intervention
example3:
value:
- protocolSection.armsInterventionsModule.armGroups.interventionNames
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ListSizesList'
'400':
description: Bad Request
content:
text/plain:
schema:
$ref: '#/components/schemas/errorMessage'
'404':
description: Not Found
content:
text/plain:
schema:
$ref: '#/components/schemas/errorMessage'
components:
schemas:
FieldValuesStatsList:
type: array
items:
$ref: '#/components/schemas/FieldValuesStats'
StudySize:
type: object
properties:
id:
type: string
sizeBytes:
type: integer
format: int32
additionalProperties: false
required:
- id
- sizeBytes
ListSizesList:
type: array
items:
$ref: '#/components/schemas/ListSizes'
FieldStatsType:
type: string
enum:
- ENUM
- STRING
- DATE
- INTEGER
- NUMBER
- BOOLEAN
DateStats:
type: object
properties:
field:
type: string
formats:
type: array
items:
type: string
max:
type: string
min:
type: string
missingStudiesCount:
type: integer
format: int32
piece:
type: string
type:
$ref: '#/components/schemas/FieldStatsType'
additionalProperties: false
required:
- field
- formats
- missingStudiesCount
- piece
- type
ValueCount:
type: object
properties:
studiesCount:
type: integer
format: int32
value:
type: string
additionalProperties: false
required:
- studiesCount
- value
NumberStats:
type: object
properties:
avg:
type: number
format: double
field:
type: string
max:
type: number
format: double
min:
type: number
format: double
missingStudiesCount:
type: integer
format: int32
piece:
type: string
type:
$ref: '#/components/schemas/FieldStatsType'
additionalProperties: false
required:
- field
- missingStudiesCount
- piece
- type
ListSizes:
type: object
properties:
field:
type: string
maxSize:
type: integer
minSize:
type: integer
piece:
type: string
topSizes:
type: array
items:
$ref: '#/components/schemas/ListSize'
uniqueSizesCount:
type: integer
format: int64
additionalProperties: false
required:
- field
- piece
- uniqueSizesCount
EnumStats:
type: object
properties:
field:
type: string
missingStudiesCount:
type: integer
format: int32
piece:
type: string
topValues:
type: array
items:
$ref: '#/components/schemas/ValueCount'
type:
$ref: '#/components/schemas/FieldStatsType'
uniqueValuesCount:
type: integer
format: int64
additionalProperties: false
required:
- field
- missingStudiesCount
- piece
- type
- uniqueValuesCount
LongestString:
type: object
properties:
length:
type: integer
format: int32
nctId:
type: string
value:
type: string
additionalProperties: false
required:
- length
- nctId
- value
GzipStats:
type: object
properties:
averageSizeBytes:
type: integer
format: int32
largestStudies:
type: array
items:
$ref: '#/components/schemas/StudySize'
percentiles:
type: object
ranges:
type: array
items:
$ref: '#/components/schemas/DistItem'
totalStudies:
type: integer
format: int32
additionalProperties: false
required:
- averageSizeBytes
- largestStudies
- percentiles
- ranges
- totalStudies
errorMessage:
type: string
description: A text message describing an error
StringStats:
type: object
properties:
field:
type: string
longest:
$ref: '#/components/schemas/LongestString'
missingStudiesCount:
type: integer
format: int32
piece:
type: string
topValues:
type: array
items:
$ref: '#/components/schemas/ValueCount'
type:
$ref: '#/components/schemas/FieldStatsType'
uniqueValuesCount:
type: integer
format: int64
additionalProperties: false
required:
- field
- missingStudiesCount
- piece
- type
- uniqueValuesCount
FieldValuesStats:
anyOf:
- $ref: '#/components/schemas/EnumStats'
- $ref: '#/components/schemas/StringStats'
- $ref: '#/components/schemas/DateStats'
- $ref: '#/components/schemas/IntegerStats'
- $ref: '#/components/schemas/NumberStats'
- $ref: '#/components/schemas/BooleanStats'
IntegerStats:
type: object
properties:
avg:
type: number
format: double
field:
type: string
max:
type: integer
format: int64
min:
type: integer
format: int64
missingStudiesCount:
type: integer
format: int32
piece:
type: string
type:
$ref: '#/components/schemas/FieldStatsType'
additionalProperties: false
required:
- field
- missingStudiesCount
- piece
- type
DistItem:
type: object
properties:
sizeRange:
type: string
studiesCount:
type: integer
format: int32
additionalProperties: false
required:
- sizeRange
- studiesCount
ListSize:
type: object
properties:
size:
type: integer
studiesCount:
type: integer
format: int32
additionalProperties: false
required:
- size
- studiesCount
BooleanStats:
type: object
properties:
falseCount:
type: integer
format: int32
field:
type: string
missingStudiesCount:
type: integer
format: int32
piece:
type: string
trueCount:
type: integer
format: int32
type:
$ref: '#/components/schemas/FieldStatsType'
additionalProperties: false
required:
- falseCount
- field
- missingStudiesCount
- piece
- trueCount
- type
externalDocs:
description: Introduction on clinicaltrials.gov
url: https://clinicaltrials.gov/data-about-studies/learn-about-api