Spaces:
Runtime error
Runtime error
doratiass
commited on
Commit
•
a35db5b
1
Parent(s):
78a0e02
update funcs
Browse files- .DS_Store +0 -0
- app.R +2 -9
- create_patient_module.R +7 -0
- dummy_df.csv +0 -0
- funcs.R +4 -3
.DS_Store
CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
|
|
app.R
CHANGED
@@ -23,7 +23,7 @@ source("create_patient_module.R")
|
|
23 |
source("about.R")
|
24 |
source("funcs.R")
|
25 |
|
26 |
-
dummy_df <- read_csv("dummy_df.csv",show_col_types = FALSE)
|
27 |
|
28 |
# load git data ####
|
29 |
git_token <- Sys.getenv("GITHUB_PAT")
|
@@ -85,14 +85,7 @@ server <- function(input, output, session) {
|
|
85 |
shiny::observe(session$setCurrentTheme(
|
86 |
if (isTRUE(input$dark_mode)) dark else light
|
87 |
))
|
88 |
-
|
89 |
-
shiny::observe({
|
90 |
-
updateSliderInput(session = session,
|
91 |
-
"sum_drug",
|
92 |
-
min = (input$drug_nervous+input$drug_muscle+input$drug_antineoplastic))
|
93 |
-
|
94 |
-
})
|
95 |
-
|
96 |
inputData <- create_patient_Server("inputs")
|
97 |
|
98 |
output$risk_vb <- renderUI({
|
|
|
23 |
source("about.R")
|
24 |
source("funcs.R")
|
25 |
|
26 |
+
dummy_df <- read_csv("dummy_df.csv",show_col_types = FALSE)
|
27 |
|
28 |
# load git data ####
|
29 |
git_token <- Sys.getenv("GITHUB_PAT")
|
|
|
85 |
shiny::observe(session$setCurrentTheme(
|
86 |
if (isTRUE(input$dark_mode)) dark else light
|
87 |
))
|
88 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
inputData <- create_patient_Server("inputs")
|
90 |
|
91 |
output$risk_vb <- renderUI({
|
create_patient_module.R
CHANGED
@@ -287,6 +287,13 @@ create_patient_Server <- function(id) {
|
|
287 |
moduleServer(
|
288 |
id,
|
289 |
function(input, output, session) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
data <- reactive({
|
291 |
sector <- ifelse(input$sector == "General",
|
292 |
sample(c("General","Religious Jewish"), size = 1),
|
|
|
287 |
moduleServer(
|
288 |
id,
|
289 |
function(input, output, session) {
|
290 |
+
shiny::observe({
|
291 |
+
updateSliderInput(session = session,
|
292 |
+
"sum_drug",
|
293 |
+
min = (input$drug_nervous+input$drug_muscle+input$drug_antineoplastic))
|
294 |
+
|
295 |
+
})
|
296 |
+
|
297 |
data <- reactive({
|
298 |
sector <- ifelse(input$sector == "General",
|
299 |
sample(c("General","Religious Jewish"), size = 1),
|
dummy_df.csv
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
funcs.R
CHANGED
@@ -3,7 +3,7 @@ library(sn)
|
|
3 |
library(readr)
|
4 |
|
5 |
prob_df <- read_csv("prob_df.csv",show_col_types = FALSE) %>%
|
6 |
-
mutate(model_prob = round(model_prob,
|
7 |
group_by(model_prob) %>%
|
8 |
summarise(cal_prob = mean(cal_prob))
|
9 |
|
@@ -71,7 +71,8 @@ plot_close_side <- function(df, bkg_col = "white",txt_col = "black",
|
|
71 |
|
72 |
syn_df <- function(dummy_df, df, model) {
|
73 |
find_closest_n(dummy_df, model,
|
74 |
-
prob = generate_model(df, model),
|
|
|
75 |
bind_rows(df %>%
|
76 |
mutate(prob = generate_model(df, model))) %>%
|
77 |
mutate(group = factor(c("dummy", "input"),
|
@@ -82,7 +83,7 @@ syn_df <- function(dummy_df, df, model) {
|
|
82 |
TRUE ~ "Codeine"),
|
83 |
label = paste0(ifelse(gender_Male == 1, "Male", "Female"), ", Age ",RE_age,
|
84 |
"\nGeneric: ", generic,
|
85 |
-
"\nProbability ",round(prob,
|
86 |
) %>%
|
87 |
select(group,label,n_diagnosis, img_n, drug_antineoplastic, drug_muscle, n_visits) %>%
|
88 |
pivot_longer(
|
|
|
3 |
library(readr)
|
4 |
|
5 |
prob_df <- read_csv("prob_df.csv",show_col_types = FALSE) %>%
|
6 |
+
mutate(model_prob = round(model_prob, 5)) %>%
|
7 |
group_by(model_prob) %>%
|
8 |
summarise(cal_prob = mean(cal_prob))
|
9 |
|
|
|
71 |
|
72 |
syn_df <- function(dummy_df, df, model) {
|
73 |
find_closest_n(dummy_df, model,
|
74 |
+
prob = generate_model(df, model),
|
75 |
+
n = 1) %>%
|
76 |
bind_rows(df %>%
|
77 |
mutate(prob = generate_model(df, model))) %>%
|
78 |
mutate(group = factor(c("dummy", "input"),
|
|
|
83 |
TRUE ~ "Codeine"),
|
84 |
label = paste0(ifelse(gender_Male == 1, "Male", "Female"), ", Age ",RE_age,
|
85 |
"\nGeneric: ", generic,
|
86 |
+
"\nProbability ",round(prob,2),"%")
|
87 |
) %>%
|
88 |
select(group,label,n_diagnosis, img_n, drug_antineoplastic, drug_muscle, n_visits) %>%
|
89 |
pivot_longer(
|