Commit e57b99ab authored by david Chavalarias's avatar david Chavalarias

R scripts adapted to new date format

parent 2e620ff8
......@@ -13,15 +13,16 @@ First define what is the name of the file to be processed. This file should be i
```{r}
library(lubridate)
source("coronalib.R") # R libraries
name<-"Database060520" # name of the csv to be loaded
name<-"database_d_chavalarias_2020-05-15" # name of the csv to be loaded
AllData <-read.csv(paste("data/",name,".csv",sep=""),head=TRUE,sep="\t")
AllData$Inclusion.criteria <- NULL
AllData$Exclusion.criteria <- NULL
#AllData <- filter(AllDataTemp,AllDataTemp$First.author!="N/A")
AllData <- filter(AllData,!is.na(AllData$Registration.date))
nrow(AllData)
x <- unique(AllData$Trial.registration.number)
head(x)[[1]]
```
### Data segmentation
Several dataframe are generated according to which are the CTs under study.
......@@ -75,5 +76,3 @@ TreatmentsCloud(Prevention)
TreatmentsCloud(Posttreatment)
```
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -4,9 +4,9 @@
### abstract as html file as in template merging treatments and outcome
garg_export_with_html <- function(df,filename) {
x <- data.frame("publication_day"=day(as.Date(df$Registration.date,"%Y-%m-%d")))
x$publication_month = month(as.Date(df$Registration.date,"%Y-%m-%d"))
x$publication_year = year(as.Date(df$Registration.date,"%Y-%m-%d"))
x <- data.frame("publication_day"=day(as.Date(df$Registration.date,"%d/%m/%Y")))
x$publication_month = month(as.Date(df$Registration.date,"%d/%m/%Y"))
x$publication_year = year(as.Date(df$Registration.date,"%d/%m/%Y"))
x$authors=df$First.author
x$title=df$Trial.registration.number
x$source=df$Funding
......@@ -16,61 +16,64 @@ garg_export_with_html <- function(df,filename) {
}
garg_export_treatments_with_html <- function(df,filename) {
x <- data.frame("publication_day"=day(as.Date(df$Registration.date,"%Y-%m-%d")))
x$publication_month = month(as.Date(df$Registration.date,"%Y-%m-%d"))
x$publication_year = year(as.Date(df$Registration.date,"%Y-%m-%d"))
x <- data.frame("publication_day"=day(as.Date(df$Registration.date,"%d/%m/%Y")))
x$publication_month = month(as.Date(df$Registration.date,"%d/%m/%Y"))
x$publication_year = year(as.Date(df$Registration.date,"%d/%m/%Y"))
x$authors=df$First.author
x$title=df$Trial.registration.number
x$source=df$Funding
x$abstract=paste("<a href='",df$Full.text.link,"' target='blank'>Link to study</a></br></br><b> ",toupper(df$Pharmacological.treatment),"</b></br><i>Type: </i>",df$Treatment.type,"</br><i> Treatment name: </i>",str_replace_all(tolower(df$Treatment.name),"[[+]]"," + "))
write.table(x, file = paste("output/gargCSV_Treatments_html_",filename,".csv",sep = ""), sep = "\t",row.names = FALSE)
y <- filter(x,x$publication_year!="NA")
write.table(y, file = paste("output/gargCSV_Treatments_html_",filename,".csv",sep = ""), sep = "\t",row.names = FALSE)
}
garg_export_raw_treatments<- function(df,filename) {
x <- data.frame("publication_day"=day(as.Date(df$Registration.date,"%Y-%m-%d")))
x$publication_month = month(as.Date(df$Registration.date,"%Y-%m-%d"))
x$publication_year = year(as.Date(df$Registration.date,"%Y-%m-%d"))
x <- data.frame("publication_day"=day(as.Date(df$Registration.date,"%d/%m/%Y")))
x$publication_month = month(as.Date(df$Registration.date,"%d/%m/%Y"))
x$publication_year = year(as.Date(df$Registration.date,"%d/%m/%Y"))
x$authors=df$First.author
x$title=df$Trial.registration.number
x$source=df$Funding
x$abstract=paste(toupper(df$Pharmacological.treatment)," . ",df$Treatment.type," . ",str_replace_all(tolower(df$Treatment.name),"[[+]]"," ; "))
write.table(x, file = paste("output/gargCSV_Treatments_raw_",filename,".csv",sep = ""), sep = "\t",row.names = FALSE)
y <- filter(x,x$publication_year!="NA")
write.table(y, file = paste("output/gargCSV_Treatments_raw_",filename,".csv",sep = ""), sep = "\t",row.names = FALSE)
}
garg_export_all_plain <- function(df,filename) {
x <- data.frame("publication_day"=day(as.Date(df$Registration.date,"%Y-%m-%d")))
x$publication_month = month(as.Date(df$Registration.date,"%Y-%m-%d"))
x$publication_year = year(as.Date(df$Registration.date,"%Y-%m-%d"))
x <- data.frame("publication_day"=day(as.Date(df$Registration.date,"%d/%m/%Y")))
x$publication_month = month(as.Date(df$Registration.date,"%d/%m/%Y"))
x$publication_year = year(as.Date(df$Registration.date,"%d/%m/%Y"))
x$authors=df$First.author
x$title=df$Trial.registration.number
x$source=df$Funding
x$abstract=paste("Link to study: ",df$Full.text.link," DESIGN: ",df$Study.design,", RECRUITEMENT STATUS: ",df$Recruitment.status,", TYPE OF PATIENTS: ",df$Type.of.patients," TREATMENT: ",toupper(df$Pharmacological.treatment),", TYPE: ",df$Treatment.type,", TREATMENT NAME: ",str_replace_all(tolower(df$Treatment.name),"[[+]]"," + "),", PRIMARY OUTCOME: ",df$primary.outcome,", CENTER: ",df$Center,", COUNTRY: ",df$Countries,", N in this treatment group: ",df$n.randomized.in.this.arm,", N in the trial: ",df$Total.sample.size)
write.table(x, file = paste("output/gargCSV_all_plain_",filename,".csv",sep = ""), sep = "\t",row.names = FALSE)
y <- filter(x,x$publication_year!="NA")
write.table(y, file = paste("output/gargCSV_all_plain_",filename,".csv",sep = ""), sep = "\t",row.names = FALSE)
}
garg_export_OnlyTreatments <- function(df,filename) {
x <- data.frame("publication_day"=day(as.Date(df$Registration.date,"%Y-%m-%d")))
x$publication_month = month(as.Date(df$Registration.date,"%Y-%m-%d"))
x$publication_year = year(as.Date(df$Registration.date,"%Y-%m-%d"))
x <- data.frame("publication_day"=day(as.Date(df$Registration.date,"%d/%m/%Y")))
x$publication_month = month(as.Date(df$Registration.date,"%d/%m/%Y"))
x$publication_year = year(as.Date(df$Registration.date,"%d/%m/%Y"))
x$authors=df$Full.text.link
x$title=df$Trial.registration.number
x$source=df$Funding
x$abstract=paste(" TREATMENT: ",toupper(df$Pharmacological.treatment),", TYPE: ",df$Treatment.type,", TREATMENT NAME: ",str_replace_all(tolower(df$Treatment.name),"[[+]]"," + "))
write.table(x, file = paste("output/gargCSV_only_treatment_plain",filename,".csv",sep = ""), sep = "\t",row.names = FALSE)
y <- filter(x,x$publication_year!="NA")
write.table(y, file = paste("output/gargCSV_only_treatment_plain",filename,".csv",sep = ""), sep = "\t",row.names = FALSE)
}
garg_export_OnlyOutcomes <- function(df,filename) {
x <- data.frame("publication_day"=day(as.Date(df$Registration.date,"%Y-%m-%d")))
x$publication_month = month(as.Date(df$Registration.date,"%Y-%m-%d"))
x$publication_year = year(as.Date(df$Registration.date,"%Y-%m-%d"))
x <- data.frame("publication_day"=day(as.Date(df$Registration.date,"%d/%m/%Y")))
x$publication_month = month(as.Date(df$Registration.date,"%d/%m/%Y"))
x$publication_year = year(as.Date(df$Registration.date,"%d/%m/%Y"))
x$authors=df$Full.text.link
x$title=df$Trial.registration.number
x$source=df$Funding
x$abstract=paste("PRIMARY OUTCOME: ",df$primary.outcome)
write.table(x, file = paste("output/gargCSV_only_outcomes_plain",filename,".csv",sep = ""), sep = "\t",row.names = FALSE)
y <- filter(x,x$publication_year!="NA")
write.table(y, file = paste("output/gargCSV_only_outcomes_plain",filename,".csv",sep = ""), sep = "\t",row.names = FALSE)
}
# Export de listes de termes
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment