Comments (2)
This enhancement has been implemented in branch add_historic_versions
, and this has now been merged into master
. Walkthrough example:
Analysing sample size using historic versions of trial records
Historic versions can set to be retrieved for CTGOV2 by specifying ctgov2history = <...>
when using ctrLoadQueryIntoDb()
; this functionality was added in ctrdata
version 1.18.0. Historic versions are automatically retrieved for CTIS. The versions include all trial data available at the date of the respective version.
For CTGOV2 records, the historic versions are added as follows into the ctrdata
data model of a trial record, where the ellipsis ...
represents all trial data fields:
{"_id":"NCT01234567", "title": "Current title", ..., "history": [{"history_version": {"version_number": 1, "version_date": "2020-21-22 10:11:12"}, "title": "Original title", ...}, {"history_version": {"number": 2, "date": "2021-22-23 11:13:13"}, "title": "Later title", ...}]}
The example shows how planned or realised number of participants (sample size) changed over time for individual trials, using data from both registers.
# install ctrdata from development branch
remotes::install_github("rfhb/ctrdata")
# load package
library(ctrdata)
# open database
db <- nodbi::src_sqlite(collection = "my_collection")
# read documentation of new
# parameter "ctgov2history"
help("ctrLoadQueryIntoDb")
# load some trials from CTGOV2 specifying that
# for each trial, 10 versions should be retrieved
ctrLoadQueryIntoDb(
queryterm = "https://clinicaltrials.gov/search?cond=neuroblastoma&aggFilters=phase:3,status:com",
con = db,
ctgov2history = 10
)
# * Appears specific for CTGOV REST API 2.0
# * Found search query from CTGOV2: cond=neuroblastoma&aggFilters=phase:3,status:com
# * Checking trials using CTGOV API 2.0, found 24 trials
# (1/3) Downloading in 1 batch(es) (max. 1000 trials each; estimate: 2.4 MB total)
# (2/3) Converting to NDJSON...
# (3/3) Importing records into database...
# JSON file #: 1 / 1
# * Checking historic versions of trial records...
# - Merging trial versions . . . . . . . . . . . . . . . . . . . . . . . .
# - Updating trial records . . . . . . . . . . . . . . . . . . . . . . . .
# Updated 24 trial(s) with historic versions
# = Imported or updated 24 trial(s)
# Updated history ("meta-info" in "my_collection_name")
ctrLoadQueryIntoDb(
queryterm = "https://euclinicaltrials.eu/app/#/search?basicSearchInputAND=cancer&ageGroupCode=2",
con = db
)
result <- dbGetFieldsIntoDf(
fields = c(
# CTGOV2
"history.protocolSection.designModule.enrollmentInfo.count",
"history.history_version",
# CTIS
"applications.submissionDate",
"applications.partI.rowSubjectCount"
),
con = db
)
# helpers
library(dplyr)
library(tidyr)
library(ggplot2)
# mangle and plot
result %>%
unnest(cols = starts_with("history.")) %>%
unnest(cols = starts_with("applications.")) %>%
mutate(version_date = as.Date(version_date)) %>%
mutate(count = dfMergeVariablesRelevel(., colnames = c(
"history.protocolSection.designModule.enrollmentInfo.count",
"applications.partI.rowSubjectCount"))) %>%
mutate(date = dfMergeVariablesRelevel(., colnames = c(
"applications.submissionDate", "version_date"))) %>%
select(`_id`, count, date) %>%
arrange(`_id`, date) %>%
group_by(`_id`) %>%
ggplot(
mapping = aes(
x = date,
y = count,
colour = `_id`)
) +
geom_step() +
geom_point() +
theme_light() +
guides(colour = "none")
from ctrdata.
Issued closed with 7bc46f9.
from ctrdata.
Related Issues (20)
- Example code doesn't work HOT 2
- ctrLoadQueryIntoDb works on windows but not ubuntu HOT 7
- Erroneous entries in register fields (e.g. date) not flagged with dbGetFieldsIntoDf() HOT 1
- Error message printed with ctrLoadQueryIntoDb() HOT 1
- Trial records not imported into database - stack error
- CTGOV changed website layout HOT 9
- Manual input of trial IDs instead of search functions HOT 5
- Feature request: extract EUCTR results data HOT 1
- Variable fields in EUCTR are not always retrieved HOT 14
- When downloading results from EUCTR, sometimes fails due to error with invalid argument HOT 2
- When downloading result PDFs from EUCTR, sometimes get error of file not found HOT 1
- Certain result documents are causing an error: "No such file or directory" HOT 3
- invalid numeric literal when accumulating information in database HOT 1
- CTGOV2 API call does not filter by study sponsor HOT 7
- Shiny app HOT 4
- Invalid numeric literal HOT 6
- How to cite this package? HOT 3
- Error: Invalid numeric literal at line 1, column 913610 HOT 2
- Incorrect number of trials found with date variables in query URLs for ClinicalTrials.gov HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ctrdata.