|
|
|
@ -32,34 +32,66 @@ ui <- fluidPage( |
|
|
|
server <- function(input, output) { |
|
|
|
dades<-reactiveValues() |
|
|
|
dades$taula<-NULL |
|
|
|
dades$type<-NULL |
|
|
|
|
|
|
|
## Listado ---- |
|
|
|
|
|
|
|
observe({ |
|
|
|
req(input$file) |
|
|
|
df.list<-lapply(excel_sheets(input$file$datapath), read_xlsx, path=input$file$datapath, range="B1:K31", col_type="text") |
|
|
|
names(df.list)<-excel_sheets(input$file$datapath) |
|
|
|
name.row<-seq(from=1, to=nrow(df.list[[1]]), by=3) |
|
|
|
date.row<-seq(from=2, to=nrow(df.list[[1]]), by=3) |
|
|
|
desc.row<-seq(from=3, to=nrow(df.list[[1]]), by=3) |
|
|
|
for (i in 1:length(df.list)){ |
|
|
|
df.list[[i]]<-data.frame( |
|
|
|
Tanque=gsub("-[0-9]* #[0-9]*$","",names(df.list)[i]), |
|
|
|
Rack=gsub("^[A-Z]-| #[0-9]*$","",names(df.list)[i]), |
|
|
|
Caja=names(df.list)[i], |
|
|
|
Fila=rep(LETTERS[1:10], 10), |
|
|
|
Columna=factor(as.character(rep(1:10, each=10)),levels=as.character(1:10)), |
|
|
|
Nombre=unlist(df.list[[i]][name.row,]), |
|
|
|
Fecha=unlist(df.list[[i]][date.row,]), |
|
|
|
Descripción=unlist(df.list[[i]][desc.row,]) |
|
|
|
) |
|
|
|
if(read_xlsx(input$file$datapath, sheet = 1, range="B1:B1", col_names = F) == "1"){dades$type<-"ICO"}else{dades$type<-"Virus"} |
|
|
|
|
|
|
|
if(dades$type == "ICO"){ |
|
|
|
df.list<-lapply(excel_sheets(input$file$datapath), read_xlsx, |
|
|
|
path=input$file$datapath, range="B2:K31", col_type="text", col_names=F) |
|
|
|
names(df.list)<-excel_sheets(input$file$datapath) |
|
|
|
name.row<-seq(from=1, to=nrow(df.list[[1]]), by=3) |
|
|
|
date.row<-seq(from=2, to=nrow(df.list[[1]]), by=3) |
|
|
|
desc.row<-seq(from=3, to=nrow(df.list[[1]]), by=3) |
|
|
|
for (i in 1:length(df.list)){ |
|
|
|
df.list[[i]]<-data.frame( |
|
|
|
Tanque=gsub("-[0-9]* #[0-9]*$","",names(df.list)[i]), |
|
|
|
Rack=gsub("^[A-Z]-| #[0-9]*$","",names(df.list)[i]), |
|
|
|
Caja=names(df.list)[i], |
|
|
|
Fila=rep(LETTERS[1:10], 10), |
|
|
|
Columna=factor(as.character(rep(1:10, each=10)),levels=as.character(1:10)), |
|
|
|
Nombre=unlist(df.list[[i]][name.row,]), |
|
|
|
Fecha=unlist(df.list[[i]][date.row,]), |
|
|
|
Descripción=unlist(df.list[[i]][desc.row,]) |
|
|
|
) |
|
|
|
} |
|
|
|
df<-do.call(rbind, df.list) |
|
|
|
df[grepl("^[0-9]*$", df$Fecha),"Fecha"]<-as.character(as.Date(as.numeric(df[grepl("^[0-9]*$", df$Fecha),"Fecha"]), origin = "1899-12-30")) |
|
|
|
for (i in c("Tanque", "Rack","Caja","Fila")){ |
|
|
|
df[,i]<-factor(df[,i]) |
|
|
|
} |
|
|
|
dades$taula<-df |
|
|
|
} |
|
|
|
df<-do.call(rbind, df.list) |
|
|
|
df[grepl("^[0-9]*$", df$Fecha),"Fecha"]<-as.character(as.Date(as.numeric(df[grepl("^[0-9]*$", df$Fecha),"Fecha"]), origin = "1899-12-30")) |
|
|
|
for (i in c("Tanque", "Rack","Caja","Fila")){ |
|
|
|
df[,i]<-factor(df[,i]) |
|
|
|
if(dades$type == "Virus"){ |
|
|
|
df.list<-lapply(excel_sheets(input$file$datapath), read_xlsx, |
|
|
|
path=input$file$datapath, range="A1:J30", col_type="text", col_names=F) |
|
|
|
names(df.list)<-excel_sheets(input$file$datapath) |
|
|
|
name.row<-seq(from=1, to=nrow(df.list[[1]]), by=3) |
|
|
|
date.row<-seq(from=2, to=nrow(df.list[[1]]), by=3) |
|
|
|
desc.row<-seq(from=3, to=nrow(df.list[[1]]), by=3) |
|
|
|
for (i in 1:length(df.list)){ |
|
|
|
df.list[[i]]<-data.frame( |
|
|
|
Tanque=gsub("-[0-9]* #[0-9]*$","",names(df.list)[i]), |
|
|
|
Rack=gsub("^[A-Z]-| #[0-9]*$","",names(df.list)[i]), |
|
|
|
Caja=names(df.list)[i], |
|
|
|
`Posición`=factor(as.character(1:100),levels=as.character(1:100)), |
|
|
|
Cell.Line=unlist(df.list[[i]][name.row,]), |
|
|
|
`Descongelación`=unlist(df.list[[i]][date.row,]), |
|
|
|
Passage=unlist(df.list[[i]][desc.row,]) |
|
|
|
) |
|
|
|
} |
|
|
|
df<-do.call(rbind, df.list) |
|
|
|
df[grepl("^[0-9]*$", df$Passage),"Passage"]<-as.character(as.Date(as.numeric(df[grepl("^[0-9]*$", df$Passage),"Passage"]), origin = "1899-12-30")) |
|
|
|
for (i in c("Tanque", "Rack","Caja")){ |
|
|
|
df[,i]<-factor(df[,i]) |
|
|
|
} |
|
|
|
dades$taula<-df |
|
|
|
} |
|
|
|
dades$taula<-df |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
output$DT <- renderDT({ |
|
|
|
@ -76,17 +108,29 @@ server <- function(input, output) { |
|
|
|
|
|
|
|
output$DT_caja <- renderTable({ |
|
|
|
req(dades$taula) |
|
|
|
caja_l<-dades$taula[dades$taula$Caja == input$caja,] |
|
|
|
caja_l$Nombre[is.na(caja_l$Nombre)]<-"" |
|
|
|
caja_l$Fecha[is.na(caja_l$Fecha)]<-"" |
|
|
|
caja_l$Descripción[is.na(caja_l$Descripción)]<-"" |
|
|
|
caja<-as.data.frame(matrix(data= paste(caja_l$Nombre, caja_l$Fecha, caja_l$Descripción, sep="<br>"), |
|
|
|
if(dades$type == "ICO"){ |
|
|
|
caja_l<-dades$taula[dades$taula$Caja == input$caja,] |
|
|
|
caja_l$Nombre[is.na(caja_l$Nombre)]<-"" |
|
|
|
caja_l$Fecha[is.na(caja_l$Fecha)]<-"" |
|
|
|
caja_l$Descripción[is.na(caja_l$Descripción)]<-"" |
|
|
|
caja<-as.data.frame(matrix(data= paste(caja_l$Nombre, caja_l$Fecha, caja_l$Descripción, sep="<br>"), |
|
|
|
ncol = 10, nrow=10)) |
|
|
|
colnames(caja)<-as.character(1:10) |
|
|
|
rownames(caja)<-LETTERS[1:10] |
|
|
|
colnames(caja)<-as.character(1:10) |
|
|
|
rownames(caja)<-LETTERS[1:10] |
|
|
|
} |
|
|
|
if(dades$type == "Virus"){ |
|
|
|
caja_l<-dades$taula[dades$taula$Caja == input$caja,] |
|
|
|
caja_l$Cell.Line[is.na(caja_l$Cell.Line)]<-"" |
|
|
|
caja_l$`Descongelación`[is.na(caja_l$`Descongelación`)]<-"" |
|
|
|
caja_l$Passage[is.na(caja_l$Passage)]<-"" |
|
|
|
caja<-as.data.frame(matrix(data= paste(caja_l$Cell.Line, caja_l$`Descongelación`, caja_l$Passage, sep="<br>"), |
|
|
|
ncol = 10, nrow=10)) |
|
|
|
colnames(caja)<-NULL |
|
|
|
rownames(caja)<-NULL |
|
|
|
} |
|
|
|
|
|
|
|
caja |
|
|
|
}, rownames = TRUE, sanitize.text.function=identity, bordered = TRUE) |
|
|
|
}, rownames = TRUE, sanitize.text.function=identity, bordered = TRUE) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|