addition of REDCap data conversion work
This commit is contained in:
parent
7e3e24e195
commit
2e1f38c26e
2
.gitignore
vendored
2
.gitignore
vendored
@ -42,3 +42,5 @@ vignettes/*.pdf
|
||||
/data/
|
||||
/data/*.xls
|
||||
/data/*.csv
|
||||
|
||||
/REDCap/*.csv
|
||||
|
BIN
REDCap/.DS_Store
vendored
Normal file
BIN
REDCap/.DS_Store
vendored
Normal file
Binary file not shown.
24
REDCap/attr/attr_BI.csv
Normal file
24
REDCap/attr/attr_BI.csv
Normal file
@ -0,0 +1,24 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_BI00","Dato for udfyldelse"
|
||||
"TALOS_BI01","Spisning"
|
||||
"TALOS_BI02","Forflytning"
|
||||
"TALOS_BI03","Personlig hygiejne"
|
||||
"TALOS_BI04","Toiletbesøg"
|
||||
"TALOS_BI05","Tage bad"
|
||||
"TALOS_BI06","Gangfunktion"
|
||||
"TALOS_BI07","Trappegang"
|
||||
"TALOS_BI08","Påklædning"
|
||||
"TALOS_BI09","Tarmkontrol"
|
||||
"TALOS_BI10","Blærekontrol"
|
||||
"TALOS_BI11","No attr"
|
||||
"TALOS_BI12","Skemaet udfyldt af forsøgsdeltageren selv"
|
||||
"TALOS_BI12x","Hvis nej, hvem har udfyldt"
|
||||
"TALOS_BI13x","Evt. kommentar"
|
|
13
REDCap/attr/attr_LOCF.csv
Normal file
13
REDCap/attr/attr_LOCF.csv
Normal file
@ -0,0 +1,13 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_CREATEDDATE","No attr"
|
||||
"SYS_ID","No attr"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"TALOS_LOCF00","Dato"
|
||||
"TALOS_LOCF01","Last-observation carried forward"
|
||||
"TALOS_LOCF01a","Evt. beskrivelse"
|
|
33
REDCap/attr/attr_MFI.csv
Normal file
33
REDCap/attr/attr_MFI.csv
Normal file
@ -0,0 +1,33 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_MFI00","Dato for udfyldelse"
|
||||
"TALOS_MFI01","Jeg føler mig veloplagt"
|
||||
"TALOS_MFI02","Fysisk kan jeg ikke gøre ret meget"
|
||||
"TALOS_MFI03","Jeg føler mig meget aktiv"
|
||||
"TALOS_MFI04","Jeg har lyst til at gøre alle mulige rare ting"
|
||||
"TALOS_MFI05","Jeg føler mig træt"
|
||||
"TALOS_MFI06","Jeg synes, jeg laver meget på en dag"
|
||||
"TALOS_MFI07","Når jeg laver noget, kan jeg fastholde tankerne på det"
|
||||
"TALOS_MFI08","Fysisk kan jeg overkomme meget"
|
||||
"TALOS_MFI09","Jeg gruer for at skulle lave noget"
|
||||
"TALOS_MFI10","Jeg synes, jeg laver meget lidt på en dag"
|
||||
"TALOS_MFI11","Jeg kan sagtens koncentrere mig"
|
||||
"TALOS_MFI12","Jeg er udhvilet"
|
||||
"TALOS_MFI13","Jeg skal anstrenge mig meget for at koncentrere mig om noget"
|
||||
"TALOS_MFI14","Fysisk føler jeg mig i dårlig form"
|
||||
"TALOS_MFI15","Jeg har mange planer"
|
||||
"TALOS_MFI16","Jeg bliver nemt træt"
|
||||
"TALOS_MFI17","Jeg får næsten ikke lavet noget"
|
||||
"TALOS_MFI18","Jeg har ikke lyst til at lave noget"
|
||||
"TALOS_MFI19","Jeg bliver let adspredt"
|
||||
"TALOS_MFI20","Fysisk føler jeg mig i vældig god form"
|
||||
"TALOS_MFI21","Resultat"
|
||||
"TALOS_MFI22","Skemaet udfyldt af forsøgsdeltageren selv"
|
||||
"TALOS_MFI22x","Hvis nej, hvem har udfyldt"
|
|
18
REDCap/attr/attr_NA.csv
Normal file
18
REDCap/attr/attr_NA.csv
Normal file
@ -0,0 +1,18 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"hojde","No attr"
|
||||
"vaegt","No attr"
|
||||
"vaegt_anslaaet","No attr"
|
||||
"rygning","No attr"
|
||||
"alkohol","No attr"
|
||||
"civil","No attr"
|
||||
"bolig","No attr"
|
||||
"diabetes","No attr"
|
||||
"hyperten","No attr"
|
||||
"perifer_arteriel","No attr"
|
||||
"atriefli","No attr"
|
||||
"ami","No attr"
|
||||
"tidl_tci","No attr"
|
||||
"trombolyse","No attr"
|
||||
"trombektomi","No attr"
|
||||
"nhiss_foer","No attr"
|
|
26
REDCap/attr/attr_NIHSS.csv
Normal file
26
REDCap/attr/attr_NIHSS.csv
Normal file
@ -0,0 +1,26 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_NIHSS00","Dato"
|
||||
"TALOS_NIHSS01","1a. Bevidsthedsniveau"
|
||||
"TALOS_NIHSS02","1b. Spørg pt. om aktuel måned og alder"
|
||||
"TALOS_NIHSS03","1c. Bed pt. åbne og lukke øjne og knyt og åbn hånden"
|
||||
"TALOS_NIHSS04","2. Horisontal øjenbevægelse"
|
||||
"TALOS_NIHSS05","3. Synsfelt"
|
||||
"TALOS_NIHSS06","4. Facialisfunktion"
|
||||
"TALOS_NIHSS07","5a. Motorisk funktion i højre arm"
|
||||
"TALOS_NIHSS08","5b. Motorisk funktion i venstre arm"
|
||||
"TALOS_NIHSS09","6a. Motorisk funktion i højre ben"
|
||||
"TALOS_NIHSS10","6b. Motorisk funktion i venstre ben"
|
||||
"TALOS_NIHSS11","7. Ekstremitets ataksi"
|
||||
"TALOS_NIHSS12","8. Sensorisk"
|
||||
"TALOS_NIHSS13","9. Bedste sprogfunktion"
|
||||
"TALOS_NIHSS14","10. Dysartri"
|
||||
"TALOS_NIHSS15","11. Extinction and Inattention (formerly Neglect)"
|
||||
"TALOS_NIHSS16","NIHSS Score"
|
|
38
REDCap/attr/attr_PASE.csv
Normal file
38
REDCap/attr/attr_PASE.csv
Normal file
@ -0,0 +1,38 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_PASE00","Dato for udfyldelse"
|
||||
"TALOS_PASE01","1. Hvor ofte har du i de sidste 7 dage inden indlæggelsen foretaget dig stillesi"
|
||||
"TALOS_PASE01ax","1a. Hvilke aktiviteter"
|
||||
"TALOS_PASE01b","1b. Hvor mange timer har du gennemsnitlig været beskæftiget med disse aktivitete"
|
||||
"TALOS_PASE02","2. Hvor ofte har du i de sidste 7 dage inden indlæggelsen, gået en tur udenfor h"
|
||||
"TALOS_PASE02a","2a. Hvor mange timer har du gennemsnitlig været beskæftiget med disse aktivitete"
|
||||
"TALOS_PASE03","3. Hvor ofte har du i de sidste 7 dage inden indlæggelsen, deltaget i lette spor"
|
||||
"TALOS_PASE03ax","3a. Hvilke aktiviteter"
|
||||
"TALOS_PASE03b","3b. Hvor mange timer har du gennemsnitlig været beskæftiget med disse aktivitete"
|
||||
"TALOS_PASE04","4. Hvor ofte har du i de sidste 7 dage inden indlæggelsen, deltaget i moderate s"
|
||||
"TALOS_PASE04ax","4a. Hvilke aktiviteter"
|
||||
"TALOS_PASE04b","4b. Hvor mange timer har du gennemsnitlig været beskæftiget med disse aktivitete"
|
||||
"TALOS_PASE05","5. Hvor ofte har du i de sidste 7 dage inden indlæggelsen, deltaget i anstrengen"
|
||||
"TALOS_PASE05ax","5a. Hvilke aktiviteter"
|
||||
"TALOS_PASE05b","5b. Hvor mange timer har du gennemsnitlig været beskæftiget med disse aktivitete"
|
||||
"TALOS_PASE06","6. Hvor ofte har du i de sidste 7 dage inden indlæggelsen lavet styrketræning sp"
|
||||
"TALOS_PASE06ax","6a. Hvilke aktiviteter"
|
||||
"TALOS_PASE06b","6b. Hvor mange timer har du gennemsnitlig været beskæftiget med disse aktivitete"
|
||||
"TALOS_PASE07","7. Har du inden for de sidste 7 dage inden indlæggelsen udført lette former for"
|
||||
"TALOS_PASE08","8. Har du inden for de sidste 7 dage inden indlæggelsen udført anstrengende form"
|
||||
"TALOS_PASE09a","9a. Vedligeholdelse af hjemmet, såsom at male, tapetsere, udføre el-installation"
|
||||
"TALOS_PASE09b","9b. Slå græs, feje fortov, skovle sne el. blade, save brænde eller lignende<br><"
|
||||
"TALOS_PASE09c","9c. Udendørs havearbejde"
|
||||
"TALOS_PASE09d","9d. Pleje af personer, såsom børn, afhængige familiemedlemmer eller andre voksne"
|
||||
"TALOS_PASE10","10. Har du i de sidste 7 dage inden indlæggelsen været på arbejde eller udført f"
|
||||
"TALOS_PASE10a","10a. Hvor mange timer om ugen har du arbejdet betalt eller som frivillig"
|
||||
"TALOS_PASE10b","10b. Hvilken af følgende kategorier beskriver bedst det niveau af fysisk aktivit"
|
||||
"TALOS_PASE12","Skemaet udfyldt af forsøgsdeltageren selv"
|
||||
"TALOS_PASE12x","Hvis nej, hvem har udfyldt"
|
|
13
REDCap/attr/attr_SDMT.csv
Normal file
13
REDCap/attr/attr_SDMT.csv
Normal file
@ -0,0 +1,13 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"instance","No attr"
|
||||
"TALOS_SDMT00","Dato for udfyldelse"
|
||||
"TALOS_SDMT01","SDMT udfyldt"
|
||||
"TALOS_SDMT01a","Antal korrekte"
|
||||
"TALOS_SDMT01b","Antal passerede"
|
|
32
REDCap/attr/attr_ae.csv
Normal file
32
REDCap/attr/attr_ae.csv
Normal file
@ -0,0 +1,32 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"instance","No attr"
|
||||
"instance2","No attr"
|
||||
"eventdate","Dato (evt. anslået) for hændelsens-/bivirkningens opståen"
|
||||
"description","Beskrivelse"
|
||||
"continuation","Kontinuation"
|
||||
"seriousA","Død"
|
||||
"deathdate","Dødsdato"
|
||||
"seriousB","Livstruende tilstand"
|
||||
"seriousC","Hospitalisering eller forlængelse af hospitalisering"
|
||||
"seriousD","Invaliditet eller væsentlig funktionsnedsættelse"
|
||||
"seriousE","Medfødt misdannelse eller fosterskade"
|
||||
"seriousF","Anden vigtig medicinsk hændelse"
|
||||
"related","Hændelsens/bivirkningens relation til forsøgsmedicin"
|
||||
"expected","Var hændelsen/bivirkningen forventet"
|
||||
"awaredate","Hvornår kom bivirkningen til investigators kendskab"
|
||||
"awaretime","Hvornår kom bivirkningen til investigators kendskab"
|
||||
"actionA","Er der foretaget handling hvad angår forsøgsmedicin"
|
||||
"actionB","Er der ændret i doseringen af anden medicin"
|
||||
"actionC","Er der opstartet ny medicin"
|
||||
"status","Hvad er aktuel status"
|
||||
"closed","Skal forløbet afsluttes nu"
|
||||
"CLF","No attr"
|
||||
"CLFint","Hvad er hændelsen"
|
||||
"sponsor","Har sponsor kontrolleret hændelsen"
|
|
22
REDCap/attr/attr_basis.csv
Normal file
22
REDCap/attr/attr_basis.csv
Normal file
@ -0,0 +1,22 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"TALOS_basis00","Dato"
|
||||
"TALOS_basis01","Symptomdebut"
|
||||
"TALOS_basis01a","Dato"
|
||||
"TALOS_basis01b","Klokkeslæt"
|
||||
"TALOS_basis02","Indlæggelsestidspunkt"
|
||||
"TALOS_basis02a","Dato"
|
||||
"TALOS_basis02b","Klokkeslæt"
|
||||
"TALOS_basis03","Første medicindosis"
|
||||
"TALOS_basis03a","Dato"
|
||||
"TALOS_basis03b","Klokkeslæt"
|
||||
"TALOS_basis05","Etnicitet"
|
||||
"TALOS_basis05x","Specificer"
|
||||
"TALOS_basis06","Iskæmisk type"
|
||||
"kon","Køn"
|
|
19
REDCap/attr/attr_begr.csv
Normal file
19
REDCap/attr/attr_begr.csv
Normal file
@ -0,0 +1,19 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_begr00","Dato"
|
||||
"TALOS_begr01","Ny event"
|
||||
"TALOS_begr02","Bivirkninger"
|
||||
"TALOS_begr03","Dosisjustering"
|
||||
"TALOS_begr04","Socialmedicinske grunde"
|
||||
"TALOS_begr04x","Beskriv"
|
||||
"TALOS_begr05","Tryghedsgrunde"
|
||||
"TALOS_begr05x","Beskriv"
|
||||
"TALOS_begr06","Andet"
|
||||
"TALOS_begr06x","Beskriv"
|
|
28
REDCap/attr/attr_blod.csv
Normal file
28
REDCap/attr/attr_blod.csv
Normal file
@ -0,0 +1,28 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_blod00","Dato"
|
||||
"TALOS_blod01","ALAT taget"
|
||||
"TALOS_blod01a","ALAT i øvre normalområde eller over"
|
||||
"TALOS_blod01aa","Noter"
|
||||
"TALOS_blod02","S-natrium taget"
|
||||
"TALOS_blod02a","S-natrium i nedre del eller under normalområde"
|
||||
"TALOS_blod02aa","Noter"
|
||||
"TALOS_blod03","eGFR taget"
|
||||
"TALOS_blod03a","eGFR i nedre normalområde eller under (<60 ml/min)"
|
||||
"TALOS_blod03aa","Noter"
|
||||
"TALOS_blod04","Andre blodprøver taget"
|
||||
"TALOS_blod04x","Beskriv"
|
||||
"TALOS_blod05x","Andet, beskriv"
|
||||
"TALOS_blod06","EKG taget"
|
||||
"TALOS_blod06a","EKG normalt"
|
||||
"TALOS_blod06b","EKG med grænseforlænget QTc"
|
||||
"TALOS_blod06ba","Noter"
|
||||
"TALOS_blod06c","EKG med QTc forlænget = 480 ms"
|
||||
"TALOS_blod07x","Andet, beskriv"
|
|
15
REDCap/attr/attr_drop.csv
Normal file
15
REDCap/attr/attr_drop.csv
Normal file
@ -0,0 +1,15 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"TALOS_drop00","Dato"
|
||||
"TALOS_drop01","Ønsker ikke længere at deltage"
|
||||
"TALOS_drop02","Uacceptable bivirkninger"
|
||||
"TALOS_drop03","Behov for åben antidepressiv behandling"
|
||||
"TALOS_drop04","Uacceptable bivirkninger"
|
||||
"TALOS_drop05","Udføres afsluttende kontrol"
|
||||
"TALOS_drop06","Har pt været inkluderet i eller mere end 31 dage"
|
|
11
REDCap/attr/attr_end.csv
Normal file
11
REDCap/attr/attr_end.csv
Normal file
@ -0,0 +1,11 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"TALOS_end00","Dato"
|
||||
"TALOS_end01","Afsluttet før tid"
|
||||
"TALSO_end02x","Kommentarer"
|
|
20
REDCap/attr/attr_fmed.csv
Normal file
20
REDCap/attr/attr_fmed.csv
Normal file
@ -0,0 +1,20 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_FmedA01","Udleveringsdato"
|
||||
"TALOS_FmedA02a","Batch-nummer"
|
||||
"TALOS_FmedA02b","Udløbsdato"
|
||||
"TALOS_FmedA03","Antal udleverede tabletter"
|
||||
"TALOS_FmedA04","Udleveret af..."
|
||||
"TALOS_FmedB01","Restmedicin"
|
||||
"TALOS_FmedB02","Antal tabletter tilbage"
|
||||
"TALOS_FmedB03","Kompliant"
|
||||
"TALOS_FmedB04","Modtaget af..."
|
||||
"TALOS_FmedB05","Er de resterende tabletter afleveret"
|
||||
"TALOS_FmedB06","Er de eventuelle resterende tabletter destrueret"
|
|
9
REDCap/attr/attr_fri.csv
Normal file
9
REDCap/attr/attr_fri.csv
Normal file
@ -0,0 +1,9 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"TALOS_fri01x","Fritekst"
|
|
11
REDCap/attr/attr_gloD.csv
Normal file
11
REDCap/attr/attr_gloD.csv
Normal file
@ -0,0 +1,11 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_gloD00","Dato"
|
||||
"TALOS_gloD01","Angiv depressionsgradering"
|
|
15
REDCap/attr/attr_grad.csv
Normal file
15
REDCap/attr/attr_grad.csv
Normal file
@ -0,0 +1,15 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_grad00","Dato"
|
||||
"TALOS_grad01","Har patienten nemmere til tårer end tidligere"
|
||||
"TALOS_grad02","Forekommer der overrumplende anfald af gråd"
|
||||
"TALOS_grad03","Forekommer der gråd uden grund eller for voldsomt i forhold til en følelse"
|
||||
"TALOS_grad04","Forekommer der gråd ukontrolleret i social sammenhæng"
|
||||
"TALOS_grad05","Resultat"
|
|
13
REDCap/attr/attr_gvd.csv
Normal file
13
REDCap/attr/attr_gvd.csv
Normal file
@ -0,0 +1,13 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_gvd00","Dato for udfyldelse"
|
||||
"TALOS_gloD01","Hvor deprimeret er du i dag"
|
||||
"TALOS_gvd02","Skemaet udfyldt af forsøgsdeltageren selv"
|
||||
"TALOS_gvd02x","Hvis nej, hvem har udfyldt"
|
|
20
REDCap/attr/attr_ham.csv
Normal file
20
REDCap/attr/attr_ham.csv
Normal file
@ -0,0 +1,20 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_ham00","Dato for udfyldelse"
|
||||
"TALOS_ham01","1. Gennem de sidste 3 dage..."
|
||||
"TALOS_ham02","2. Gennem de sidste 3 dage..."
|
||||
"TALOS_ham03","3. Gennem de sidste 3 dage..."
|
||||
"TALOS_ham04","4. Gennem de sidste 3 dage..."
|
||||
"TALOS_ham05","5. Gennem de sidste 3 dage..."
|
||||
"TALOS_ham06","6. Gennem de sidste 3 dage..."
|
||||
"TALOS_ham07","Resultat"
|
||||
"TALOS_ham08","Resultat"
|
||||
"TALOS_ham09","Skemaet udfyldt af forsøgsdeltageren selv"
|
||||
"TALOS_ham09x","Hvis nej, hvem har udfyldt"
|
|
16
REDCap/attr/attr_inkl.csv
Normal file
16
REDCap/attr/attr_inkl.csv
Normal file
@ -0,0 +1,16 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat.x","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"rdate","No attr"
|
||||
"TALOS_inkl01","Kan pt. indgå under hensyntagen til inklusionskriterierne"
|
||||
"TALOS_inkl02","Kan pt. indgå under hensyntagen til eksklusionskriterierne"
|
||||
"TALOS_inkl03x","Navn"
|
||||
"rnumb","Randomiseringsnummer"
|
||||
"rtreat.y","Tildelt behandling"
|
||||
"TALOS_inkl04","Inkluderes patienten?"
|
||||
"TALOS_inkl04x","Hvorfor ikke?"
|
|
11
REDCap/attr/attr_kodebrud.csv
Normal file
11
REDCap/attr/attr_kodebrud.csv
Normal file
@ -0,0 +1,11 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"Rnumb","No attr"
|
||||
"Rtreat","No attr"
|
||||
"Reason","No attr"
|
|
18
REDCap/attr/attr_komp.csv
Normal file
18
REDCap/attr/attr_komp.csv
Normal file
@ -0,0 +1,18 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_komp00","Dato"
|
||||
"TALOS_komp01","Blødningskomplikationer"
|
||||
"TALOS_komp02","Vaskulær død"
|
||||
"TALOS_komp03","TCI/Re-stroke"
|
||||
"TALOS_komp04","STEMI"
|
||||
"TALOS_komp05","Død uanset årsag"
|
||||
"TALOS_komp06","AKS"
|
||||
"TALOS_komp07","PSD"
|
||||
"TALOS_komp08x","Eventuelle bemærkninger"
|
|
14
REDCap/attr/attr_konk.csv
Normal file
14
REDCap/attr/attr_konk.csv
Normal file
@ -0,0 +1,14 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_konk00","Dato"
|
||||
"TALOS_konk01","Har patienten iht. protokollen fuldført studiet"
|
||||
"TALOS_konk02","Vurderes patienten at have behov for antidepressiv medicinsk behandling"
|
||||
"TALOS_konk02xa","Angiv præparat"
|
||||
"TALOS_konk02xb","Dosis der overgåes til"
|
|
26
REDCap/attr/attr_mdi.csv
Normal file
26
REDCap/attr/attr_mdi.csv
Normal file
@ -0,0 +1,26 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_mdi00","Dato"
|
||||
"TALOS_mdi01","Har du følt dig trist til mode, ked af det"
|
||||
"TALOS_mdi02","Har du mangler interesse for dine daglige gøremål"
|
||||
"TALOS_mdi03","Har du følt, at du manglede energi og kræfter"
|
||||
"TALOS_mdi04","Har du haft mindre selvtillid"
|
||||
"TALOS_mdi05","Har du haft dårlig samvittighed eller skyldsfølelse"
|
||||
"TALOS_mdi06","Har du følt, at livet ikke var værd at leve"
|
||||
"TALOS_mdi07","Har du haft besvær med at koncentrere dig, f.eks. at læse avis eller følge med i"
|
||||
"TALOS_mdi08a","Har du følt dig rastløs"
|
||||
"TALOS_mdi08b","Har du følt dig mere stille"
|
||||
"TALOS_mdi09","Har du haft besvær med at sove om natten"
|
||||
"TALOS_mdi10a","Har du haft nedsat appetit"
|
||||
"TALOS_mdi10b","Har du haft øget appetit"
|
||||
"TALOS_mdi11","Resultat"
|
||||
"TALOS_mdi12","Resultat"
|
||||
"TALOS_mdi13","Skemaet udfyldt af forsøgsdeltageren selv"
|
||||
"TALOS_mdi13x","Hvis nej, hvem har udfyldt"
|
|
17
REDCap/attr/attr_medicin.csv
Normal file
17
REDCap/attr/attr_medicin.csv
Normal file
@ -0,0 +1,17 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"medicin00","Registreringsdato"
|
||||
"medicin01a","Citalopram/Placebo"
|
||||
"medicin01b","ATC kode"
|
||||
"medicin02a","Doegndosis"
|
||||
"medicin02b","Enhed"
|
||||
"medicin02c","Dosering"
|
||||
"medicin03a","Er patienten opstartet indenfor 3 måneder"
|
||||
"medicin03b","(ca) opstarts dato"
|
|
25
REDCap/attr/attr_mmse.csv
Normal file
25
REDCap/attr/attr_mmse.csv
Normal file
@ -0,0 +1,25 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_mmse00","Dato"
|
||||
"TALOS_mmse01","Hvilket/n årstal, årstid, dato, ugedag, måned"
|
||||
"TALOS_mmse02","2. Hvor er vi, Land, by region, hospital etage"
|
||||
"TALOS_mmse03","3. Registrering, nævn tre genstande, 1 point for hver korrekt svar"
|
||||
"TALOS_mmse03a","Antal forsøg"
|
||||
"TALOS_mmse04","4. Opmærksomhed og regning"
|
||||
"TALOS_mmse05","5. Genkaldelse, spørg inden om de 3 tidligere nævnte genstande"
|
||||
"TALOS_mmse06","6. Sprog, benævn de to genstande"
|
||||
"TALOS_mmse07","Gentag"
|
||||
"TALOS_mmse08","8. 3-leddet kommando tag papiret med højre hånd, læg det sammen på midten og ned"
|
||||
"TALOS_mmse09","9. Læs dette, og gør, hvad der står Se bilag luk øjnene"
|
||||
"TALOS_mmse10","10. Skriv en sætning 1 point hvis meningsfuld og har både udsagnsord og navneord"
|
||||
"TALOS_mmse11","Kopiering - Bed patienten kopiere figuren på bilaget"
|
||||
"TALOS_mmse12","Samlet score"
|
||||
"TALOS_mmse13","Skemaet udfyldt af forsøgsdeltageren selv"
|
||||
"TALOS_mmse13x","Hvis nej, hvem har udfyldt"
|
|
11
REDCap/attr/attr_mrs.csv
Normal file
11
REDCap/attr/attr_mrs.csv
Normal file
@ -0,0 +1,11 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_mrs00","Dato"
|
||||
"TALOS_mrs01","Angiv mRS"
|
|
20
REDCap/attr/attr_preD.csv
Normal file
20
REDCap/attr/attr_preD.csv
Normal file
@ -0,0 +1,20 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_preD00","Dato"
|
||||
"TALOS_preD01","Sænket stemningsleje"
|
||||
"TALOS_preD02","Nedsat lyst og interesse"
|
||||
"TALOS_preD03","Øget trætbarhed og nedsat energi"
|
||||
"TALOS_preD04","Nedsat selvtillid og selvfølelse"
|
||||
"TALOS_preD05","Skyldfølelse og urimelige selvbebrejdelser"
|
||||
"TALOS_preD06","Tanker om, at det var bedre, at man var død/tanker som selvmord"
|
||||
"TALOS_preD07","Koncentrationsbesvær/kan ikke tænke klart"
|
||||
"TALOS_preD08","Urolig og hvileløs eller gået i stå i bevægelser"
|
||||
"TALOS_preD09","Sover mere eller mindre end vanligt"
|
||||
"TALOS_preD10","Mindre appetit og vægttab eller trøstespiser og vægtøgning"
|
||||
"TALOS_preD11","Resultat"
|
|
14
REDCap/attr/attr_soc.csv
Normal file
14
REDCap/attr/attr_soc.csv
Normal file
@ -0,0 +1,14 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_soc00","Dato for udfyldelse"
|
||||
"TALOS_soc01","Skilsmisse"
|
||||
"TALOS_soc02","Arbejdsløshed"
|
||||
"TALOS_soc03","Flytning"
|
||||
"TALOS_soc04","Dødsfald eller alvorlig sygdom i nærmeste familie"
|
|
19
REDCap/attr/attr_who.csv
Normal file
19
REDCap/attr/attr_who.csv
Normal file
@ -0,0 +1,19 @@
|
||||
"names","attr"
|
||||
"record_id","Randomiseringsnummer"
|
||||
"cpr","No attr"
|
||||
"rtreat","Tildelt behandling"
|
||||
"SYS_DATE","No attr"
|
||||
"SYS_SITE","No attr"
|
||||
"SYS_USER","No attr"
|
||||
"SYS_LOCK","No attr"
|
||||
"INSTANCE","No attr"
|
||||
"TALOS_who00","Dato for udfyldelse"
|
||||
"TALOS_who01","Har været glad og i godt humør"
|
||||
"TALOS_who02","Har følt mig rolig og afslappet"
|
||||
"TALOS_who03","Har følt mig aktiv og energisk"
|
||||
"TALOS_who04","Har vågnet frisk og udhvilet"
|
||||
"TALOS_who05","Har min dagligdag været fyldt med ting, der interesserer mig"
|
||||
"TALOS_who06","Raw-score"
|
||||
"TALOS_who07","%"
|
||||
"TALOS_who08","Skemaet udfyldt af forsøgsdeltageren selv"
|
||||
"TALOS_who08x","Hvis nej, hvem har udfyldt"
|
|
258
REDCap/convert_redcap.R
Normal file
258
REDCap/convert_redcap.R
Normal file
@ -0,0 +1,258 @@
|
||||
## Bulk conversion of stata files to CSV
|
||||
library(haven)
|
||||
library(dplyr)
|
||||
|
||||
|
||||
## Export output files??
|
||||
exp_out=TRUE
|
||||
id_data=c("record_id","cpr","rtreat") # Data from keyfile is all marked as identifier
|
||||
auto_upload=FALSE
|
||||
|
||||
## Loading filenames
|
||||
setwd("/Volumes/Data/")
|
||||
files<-list.files("STATA13/.", pattern="*.dta", full.names=FALSE)
|
||||
|
||||
## Loading randomisation key file, keeping only necessary variables,
|
||||
## renaming rnumb to record_id
|
||||
key<-as_factor(read_dta("/Volumes/Data/STATA13/inkl_rev_v13.dta")) %>%
|
||||
filter(.,rnumb!="999") %>%
|
||||
select(.,c("rnumb","cpr","rtreat")) %>%
|
||||
rename(.,record_id=rnumb)
|
||||
|
||||
## Excluding undesired datasets
|
||||
## DAP, logfile, randomisation log, randomisation key
|
||||
## These will be kept and uploaded seperately
|
||||
files<-files[!grepl("dap",files)&
|
||||
!grepl("transactions",files)&
|
||||
!grepl("rand",files)]
|
||||
|
||||
## Get "first name" from all files
|
||||
fnames<-sapply(strsplit(files, "[_]"),"[[",1) # Just discovered the subset functions "[" and "[[". Wow!
|
||||
|
||||
## Loading data sets to list
|
||||
ls<-list()
|
||||
for (i in 1:length(files)){
|
||||
## Get dataset, factorise labels,
|
||||
## join with key-file, drop cpr and remove NA's
|
||||
d<-left_join(key,
|
||||
as_factor(read_dta(paste0("STATA13/",files[i]))),by="cpr") %>%
|
||||
# select(.,!"cpr") %>%
|
||||
filter(.,!is.na(SYS_SITE)) ## SYS_DATA is in all sets, but fmed, uses SYS_SITE
|
||||
d<-data.frame(d)
|
||||
|
||||
## Append dataframe to list
|
||||
ls[[i]]<-d
|
||||
names(ls)[i]<-fnames[i]
|
||||
|
||||
## Export original data frame
|
||||
if (exp_out){
|
||||
write.csv(d,paste0("REDCap/orig/",fnames[i],".csv"),row.names = FALSE)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
## DAP variables to include, incl record_id
|
||||
vars<-c("record_id","hojde","vaegt","vaegt_anslaaet","rygning","alkohol","civil",
|
||||
"bolig","diabetes","hyperten","perifer_arteriel","atriefli","ami",
|
||||
"tidl_tci","trombolyse","trombektomi","nhiss_foer")
|
||||
|
||||
# ## Importing and subsetting DAP-data- All in one style
|
||||
|
||||
dap_d<-read_dta("/Volumes/Data/STATA13/dap_rapport_2017.dta") %>% ## Loading file with correct name
|
||||
filter(.,!duplicated(cpr))%>% ## Limiting to first event
|
||||
left_join(key,.,by="cpr")%>% ## Join with key for record_id's, to only keep entries also in key
|
||||
select(.,all_of(vars)) ## Select only specified variables, leaving out cpr's
|
||||
|
||||
ls[[length(ls)+1]]<-dap_d
|
||||
names(ls)[length(ls)]<-"reg"
|
||||
|
||||
|
||||
## Exporting attributes
|
||||
for (i in 1:length(ls)) {
|
||||
## Lists all attributes for export
|
||||
l <- lapply(ls[[i]], attr, "label")
|
||||
|
||||
for (j in 1:length(l)){
|
||||
l[[j]]<-ifelse(is.null(l[[j]]),"No attr",l[[j]])
|
||||
}
|
||||
|
||||
la<-data.frame(names=names(l),attr=unlist(l))
|
||||
|
||||
## Export individual attribute files for data overview
|
||||
if (exp_out){
|
||||
write.csv(la,paste0("REDCap/attr/attr_",fnames[i],".csv"),row.names = FALSE)
|
||||
}
|
||||
}
|
||||
|
||||
## Naming and splitting in unique instruments for DataDictionary creation and data upload
|
||||
|
||||
## Leave inklusion file, adverse events and other medication.
|
||||
## These are not needed for upload or will be uploaded seperately
|
||||
|
||||
r_sel<-!(grepl("inkl",files)|grepl("ae_",files)|grepl("medicin",files))
|
||||
|
||||
# Limiting name variables
|
||||
# r_files<-files[r_sel]
|
||||
r_fnames<-c(fnames[r_sel],"reg")
|
||||
|
||||
# Selecting elements in list
|
||||
r_ls<-"["(ls,names(ls)%in%r_fnames)
|
||||
|
||||
# New list for wrangling to rename variables and splitting by instance
|
||||
r_lup<-list()
|
||||
|
||||
for (i in 1:length(r_ls)){
|
||||
## Suffix generic variable names
|
||||
d<-r_ls[[i]]
|
||||
name<-names(r_ls)[[i]]
|
||||
dn<-!(grepl(name,colnames(d))|colnames(d)%in%id_data)## Test colnames that does not contain instrument name
|
||||
|
||||
colnames(d)[dn]<-paste0(name,"_",colnames(d)[dn]) ## Adds suffix to colnames to ensure unique names
|
||||
# First entry is omitted, as this is the record_id
|
||||
|
||||
## Test for if conditions
|
||||
## Uses redundant double if, as else wasn't consistent
|
||||
test<-grepl("INSTANCE",colnames(d),ignore.case = T )
|
||||
|
||||
if (any(test)){
|
||||
d[,test]<-factor(d[,test]) # Factorise to secure ordering
|
||||
ins<-levels(d[,test]) # Instance numbers drawn from factor levels
|
||||
|
||||
ds<-split(d[,!test] ,d[,test]) # Splits by instance and drops instance variable
|
||||
names(ds)<-paste0(name,"_",ins) # Names frames by instrument, appends instance
|
||||
for (j in 1:length(ds)){
|
||||
colnames(ds[[j]])[!colnames(ds[[j]])%in%id_data]<-paste0(colnames(ds[[j]])[!colnames(ds[[j]])%in%id_data],"_",ins[j])
|
||||
## Append instance number
|
||||
}
|
||||
|
||||
r_lup<-append(r_lup,ds)
|
||||
}
|
||||
|
||||
if (!any(test)) {
|
||||
r_lup[[length(r_lup)+1]]<-d
|
||||
names(r_lup)[length(r_lup)]<-name
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
## Load REDCap instrument example file for variable names
|
||||
icname<-colnames(read.csv("/Volumes/Data/REDCap/examples/examlpe instrument.csv"))
|
||||
dd<-data.frame(matrix(ncol = length(icname))) ## Data frame to collect all
|
||||
colnames(dd)<-icname
|
||||
|
||||
## Instrument for DataDictionary
|
||||
## Format dataset for REDCap upload
|
||||
|
||||
for (i in 1:length(r_lup)){
|
||||
dd_i<-data.frame(matrix(ncol = length(icname),nrow = ncol("[["(r_lup,i)))) ## Data frame to collect all
|
||||
|
||||
colnames(dd_i)<-icname ## for easier reading
|
||||
|
||||
## Variable names
|
||||
dd_i[1]<-colnames("[["(r_lup,i))
|
||||
|
||||
## Form Name
|
||||
dd_i[2]<-names(r_lup)[i]
|
||||
|
||||
## Field Type
|
||||
# dd_i[4]<-ifelse(sapply(r_lup[[i]], class)=="factor","radio","text")
|
||||
dd_i[4]<-"text"
|
||||
|
||||
## Field Label
|
||||
## Using original attributes as field labels
|
||||
fl<-lapply(r_lup[[i]], attr, "label")
|
||||
for (j in 1:length(fl)){
|
||||
fl[[j]]<-ifelse(is.null(fl[[j]]),
|
||||
names(fl)[[j]],
|
||||
fl[[j]])
|
||||
## If no attributes, variable name is used as "placeholder"
|
||||
}
|
||||
dd_i[5]<-unlist(fl)
|
||||
|
||||
## Choices
|
||||
# for (j in 1:ncol(r_lup[[i]])){
|
||||
# if (is.factor(r_lup[[i]][[j]])){
|
||||
# lvl<-levels(r_lup[[i]][[j]])
|
||||
# lvl_ch<-paste("1,",lvl[1])
|
||||
# for (k in 2:length(lvl)){
|
||||
# lvl_ch<-c(paste0(lvl_ch," | ",k,", ",lvl[k]))
|
||||
# }
|
||||
# dd_i[j,6]<-lvl_ch
|
||||
# }
|
||||
# }
|
||||
|
||||
## Text Validation
|
||||
## Only used for date and time data
|
||||
# for (j in 1:ncol(r_lup[[i]])){
|
||||
# dd_i[j,8]<-case_when(class(r_lup[[i]][[j]])[1]%in%c("POSIXct","POSIXt") ~"datetime_seconds_ymd",
|
||||
# class(r_lup[[i]][[j]])[1]%in%c("Date") ~"date_ymd")
|
||||
# }
|
||||
|
||||
## Merge all
|
||||
dd<-rbind(dd,dd_i)
|
||||
|
||||
if (exp_out){
|
||||
# dir.create(file.path("/Volumes/Data/REDCap/data",names(r_lup)[[i]]))
|
||||
write.csv(r_lup[[i]],paste0("/Volumes/Data/REDCap/data/",names(r_lup)[[i]],".csv"),row.names = FALSE)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# Readies the DataDictionary for export by limiting to unique identifier (leaving out multiple record ids) and omitting NAs
|
||||
dd_exp<-dd %>% filter(.,!(duplicated(Variable...Field.Name)|is.na(Variable...Field.Name)))
|
||||
|
||||
## Marking identifier variables
|
||||
dd_exp$Identifier.[dd_exp$Variable...Field.Name%in%id_data]<-"y"
|
||||
|
||||
|
||||
write.csv(dd_exp,"/Volumes/Data/REDCap/data_dictionary.csv",row.names = FALSE,na="")
|
||||
|
||||
|
||||
## ONE DATA SET TO RULE THEM ALL
|
||||
ds_all<-key
|
||||
for (i in names(r_lup)){
|
||||
ds_all<-left_join(ds_all,"[["(r_lup,i))
|
||||
## All non-identifier variable names are unique, joining variable is not specified.
|
||||
}
|
||||
|
||||
colnames(ds_all)<-colnames(ds_all)%>%tolower() ## All names in REDCap are lower case.
|
||||
|
||||
if (exp_out){
|
||||
write.csv(ds_all,"/Volumes/Data/REDCap/complete_dataset.csv",row.names = FALSE,na="")
|
||||
}
|
||||
|
||||
|
||||
## =============================================================================
|
||||
## REDCap upload
|
||||
## - worked, but headers should be lower case
|
||||
##
|
||||
## - 02aug22 not allowed to export or import.
|
||||
## Try manual data upload after attribute merge.
|
||||
## =============================================================================
|
||||
|
||||
if (auto_upload==TRUE){
|
||||
|
||||
## Trying out native piping
|
||||
token_talos<-read.csv("/Users/au301842/talos_redcap_token.csv",colClasses = "character")|>
|
||||
names()|>
|
||||
# (\(x){ ## Shorthand for "anonymous lambda function". New "_" placeholder does not work.
|
||||
# substr(x,2,33)})()|>
|
||||
suppressWarnings()
|
||||
|
||||
## See https://towardsdatascience.com/understanding-the-native-r-pipe-98dea6d8b61b"
|
||||
## OBS: new placeholder "_" in >4.2.
|
||||
|
||||
|
||||
stts<-REDCapR::redcap_write(ds=ds_all,
|
||||
redcap_uri = "https://redcap.rm.dk/api/",
|
||||
token = token_talos
|
||||
)
|
||||
|
||||
records_mod <- REDCapR::redcap_read_oneshot(
|
||||
redcap_uri = "https://redcap.rm.dk/api/",
|
||||
token = token_talos
|
||||
)
|
||||
}
|
||||
|
||||
## Notes:
|
||||
## - Validation and data selection options are not applied, as these are not necessary for upload.
|
Loading…
Reference in New Issue
Block a user