Skip to content
R wrapper to Castor EDC API
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Initial release Feb 5, 2019
R Initial release Feb 5, 2019
man Initial release Feb 5, 2019
tests Initial release Feb 5, 2019
.Rbuildignore Initial release Feb 5, 2019
.gitignore Initial release Feb 5, 2019
CastorAPI.Rproj Initial release Feb 5, 2019
DESCRIPTION Remove non ASCII character in DESCRIPTION Mar 19, 2019
LICENSE Initial release Feb 5, 2019
NAMESPACE Initial release Feb 5, 2019
README.Rmd Initial release Feb 5, 2019
README.md Initial release Feb 5, 2019

README.md

Castor API R Package

The intent of this package is to provide convenient access to study data in Castor via R.

Package Structure

Access to data in the API comes in three forms:

  1. Access to individual items (getStudyDataPoint, getStudy, getRecord, etc.)
  2. Access to pages of items in a list (getStudyDataPoints, getStudies, getRecords, etc.)
  3. Processed into a data frame for straightforward analysis (getStudyData)

Installation

# install.packages("remotes")
remotes::install_github("castoredc/castoRedc")

Usage

See https://helpdesk.castoredc.com/article/124-application-programming-interface-api about generating your credentials.

Note: It is recommended that you read https://cran.r-project.org/web/packages/httr/vignettes/secrets.html about managing your credentials.

library(castoRedc)

castor_api <- CastorData$new(key = Sys.getenv("CASTOR_KEY"), 
                             secret = Sys.getenv("CASTOR_SECRET"), 
                             base_url = "https://data.castoredc.com")
