CHOP-CGTInformatics / REDCapTidieR

Makes it easy to read REDCap Projects into R
https://chop-cgtinformatics.github.io/REDCapTidieR/
Other
33 stars 8 forks source link

Create a demo database to make the vignette easier to understand #4

Closed skadauke closed 2 years ago

skadauke commented 2 years ago

Feature Request Description

The current test database is being used to showcase the functionality of REDCapTidieR in the README.Rmd. Let's create a more fun demo database, I'm thinking of this one here → https://www.kaggle.com/claudiodavi/superhero-set/home

Proposed Solution

Let's build a classic database "superheroes" with one record per hero and two instruments: heroes_information (nonrepeating) and superpowers (repeating) and use those to showcase the idea of having different granularities in different instruments.

Checklist

rsh52 commented 2 years ago

Sounds good, everyone loves superheroes and it'll be easier to follow than "repeat/nonrepeat/nonrepeat2." It might be easier to just rename variables and content in the current databases than to make whole new ones.

The current vignette also seems like it was auto-generated from the README and should probably be reworked anyway.

rsh52 commented 2 years ago

I made a test database and formatted/uploaded the heroes information in a non-repeating instrument. I opted to make all of the fields text fields. It would have required a lot of "find and replace"s to change the dataset labels to newly assigned numeric values (i.e. "Marvel Comics" = 1, "Dark Horse" = 2) since REDCap only allows for raw data uploads, not label uploads.

What were your thoughts on how to import the powers dataset? For context: image

Did you have in mind that there would be one question about "power" and it would be set as a repeating instrument? Will probably require a bit of some rework to get this sheet into an importable format.

Other option is to make a way more trimmed down version of this and forgo wrapping our arms around the entire dataset 😅

skadauke commented 2 years ago

Yes I was thinking for rework you can pivot longer then filter for power == TRUE? Would be good to have this as a repeat instrument to demo how redcaptidier handles nonrepeat and repeat tables differently!

Get Outlook for iOShttps://aka.ms/o0ukef


From: Rich Hanna @.> Sent: Wednesday, August 3, 2022 4:58:33 PM To: CHOP-CGTDataOps/REDCapTidieR @.> Cc: Stephan Kadauke @.>; Author @.> Subject: Re: [CHOP-CGTDataOps/REDCapTidieR] Create a demo database to make the vignette easier to understand (Issue #4)

I made a test database and formatted/uploaded the heroes information in a non-repeating instrument. I opted to make all of the fields text fields. It would have required a lot of "find and replace"s to change the dataset labels to newly assigned numeric values (i.e. "Marvel Comics" = 1, "Dark Horse" = 2) since REDCap only allows for raw data uploads, not label uploads.

What were your thoughts on how to import the powers dataset? For context: [image]https://user-images.githubusercontent.com/38384694/182706738-f65bd141-8079-4e67-8fb4-7cf49fa90733.png

Did you have in mind that there would be one question about "power" and it would be set as a repeating instrument? Will probably require a bit of some rework to get this sheet into an importable format.

Other option is to make a way more trimmed down version of this and forgo wrapping our arms around the entire dataset 😅

— Reply to this email directly, view it on GitHubhttps://github.com/CHOP-CGTDataOps/REDCapTidieR/issues/4#issuecomment-1204476446, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACTGHWSOQU2HYQSLYRSMZPDVXLMPTANCNFSM547AE7IQ. You are receiving this because you authored the thread.Message ID: @.***>

rsh52 commented 2 years ago

Just flexed some tidyverse data manipulation magic and imported the super heroes datasets into the REDCap. Just added you as an admin so you should get an e-mail.

Let me know what you think, I tested the code below and got the expected result:

read_redcap_tidy(redcap_uri = Sys.getenv("REDCAP_URI"),
                 token = Sys.getenv("SUPERHEROES_REDCAP_API")) %>% 
  bind_tables()

bind_tables output: image

> heroes_information
# A tibble: 734 × 12
   recor…¹ name  gender eye_c…² race  hair_…³ height weight publi…⁴ skin_…⁵ align…⁶ form_…⁷
     <dbl> <chr> <chr>  <chr>   <chr> <chr>    <dbl>  <dbl> <chr>   <chr>   <chr>     <dbl>
 1       0 A-Bo… Male   yellow  Human No Hair    203    441 Marvel… -       good          0
 2       1 Abe … Male   blue    Icth… No Hair    191     65 Dark H… blue    good          0
 3       2 Abin… Male   blue    Unga… No Hair    185     90 DC Com… red     good          0
 4       3 Abom… Male   green   Huma… No Hair    203    441 Marvel… -       bad           0
 5       4 Abra… Male   blue    Cosm… Black      -99    -99 Marvel… -       bad           0
 6       5 Abso… Male   blue    Human No Hair    193    122 Marvel… -       bad           0
 7       6 Adam… Male   blue    -     Blond      -99    -99 NBC - … -       good          0
 8       7 Adam… Male   blue    Human Blond      185     88 DC Com… -       good          0
 9       8 Agen… Female blue    -     Blond      173     61 Marvel… -       good          0
10       9 Agen… Male   brown   Human Brown      178     81 Marvel… -       good          0
# … with 724 more rows, and abbreviated variable names ¹​record_id, ²​eye_color,
#   ³​hair_color, ⁴​publisher, ⁵​skin_color, ⁶​alignment, ⁷​form_status_complete
# ℹ Use `print(n = ...)` to see more rows
> super_hero_powers
# A tibble: 5,966 × 4
   record_id redcap_repeat_instance power               form_status_complete
       <dbl>                  <dbl> <chr>                              <dbl>
 1         0                      1 Accelerated Healing                    0
 2         0                      2 Durability                             0
 3         0                      3 Longevity                              0
 4         0                      4 Super Strength                         0
 5         0                      5 Stamina                                0
 6         0                      6 Camouflage                             0
 7         0                      7 Self-Sustenance                        0
 8         1                      1 Agility                                0
 9         1                      2 Accelerated Healing                    0
10         1                      3 Cold Resistance                        0
# … with 5,956 more rows
# ℹ Use `print(n = ...)` to see more rows
skadauke commented 2 years ago

I would probably keep the current database as a test database and create a new one for superheroes. Would make it a classic with one nonrepeated instrument (superhero info) and one repreated instrument (superpowers)

Get Outlook for iOShttps://aka.ms/o0ukef


From: Rich Hanna @.> Sent: Friday, July 29, 2022 9:43:38 AM To: CHOP-CGTDataOps/REDCapTidieR @.> Cc: Stephan Kadauke @.>; Author @.> Subject: Re: [CHOP-CGTDataOps/REDCapTidieR] Create a demo database to make the vignette easier to understand (Issue #4)

Sounds good, everyone loves superheroes and it'll be easier to follow than "repeat/nonrepeat/nonrepeat2." It might be easier to just rename variables and content in the current databases than to make whole new ones.

The current vignette also seems like it was auto-generated from the README and should probably be reworked anyway.

— Reply to this email directly, view it on GitHubhttps://github.com/CHOP-CGTDataOps/REDCapTidieR/issues/4#issuecomment-1199302971, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACTGHWWIOZMZCWRTQJ3AX4LVWPNYVANCNFSM547AE7IQ. You are receiving this because you authored the thread.Message ID: @.***>