ClinTrialX
The goal of {clintrialx}
is to fetch clinical trials
data from freely available registries. Currently, it supports querying
the
ClinicalTrials.gov registry using its V2 API and
CTTI AACT (Public Access to Aggregate Content of ClinicalTrials.gov).
You can install this package from GitHub with:
# install.packages("devtools")
::install_github("ineelhere/clintrialx") devtools
library(clintrialx)
Only if you wish to use AACT as a source for the data
Sign up and create an account. Itโs free.
The username
and password
will be
needed to fetch data using this package.
Save it in a .Renviron
file, for example-
= "random_name"
user = "random_password" password
Now that the file is created, load the variable with the command
readRenviron("path/to/.Renviron)
Youโre all set!
Fetch one or multiple trial records based on NCT IDs. You can opt to fetch some specific fields or all fields available at source (default).
library(clintrialx)
ctg_get_nct(c("NCT02967965", "NCT04000165", "NCT01007279", "NCT02376244", "NCT01179776"),
fields = c("NCT Number", "Study Title", "Study Status", "Sponsor"))
Supports filtering by condition, location, title keywords, intervention, and overall status.
ctg_get_fields(
condition = "Cancer",
location = "Kolkata",
title = NULL,
intervention = "Drug",
status = c("ACTIVE_NOT_RECRUITING", "RECRUITING"),
page_size = 10
)
Download all available data for your query. No limits!
Supports filtering by condition, location, title keywords, intervention, and overall status.
<- ctg_bulk_fetch(location="india") df
# Set environment variables for database credentials in .Renviron and load it
# readRenviron(".Renviron")
# Connect to the database
<- aact_connection(Sys.getenv('user'), Sys.getenv('password'))
con
# Run a custom query
<- "SELECT nct_id, source, enrollment, overall_status FROM studies LIMIT 5;"
query <- aact_custom_query(con, query)
results
# Print the results
print(results)
Currently works for data from ClinicalTrials.Gov
Visit here for an exqample report - https://www.indraneelchakraborty.com/clintrialx/report.html
#first get the data in a R dataframe
<- ctg_bulk_fetch(condition="cancer")
my_clinical_trial_data #now pass it to the reports function
ctg_data_report(
ctg_data = my_clinical_trial_data,
title = "Clinical Trials Analysis",
author = "Indra",
output_file = "reports/clinical_trials.html",
theme = "flatly",
color_palette = c("#4E79A7", "#F28E2B", "#E15759", "#76B7B2", "#59A14F", "#EDC948"),
include_data_quality = TRUE,
include_interactive_plots = TRUE,
custom_footer = "Proprietary report generated by SomeGreatOrg Inc."
)
# Generate a report with static plots and no data quality assessment
ctg_data_report(
ctg_data = my_clinical_trial_data,
title = "Quick Clinical Trial Overview",
include_data_quality = FALSE,
include_interactive_plots = FALSE
)
Check the path reports/clinical_trials.html
on your
local. It will have the html report file.
Cool stuff - It also has the codes to the plots!
You can fetch version information directly from the package:
version_info(source = "clinicaltrials.gov")
๐ Ready to contribute? Letโs make clintrialx even better!
๐ฌ Questions or Feedback? Feel free to open an issue on GitHub Issues page.
๐ Enjoying clintrialx
? Please consider
giving it a star on GitHub! Your support
helps this project grow and improve.
More updates to come. Happy coding! ๐