studies <- castor_api$getStudies()
crf_id study_id name created_by created_on live randomization_enabled gcp_enabled surveys_enabled premium_support_enabled main_contact expected_centers expected_records slug version duration _links.self.href
661D1A14-0ECC-0133-0142-004F5DB68A52 661D1A14-0ECC-0133-0142-004F5DB68A52 study-1 8E5C3876-0A0C-927B-DB49-4890D711205E 2018-11-06 10:49:52 FALSE FALSE TRUE TRUE TRUE FALSE 0 0 id-1 0.01 NA https://dev.do.castoredc.com/api/study/661D1A14-0ECC-0133-0142-004F5DB68A52
9D9A33EF-40DE-5438-BD7E-703FC1913461 9D9A33EF-40DE-5438-BD7E-703FC1913461 test-import-tulip 8E5C3876-0A0C-927B-DB49-4890D711205E 2018-11-08 18:05:44 FALSE FALSE TRUE TRUE FALSE FALSE 0 0 id-2 0.01 NA https://dev.do.castoredc.com/api/study/9D9A33EF-40DE-5438-BD7E-703FC1913461
(example_study_id <- studies[["study_id"]][1])
#> [1] "661D1A14-0ECC-0133-0142-004F5DB68A52"
fields <- castor_api$getFields(example_study_id)
id parent_id field_id field_number field_label field_is_alias field_variable_name field_type field_required field_hidden field_info field_units field_min field_min_label field_max field_max_label field_slider_step report_id field_length additional_config exclude_on_data_export metadata_points validations dependency_parents dependency_children option_group.id option_group.name option_group.description option_group.layout option_group.options option_group.fields _links.self.href
0097117D-4476-0B11-4738-0D9A5FFE0E87 FD7954F6-2321-1244-8977-CE126558566C 0097117D-4476-0B11-4738-0D9A5FFE0E87 1 Length FALSE dem_patlen numeric 1 0 m 0 NA 2 NA NA 5 NA FALSE list() list() list() list() NA NA NA NA NULL NULL https://dev.do.castoredc.com/api/study/661D1A14-0ECC-0133-0142-004F5DB68A52/field/0097117D-4476-0B11-4738-0D9A5FFE0E87
5DA1288A-C4FC-16BB-3DAB-7786527CDCAE 7F0CA57D-25A1-EF84-0A5D-A0ECCB2316FE 5DA1288A-C4FC-16BB-3DAB-7786527CDCAE 4 Months pregnant FALSE dem_pat_preg_months numeric 1 0 months 0 NA 10 NA NA NA NA FALSE list() list() list() list() NA NA NA NA NULL NULL https://dev.do.castoredc.com/api/study/661D1A14-0ECC-0133-0142-004F5DB68A52/field/5DA1288A-C4FC-16BB-3DAB-7786527CDCAE
8B1FCC14-9001-9A0C-C44E-6D0FE0B52136 02D1455D-82E3-36C4-A0B2-CCB3D6CFDF33 8B1FCC14-9001-9A0C-C44E-6D0FE0B52136 4 Can patient participate in the study? FALSE inc_pat_can_part calculation 0 0 NA NA NA NA NA NA NA FALSE list() list() list() list() NA NA NA NA NULL NULL https://dev.do.castoredc.com/api/study/661D1A14-0ECC-0133-0142-004F5DB68A52/field/8B1FCC14-9001-9A0C-C44E-6D0FE0B52136
steps <- castor_api$getSteps(example_study_id)
id step_id step_name step_order step_description _embedded.phase.id _embedded.phase.phase_id _embedded.phase.phase_description _embedded.phase.phase_name _embedded.phase.phase_duration _embedded.phase.phase_order _embedded.phase._links.self.href _links.self.href
02D1455D-82E3-36C4-A0B2-CCB3D6CFDF33 02D1455D-82E3-36C4-A0B2-CCB3D6CFDF33 Inclusion 1 6EC42D9A-D1F0-B946-7A61-A6AF8A526884 6EC42D9A-D1F0-B946-7A61-A6AF8A526884 NA Baseline (example phase) NA 1 https://dev.do.castoredc.com/api/study/661D1A14-0ECC-0133-0142-004F5DB68A52/phase/6EC42D9A-D1F0-B946-7A61-A6AF8A526884 https://dev.do.castoredc.com/api/study/661D1A14-0ECC-0133-0142-004F5DB68A52/step/02D1455D-82E3-36C4-A0B2-CCB3D6CFDF33
7F0CA57D-25A1-EF84-0A5D-A0ECCB2316FE 7F0CA57D-25A1-EF84-0A5D-A0ECCB2316FE Demographics 2 6EC42D9A-D1F0-B946-7A61-A6AF8A526884 6EC42D9A-D1F0-B946-7A61-A6AF8A526884 NA Baseline (example phase) NA 1 https://dev.do.castoredc.com/api/study/661D1A14-0ECC-0133-0142-004F5DB68A52/phase/6EC42D9A-D1F0-B946-7A61-A6AF8A526884 https://dev.do.castoredc.com/api/study/661D1A14-0ECC-0133-0142-004F5DB68A52/step/7F0CA57D-25A1-EF84-0A5D-A0ECCB2316FE
FD7954F6-2321-1244-8977-CE126558566C FD7954F6-2321-1244-8977-CE126558566C Measurements 3 6EC42D9A-D1F0-B946-7A61-A6AF8A526884 6EC42D9A-D1F0-B946-7A61-A6AF8A526884 NA Baseline (example phase) NA 1 https://dev.do.castoredc.com/api/study/661D1A14-0ECC-0133-0142-004F5DB68A52/phase/6EC42D9A-D1F0-B946-7A61-A6AF8A526884 https://dev.do.castoredc.com/api/study/661D1A14-0ECC-0133-0142-004F5DB68A52/step/FD7954F6-2321-1244-8977-CE126558566C
phases <- castor_api$getPhases(example_study_id)
id phase_id phase_description phase_name phase_duration phase_order _links.self.href
6EC42D9A-D1F0-B946-7A61-A6AF8A526884 6EC42D9A-D1F0-B946-7A61-A6AF8A526884 NA Baseline (example phase) NA 1 https://dev.do.castoredc.com/api/study/661D1A14-0ECC-0133-0142-004F5DB68A52/phase/6EC42D9A-D1F0-B946-7A61-A6AF8A526884

Please note that the 'castoRedc' project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

You can’t perform that action at this time.