This function sends a query to the ClinicalTrials.gov API and returns the results as a tibble. Users can specify various parameters to filter the results, and if a parameter is not provided, it will be omitted from the query.
Usage
ctg_get_fields(
condition = NULL,
location = NULL,
title = NULL,
intervention = NULL,
status = NULL,
page_size = 20
)
Arguments
- condition
A character string specifying the medical condition to search for. This will filter the results to studies related to the given condition.
- location
A character string specifying the location (e.g., city or country) to search in. This will filter the results to studies conducted in the specified location.
- title
A character string specifying keywords to search for in study title. This will filter the results to studies with title that include the specified keywords.
- intervention
A character string specifying the intervention or treatment to search for. This will filter the results to studies involving the specified intervention.
- status
A character vector specifying the overall status of the studies. Valid values include:
ACTIVE_NOT_RECRUITING
- Studies that are actively conducting but not recruiting participants.COMPLETED
- Studies that have completed all phases.ENROLLING_BY_INVITATION
- Studies that are enrolling participants by invitation only.NOT_YET_RECRUITING
- Studies that have not yet started recruiting.RECRUITING
- Studies that are actively recruiting participants.SUSPENDED
- Studies that are temporarily halted.TERMINATED
- Studies that have been terminated before completion.WITHDRAWN
- Studies that have been withdrawn before enrollment.AVAILABLE
- Studies that are available.NO_LONGER_AVAILABLE
- Studies that are no longer available.TEMPORARILY_NOT_AVAILABLE
- Studies that are temporarily not available.APPROVED_FOR_MARKETING
- Studies that have been approved for marketing.WITHHELD
- Studies that have data withheld.UNKNOWN
- Studies with an unknown status.
- page_size
An integer specifying the number of results per page. The default value is 20. The maximum allowed value is 1,000. If a value greater than 1,000 is specified, it will be coerced to 1,000. If not specified, the default value will be used.
Value
A tibble containing the query results. Each row represents a study, and the columns correspond to the study details returned by the API.
Details
This function can return up to 1,000 results.
The function constructs a query to the ClinicalTrials.gov API using the provided parameters. It supports filtering by condition, location, title keywords, intervention, and overall status. The function handles the API response, checks for errors, and parses the results into a tibble.
Examples
# Query for studies related to "diabetes" in "Kolkata" with the status "RECRUITING"
ctg_get_fields(condition = "diabetes", location = "Kolkata",
status = "RECRUITING")
#> The Query matches 2 trial records in the ClinicalTrials.gov records.
#> Your query returned 2 trial records.
#> # A tibble: 2 × 30
#> `NCT Number` `Study Title` `Study URL` Acronym `Study Status` `Brief Summary`
#> <chr> <chr> <chr> <lgl> <chr> <chr>
#> 1 NCT06716424 A Study to In… https://cl… NA RECRUITING "This is an in…
#> 2 NCT07064473 A Study to Te… https://cl… NA RECRUITING "This study is…
#> # ℹ 24 more variables: `Study Results` <chr>, Conditions <chr>,
#> # Interventions <chr>, `Primary Outcome Measures` <chr>,
#> # `Secondary Outcome Measures` <chr>, `Other Outcome Measures` <lgl>,
#> # Sponsor <chr>, Collaborators <lgl>, Sex <chr>, Age <chr>, Phases <chr>,
#> # Enrollment <dbl>, `Funder Type` <chr>, `Study Type` <chr>,
#> # `Study Design` <chr>, `Other IDs` <chr>, `Start Date` <date>,
#> # `Primary Completion Date` <date>, `Completion Date` <date>, …
# Query for studies with "vaccine" in the title and the status "COMPLETED"
ctg_get_fields(title = "vaccine", status = "COMPLETED", page_size = 50)
#> The Query matches 5864 trial records in the ClinicalTrials.gov records.
#> Your query returned 50 trial records.
#> # A tibble: 50 × 30
#> `NCT Number` `Study Title` `Study URL` Acronym `Study Status` `Brief Summary`
#> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 NCT01183611 The Safety a… https://cl… NA COMPLETED "The primary s…
#> 2 NCT00370864 Study of a P… https://cl… NA COMPLETED "The World Hea…
#> 3 NCT00003184 Vaccine Ther… https://cl… NA COMPLETED "RATIONALE: Va…
#> 4 NCT03981952 Salmonella C… https://cl… NA COMPLETED "This is a ran…
#> 5 NCT01461447 Safety Study… https://cl… HIVIS06 COMPLETED "The purpose o…
#> 6 NCT03038776 Recombinant … https://cl… FLU007 COMPLETED "Recombinant H…
#> 7 NCT04123119 Development … https://cl… NA COMPLETED "The impact of…
#> 8 NCT00013871 Pneumococcal… https://cl… NA COMPLETED "The purpose o…
#> 9 NCT02808364 Personalized… https://cl… PerCel… COMPLETED "The treatment…
#> 10 NCT02963714 Immunogenici… https://cl… NA COMPLETED "Intramuscular…
#> # ℹ 40 more rows
#> # ℹ 24 more variables: `Study Results` <chr>, Conditions <chr>,
#> # Interventions <chr>, `Primary Outcome Measures` <chr>,
#> # `Secondary Outcome Measures` <chr>, `Other Outcome Measures` <chr>,
#> # Sponsor <chr>, Collaborators <chr>, Sex <chr>, Age <chr>, Phases <chr>,
#> # Enrollment <dbl>, `Funder Type` <chr>, `Study Type` <chr>,
#> # `Study Design` <chr>, `Other IDs` <chr>, `Start Date` <chr>, …