Skip to content

Commit

Permalink
added forgotten commit
Browse files Browse the repository at this point in the history
  • Loading branch information
IvoLeist committed Feb 28, 2024
1 parent 3e6c0c3 commit e892f49
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions phenoRankeR/R/mod_patient_mode.R
Original file line number Diff line number Diff line change
Expand Up @@ -493,16 +493,30 @@ mod_patient_mode_server <- function(
)

for (i in 1:nrow(input$referenceFiles)) {
file <- input$referenceFiles[i, ]
# file_ext <- file_ext(file$name)
total_individual_counts <- 0
uploaded_file <- input$referenceFiles[i, ]

if (!(get_file_ext(file$name) %in% allowed_types)) {
file_con <- file(uploaded_file$datapath, "r")
individual_counts <- as.numeric(jq(file_con, "length"))
close(file_con)

total_individual_counts <- total_individual_counts + individual_counts
if (total_individual_counts > 1000) {
showNotification(
"The maximum number of individuals is 1000",
type = "error"
)
reset("referenceFiles")
return()
}

if (!(get_file_ext(uploaded_file$name) %in% allowed_types)) {
showNotification("Invalid file type!", type = "error")
reset("referenceFiles")
return()
}

json_data <- fromJSON(readLines(file$datapath))
json_data <- fromJSON(readLines(uploaded_file$datapath))
rv_patient$inputFormat <- "bff"
if ("subject" %in% names(json_data)) {
rv_patient$inputFormat <- "pxf"
Expand All @@ -520,7 +534,7 @@ mod_patient_mode_server <- function(

str_references <- paste0(
str_references,
file$name,
uploaded_file$name,
":C",
i,
"\n"
Expand All @@ -543,7 +557,7 @@ mod_patient_mode_server <- function(
)

file.copy(
file$datapath,
uploaded_file$datapath,
file_path
)

Expand Down

0 comments on commit e892f49

Please sign in to comment.