From d054f5a42053cf5054d3cfd94771b0e7c095f413 Mon Sep 17 00:00:00 2001
From: AG Damsbo
Date: Fri, 14 Apr 2023 11:47:23 +0200
Subject: [PATCH] minor
---
NAMESPACE | 1 +
R/sysdata.rda | Bin 295 -> 291 bytes
data-raw/redcapcast_meta.R | 2 +-
data/redcapcast_meta.rda | Bin 1478 -> 1498 bytes
docs/articles/Introduction.html | 419 +++++++++++++-------------
docs/pkgdown.yml | 2 +-
docs/reference/clean_redcap_name.html | 101 +++++++
docs/reference/index.html | 5 +
docs/reference/redcapcast_data.html | 4 +-
docs/search.json | 2 +-
docs/sitemap.xml | 3 +
man/clean_redcap_name.Rd | 19 ++
man/redcapcast_data.Rd | 4 +-
tests/testthat/helper-paths.R | 2 +
tests/testthat/test-csv-exports.R | 4 +-
vignettes/Introduction.Rmd | 10 +-
16 files changed, 353 insertions(+), 225 deletions(-)
create mode 100644 docs/reference/clean_redcap_name.html
create mode 100644 man/clean_redcap_name.Rd
diff --git a/NAMESPACE b/NAMESPACE
index 1137ebc..6ea6314 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -1,6 +1,7 @@
# Generated by roxygen2: do not edit by hand
export(REDCap_split)
+export(clean_redcap_name)
export(focused_metadata)
export(match_fields_to_form)
export(read_redcap_tables)
diff --git a/R/sysdata.rda b/R/sysdata.rda
index 0299f29acc10d71483fb818db38ea7f631055462..cb869c807e17f73f29c1727e2ea7084776bdf301 100644
GIT binary patch
literal 291
zcmV+;0o?vVT4*^jL0KkKS&c->Y5)LT|A72C_yGVA5C8-K5J120|KI=tFaY|hhJ+(V
zr-CCvrh`Dyh+|C#fEhFfMw%F!Fk(~DqzR&AdPWmW4M(KSH<$;yHlR7dAk%gc-!~H8
z&zBxmTDs2dUc`XFkV8W=Lm&uYdH_K%*6yC-`6aSRpiHU7OKsNFttUG`_fhfW^_Ufg
zq$5ks=yJ*xZE%h#G6ItUCd|W=DlCV_f>UC{TLLb6BZ@Kcz^lg5nyC&E;>ndu_?z2C
zdmNox1{mP@)Jixf(HUg)6E&xJ)`(yoKZk1$9!*aW(i&vbO+8Q57>y4A9TBww&Itx{-{(C#
zxR<*>I61;c!Ey~Db0DD!G$W72+>uTcBr*}%z`*O7dP@KR
diff --git a/data-raw/redcapcast_meta.R b/data-raw/redcapcast_meta.R
index fe9f3f6..23a7dba 100644
--- a/data-raw/redcapcast_meta.R
+++ b/data-raw/redcapcast_meta.R
@@ -1,5 +1,5 @@
## code to prepare `redcapcast_meta` dataset goes here
-redcapcast_meta <- REDCapR::redcap_metadata_read(redcap_uri = uri,
+redcapcast_meta <- REDCapR::redcap_metadata_read(redcap_uri = keyring::key_get("DB_URI"),
token = keyring::key_get("cast_api")
)$data
diff --git a/data/redcapcast_meta.rda b/data/redcapcast_meta.rda
index 35cce09bb5a285dc39077ca0ad2da9e3f12c5268..36c58c9cf3a098f9a45b744b4ce73193957a62a5 100644
GIT binary patch
delta 1483
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
RsG<+JyOJrwgoO3M@nEP-jurp_
diff --git a/docs/articles/Introduction.html b/docs/articles/Introduction.html
index 881bd31..c4dd0ef 100644
--- a/docs/articles/Introduction.html
+++ b/docs/articles/Introduction.html
@@ -91,12 +91,12 @@ demonstration of the functions.
+
@@ -518,14 +518,14 @@ demonstration of the functions.
hypertension |
diabetes |
region |
- base_complete |
+ baseline_data_start_complete |
mrs_assessed |
mrs_date |
mrs_score |
mrs_complete |
event_date |
event_type |
- event_complete |
+ new_event_complete |
@@ -543,14 +543,14 @@ demonstration of the functions.
No |
Yes |
East |
-Incomplete |
+Incomplete |
Yes |
2023-03-13 |
1 |
Incomplete |
NA |
NA |
-NA |
+NA |
2 |
@@ -567,14 +567,14 @@ demonstration of the functions.
No |
No |
South |
-Incomplete |
+Incomplete |
Yes |
2023-03-07 |
1 |
Incomplete |
NA |
NA |
-NA |
+NA |
2 |
@@ -591,19 +591,19 @@ demonstration of the functions.
NA |
NA |
NA |
-NA |
+NA |
Yes |
2023-03-09 |
3 |
Incomplete |
NA |
NA |
-NA |
+NA |
2 |
follow1 |
-Event |
+New Event (?) |
1 |
NA |
NA |
@@ -615,14 +615,14 @@ demonstration of the functions.
NA |
NA |
NA |
-NA |
+NA |
NA |
NA |
NA |
NA |
2023-03-13 |
TIA |
-Incomplete |
+Incomplete |
3 |
@@ -639,14 +639,14 @@ demonstration of the functions.
Yes |
Yes |
North |
-Incomplete |
+Incomplete |
NA |
NA |
NA |
Incomplete |
NA |
NA |
-NA |
+NA |
3 |
@@ -663,14 +663,14 @@ demonstration of the functions.
NA |
NA |
NA |
-NA |
+NA |
Yes |
2022-08-16 |
2 |
Incomplete |
NA |
NA |
-NA |
+NA |
3 |
@@ -687,19 +687,19 @@ demonstration of the functions.
NA |
NA |
NA |
-NA |
+NA |
Yes |
2023-03-13 |
1 |
Incomplete |
NA |
NA |
-NA |
+NA |
3 |
follow1 |
-Event |
+New Event (?) |
1 |
NA |
NA |
@@ -711,19 +711,19 @@ demonstration of the functions.
NA |
NA |
NA |
-NA |
+NA |
NA |
NA |
NA |
NA |
2022-11-08 |
AIS |
-Incomplete |
+Incomplete |
3 |
follow1 |
-Event |
+New Event (?) |
2 |
NA |
NA |
@@ -735,19 +735,19 @@ demonstration of the functions.
NA |
NA |
NA |
-NA |
+NA |
NA |
NA |
NA |
NA |
2022-12-14 |
ICH |
-Incomplete |
+Incomplete |
3 |
follow2 |
-Event |
+New Event (?) |
1 |
NA |
NA |
@@ -759,19 +759,19 @@ demonstration of the functions.
NA |
NA |
NA |
-NA |
+NA |
NA |
NA |
NA |
NA |
2023-02-06 |
ICH |
-Incomplete |
+Incomplete |
3 |
follow2 |
-Event |
+New Event (?) |
2 |
NA |
NA |
@@ -783,19 +783,19 @@ demonstration of the functions.
NA |
NA |
NA |
-NA |
+NA |
NA |
NA |
NA |
NA |
2023-03-13 |
TIA |
-Incomplete |
+Incomplete |
3 |
follow2 |
-Event |
+New Event (?) |
3 |
NA |
NA |
@@ -807,14 +807,14 @@ demonstration of the functions.
NA |
NA |
NA |
-NA |
+NA |
NA |
NA |
NA |
NA |
2023-02-28 |
AIS |
-Incomplete |
+Incomplete |
4 |
@@ -831,14 +831,14 @@ demonstration of the functions.
NA |
NA |
NA |
-Incomplete |
+Incomplete |
NA |
NA |
NA |
Incomplete |
NA |
NA |
-NA |
+NA |
4 |
@@ -855,19 +855,19 @@ demonstration of the functions.
NA |
NA |
NA |
-NA |
+NA |
NA |
NA |
NA |
Incomplete |
NA |
NA |
-NA |
+NA |
4 |
follow2 |
-Event |
+New Event (?) |
1 |
NA |
NA |
@@ -879,19 +879,19 @@ demonstration of the functions.
NA |
NA |
NA |
-NA |
+NA |
NA |
NA |
NA |
NA |
2023-01-02 |
AIS |
-Complete |
+Complete |
4 |
follow2 |
-Event |
+New Event (?) |
2 |
NA |
NA |
@@ -903,19 +903,19 @@ demonstration of the functions.
NA |
NA |
NA |
-NA |
+NA |
NA |
NA |
NA |
NA |
2023-02-06 |
ICH |
-Incomplete |
+Incomplete |
4 |
follow2 |
-Event |
+New Event (?) |
3 |
NA |
NA |
@@ -927,14 +927,14 @@ demonstration of the functions.
NA |
NA |
NA |
-NA |
+NA |
NA |
NA |
NA |
NA |
2023-03-05 |
Unknown |
-Complete |
+Complete |
5 |
@@ -951,26 +951,26 @@ demonstration of the functions.
Yes |
Yes |
East |
-Complete |
+Complete |
NA |
NA |
NA |
Incomplete |
NA |
NA |
-NA |
+NA |
redcapcast_meta |> gt::gt()
-
+
@@ -1400,7 +1400,7 @@ demonstration of the functions.
record_id |
-base |
+baseline_data_start |
NA |
text |
ID |
@@ -1420,7 +1420,7 @@ demonstration of the functions.
cpr |
-base |
+baseline_data_start |
NA |
text |
CPR (Danish civil registration number) |
@@ -1440,7 +1440,7 @@ demonstration of the functions.
inclusion |
-base |
+baseline_data_start |
NA |
text |
Inclusion date |
@@ -1460,7 +1460,7 @@ demonstration of the functions.
dob |
-base |
+baseline_data_start |
NA |
text |
Date of birth (From CPR) |
@@ -1480,7 +1480,7 @@ demonstration of the functions.
age |
-base |
+baseline_data_start |
NA |
calc |
Age
@@ -1501,7 +1501,7 @@ Note: Apparently, the build in datediff() function does not handle counting whol
|
age_integer |
-base |
+baseline_data_start |
NA |
calc |
Age integer
@@ -1522,7 +1522,7 @@ Note: as opposed to the build in datediff() this handles counting years as integ
|
sex |
-base |
+baseline_data_start |
NA |
text |
Legal sex |
@@ -1542,7 +1542,7 @@ Note: as opposed to the build in datediff() this handles counting years as integ
cohabitation |
-base |
+baseline_data_start |
History and social |
radio |
Cohabitation |
@@ -1562,7 +1562,7 @@ Note: as opposed to the build in datediff() this handles counting years as integ
hypertension |
-base |
+baseline_data_start |
NA |
radio |
Hypertension |
@@ -1582,7 +1582,7 @@ Note: as opposed to the build in datediff() this handles counting years as integ
diabetes |
-base |
+baseline_data_start |
NA |
radio |
Diabetes |
@@ -1602,7 +1602,7 @@ Note: as opposed to the build in datediff() this handles counting years as integ
region |
-base |
+baseline_data_start |
Area |
dropdown |
Region |
@@ -1682,7 +1682,7 @@ Note: as opposed to the build in datediff() this handles counting years as integ
event_date |
-event |
+new_event |
NA |
text |
Date of event |
@@ -1702,7 +1702,7 @@ Note: as opposed to the build in datediff() this handles counting years as integ
event_type |
-event |
+new_event |
NA |
radio |
Neurovascular event |
@@ -1725,89 +1725,88 @@ Note: as opposed to the build in datediff() this handles counting years as integ
list <-
- REDCapCAST::REDCap_split(records = redcapcast_data,
+ REDCap_split(records = redcapcast_data,
metadata = redcapcast_meta,
forms = "repeating")
str(list)
#> List of 2
-#> $ :'data.frame': 9 obs. of 20 variables:
-#> ..$ record_id : num [1:9] 1 2 2 3 3 3 4 4 5
-#> ..$ redcap_event_name: chr [1:9] "inclusion" "inclusion" "follow1" "inclusion" ...
-#> ..$ cpr : chr [1:9] "1203401OB4" "0102342303" NA "2301569823" ...
-#> ..$ inclusion : Date[1:9], format: "2023-03-13" "2023-03-01" ...
-#> ..$ dob : Date[1:9], format: "1940-03-12" "1934-02-01" ...
-#> ..$ age : num [1:9] 83 89.1 NA 66.1 NA ...
-#> ..$ age_integer : num [1:9] 83 89 NA 66 NA NA 117 NA 126
-#> ..$ sex : chr [1:9] "female" "male" NA "male" ...
-#> ..$ cohabitation : chr [1:9] "Yes" "Yes" NA "No" ...
-#> ..$ hypertension : chr [1:9] "No" "No" NA "Yes" ...
-#> ..$ diabetes : chr [1:9] "Yes" "No" NA "Yes" ...
-#> ..$ region : chr [1:9] "East" "South" NA "North" ...
-#> ..$ base_complete : chr [1:9] "Incomplete" "Incomplete" NA "Incomplete" ...
-#> ..$ mrs_assessed : chr [1:9] "Yes" "Yes" "Yes" NA ...
-#> ..$ mrs_date : Date[1:9], format: "2023-03-13" "2023-03-07" ...
-#> ..$ mrs_score : num [1:9] 1 1 3 NA 2 1 NA NA NA
-#> ..$ mrs_complete : chr [1:9] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...
-#> ..$ event_date : Date[1:9], format: NA NA ...
-#> ..$ event_type : chr [1:9] NA NA NA NA ...
-#> ..$ event_complete : chr [1:9] NA NA NA NA ...
-#> $ Event:'data.frame': 9 obs. of 4 variables:
+#> $ :'data.frame': 9 obs. of 17 variables:
+#> ..$ record_id : num [1:9] 1 2 2 3 3 3 4 4 5
+#> ..$ redcap_event_name : chr [1:9] "inclusion" "inclusion" "follow1" "inclusion" ...
+#> ..$ cpr : chr [1:9] "1203401OB4" "0102342303" NA "2301569823" ...
+#> ..$ inclusion : Date[1:9], format: "2023-03-13" "2023-03-01" ...
+#> ..$ dob : Date[1:9], format: "1940-03-12" "1934-02-01" ...
+#> ..$ age : num [1:9] 83 89.1 NA 66.1 NA ...
+#> ..$ age_integer : num [1:9] 83 89 NA 66 NA NA 117 NA 126
+#> ..$ sex : chr [1:9] "female" "male" NA "male" ...
+#> ..$ cohabitation : chr [1:9] "Yes" "Yes" NA "No" ...
+#> ..$ hypertension : chr [1:9] "No" "No" NA "Yes" ...
+#> ..$ diabetes : chr [1:9] "Yes" "No" NA "Yes" ...
+#> ..$ region : chr [1:9] "East" "South" NA "North" ...
+#> ..$ baseline_data_start_complete: chr [1:9] "Incomplete" "Incomplete" NA "Incomplete" ...
+#> ..$ mrs_assessed : chr [1:9] "Yes" "Yes" "Yes" NA ...
+#> ..$ mrs_date : Date[1:9], format: "2023-03-13" "2023-03-07" ...
+#> ..$ mrs_score : num [1:9] 1 1 3 NA 2 1 NA NA NA
+#> ..$ mrs_complete : chr [1:9] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...
+#> $ new_event:'data.frame': 9 obs. of 7 variables:
#> ..$ record_id : num [1:9] 2 3 3 3 3 3 4 4 4
#> ..$ redcap_event_name : chr [1:9] "follow1" "follow1" "follow1" "follow2" ...
-#> ..$ redcap_repeat_instrument: chr [1:9] "Event" "Event" "Event" "Event" ...
-#> ..$ redcap_repeat_instance : num [1:9] 1 1 2 1 2 3 1 2 3
+#> ..$ redcap_repeat_instrument: chr [1:9] "new_event" "new_event" "new_event" "new_event" ...
+#> ..$ redcap_repeat_instance : num [1:9] 1 1 2 1 2 3 1 2 3
+#> ..$ event_date : Date[1:9], format: "2023-03-13" "2022-11-08" ...
+#> ..$ event_type : chr [1:9] "TIA" "AIS" "ICH" "ICH" ...
+#> ..$ new_event_complete : chr [1:9] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...
list <-
- REDCapCAST::REDCap_split(records = redcapcast_data,
+ REDCap_split(records = redcapcast_data,
metadata = redcapcast_meta,
forms = "all")
str(list)
-#> List of 4
-#> $ base :'data.frame': 9 obs. of 13 variables:
-#> ..$ record_id : num [1:9] 1 2 2 3 3 3 4 4 5
-#> ..$ redcap_event_name: chr [1:9] "inclusion" "inclusion" "follow1" "inclusion" ...
-#> ..$ cpr : chr [1:9] "1203401OB4" "0102342303" NA "2301569823" ...
-#> ..$ inclusion : Date[1:9], format: "2023-03-13" "2023-03-01" ...
-#> ..$ dob : Date[1:9], format: "1940-03-12" "1934-02-01" ...
-#> ..$ age : num [1:9] 83 89.1 NA 66.1 NA ...
-#> ..$ age_integer : num [1:9] 83 89 NA 66 NA NA 117 NA 126
-#> ..$ sex : chr [1:9] "female" "male" NA "male" ...
-#> ..$ cohabitation : chr [1:9] "Yes" "Yes" NA "No" ...
-#> ..$ hypertension : chr [1:9] "No" "No" NA "Yes" ...
-#> ..$ diabetes : chr [1:9] "Yes" "No" NA "Yes" ...
-#> ..$ region : chr [1:9] "East" "South" NA "North" ...
-#> ..$ base_complete : chr [1:9] "Incomplete" "Incomplete" NA "Incomplete" ...
-#> $ mrs :'data.frame': 9 obs. of 6 variables:
+#> List of 3
+#> $ baseline_data_start:'data.frame': 9 obs. of 13 variables:
+#> ..$ record_id : num [1:9] 1 2 2 3 3 3 4 4 5
+#> ..$ redcap_event_name : chr [1:9] "inclusion" "inclusion" "follow1" "inclusion" ...
+#> ..$ cpr : chr [1:9] "1203401OB4" "0102342303" NA "2301569823" ...
+#> ..$ inclusion : Date[1:9], format: "2023-03-13" "2023-03-01" ...
+#> ..$ dob : Date[1:9], format: "1940-03-12" "1934-02-01" ...
+#> ..$ age : num [1:9] 83 89.1 NA 66.1 NA ...
+#> ..$ age_integer : num [1:9] 83 89 NA 66 NA NA 117 NA 126
+#> ..$ sex : chr [1:9] "female" "male" NA "male" ...
+#> ..$ cohabitation : chr [1:9] "Yes" "Yes" NA "No" ...
+#> ..$ hypertension : chr [1:9] "No" "No" NA "Yes" ...
+#> ..$ diabetes : chr [1:9] "Yes" "No" NA "Yes" ...
+#> ..$ region : chr [1:9] "East" "South" NA "North" ...
+#> ..$ baseline_data_start_complete: chr [1:9] "Incomplete" "Incomplete" NA "Incomplete" ...
+#> $ mrs :'data.frame': 9 obs. of 6 variables:
#> ..$ record_id : num [1:9] 1 2 2 3 3 3 4 4 5
#> ..$ redcap_event_name: chr [1:9] "inclusion" "inclusion" "follow1" "inclusion" ...
#> ..$ mrs_assessed : chr [1:9] "Yes" "Yes" "Yes" NA ...
#> ..$ mrs_date : Date[1:9], format: "2023-03-13" "2023-03-07" ...
#> ..$ mrs_score : num [1:9] 1 1 3 NA 2 1 NA NA NA
#> ..$ mrs_complete : chr [1:9] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...
-#> $ event:'data.frame': 9 obs. of 5 variables:
-#> ..$ record_id : num [1:9] 1 2 2 3 3 3 4 4 5
-#> ..$ redcap_event_name: chr [1:9] "inclusion" "inclusion" "follow1" "inclusion" ...
-#> ..$ event_date : Date[1:9], format: NA NA ...
-#> ..$ event_type : chr [1:9] NA NA NA NA ...
-#> ..$ event_complete : chr [1:9] NA NA NA NA ...
-#> $ Event:'data.frame': 9 obs. of 4 variables:
+#> $ new_event :'data.frame': 9 obs. of 7 variables:
#> ..$ record_id : num [1:9] 2 3 3 3 3 3 4 4 4
#> ..$ redcap_event_name : chr [1:9] "follow1" "follow1" "follow1" "follow2" ...
-#> ..$ redcap_repeat_instrument: chr [1:9] "Event" "Event" "Event" "Event" ...
-#> ..$ redcap_repeat_instance : num [1:9] 1 1 2 1 2 3 1 2 3
+#> ..$ redcap_repeat_instrument: chr [1:9] "new_event" "new_event" "new_event" "new_event" ...
+#> ..$ redcap_repeat_instance : num [1:9] 1 1 2 1 2 3 1 2 3
+#> ..$ event_date : Date[1:9], format: "2023-03-13" "2022-11-08" ...
+#> ..$ event_type : chr [1:9] "TIA" "AIS" "ICH" "ICH" ...
+#> ..$ new_event_complete : chr [1:9] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...
Reading data from REDCap
This function wraps all the above demonstrated function to get the
dataset, the metadata, apply the REDCap_split
function and
-then a bit of cleaning.
+then a bit of cleaning. It just cuts outs all the steps for an easier
+approach.
The function works very similar to the
-REDCapR::redcap_read()
.
+
REDCapR::redcap_read()
in allowing to specify fields,
+events and forms for export instead of exporting the whole database and
+filtering afterwards. I believe this is a better and safer, focused
+approach.
-# read_redcap_tables(uri = "YOUR URI", token = "YOUR TOKEN")
-
-# ds <- read_redcap_tables(uri = key_get("DB_URI"), token = key_get("cast_api"))
+
# read_redcap_tables(uri = "YOUR URI", token = "YOUR TOKEN")