Skip to content

Commit 6a80848

Browse files
committed
add value box for pre and post launch total submission counts after removing site champions
1 parent 76b1a48 commit 6a80848

File tree

2 files changed

+266
-89
lines changed

2 files changed

+266
-89
lines changed

aps-dashboard.qmd

Lines changed: 112 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ library(dplyr)
1717
library(DT)
1818
library(duckdb)
1919
library(plotly)
20+
library(tidyr)
2021
2122
# source the codebook
2223
source("codebook.r")
@@ -181,7 +182,7 @@ ggplotly(chart_2)
181182
#| echo: false
182183
183184
# total submissions by randomization status
184-
total_subs_by_rand <- as.data.frame(dbGetQuery(
185+
total_subs_by_rand_sql <- as.data.frame(dbGetQuery(
185186
con,
186187
"
187188
SELECT clinician_id, COUNT(form_id) as num
@@ -214,21 +215,33 @@ all_clinicians <- rbind(
214215
utp_clinician
215216
)
216217
217-
total_subs_by_rand <- total_subs_by_rand |>
218+
no_site_champs <- all_clinicians |>
219+
filter(!clinician_name %in% user$site_champ_label[1:7])
220+
221+
total_subs_by_rand <- total_subs_by_rand_sql |>
218222
left_join(all_clinicians, by = "clinician_id") |>
219223
select(num, clinician_name, clinician_randomized)
220224
221225
total_subs_by_rand <- total_subs_by_rand |>
222226
group_by(clinician_randomized) |>
223227
summarise(num = sum(num))
228+
229+
total_subs_by_rand_no_sc <- total_subs_by_rand_sql |>
230+
left_join(no_site_champs, by = "clinician_id") |>
231+
select(num, clinician_name, clinician_randomized)
232+
233+
total_subs_by_rand_no_sc <- total_subs_by_rand_no_sc |>
234+
group_by(clinician_randomized) |>
235+
drop_na() |>
236+
summarise(num = sum(num))
224237
```
225238

226239
```{r}
227240
#| label: pre-launch randomized submissions value box data
228241
#| echo: false
229242
230243
# pre-launch submission by randomization status
231-
pre_total_subs_by_rand <- as.data.frame(dbGetQuery(
244+
pre_total_subs_by_rand_sql <- as.data.frame(dbGetQuery(
232245
con,
233246
"
234247
SELECT clinician_id, COUNT(form_id) AS num
@@ -264,21 +277,30 @@ pre_total_subs_by_rand <- as.data.frame(dbGetQuery(
264277
"
265278
))
266279
267-
pre_total_subs_by_rand <- pre_total_subs_by_rand |>
280+
pre_total_subs_by_rand <- pre_total_subs_by_rand_sql |>
268281
left_join(all_clinicians, by = "clinician_id") |>
269282
select(num, clinician_name, clinician_randomized)
270283
271284
pre_total_subs_by_rand <- pre_total_subs_by_rand |>
272285
group_by(clinician_randomized) |>
273286
summarise(num = sum(num))
287+
288+
pre_total_subs_by_rand_no_sc <- pre_total_subs_by_rand_sql |>
289+
left_join(no_site_champs, by = "clinician_id") |>
290+
select(num, clinician_name, clinician_randomized)
291+
292+
pre_total_subs_by_rand_no_sc <- pre_total_subs_by_rand_no_sc |>
293+
group_by(clinician_randomized) |>
294+
drop_na() |>
295+
summarise(num = sum(num))
274296
```
275297

276298
```{r}
277299
#| label: post-launch randomized submissions value box data
278300
#| echo: false
279301
280302
# post-launch submission by randomization status
281-
post_total_subs_by_rand <- as.data.frame(dbGetQuery(
303+
post_total_subs_by_rand_sql <- as.data.frame(dbGetQuery(
282304
con,
283305
"
284306
SELECT clinician_id, COUNT(form_id) AS num
@@ -314,13 +336,22 @@ post_total_subs_by_rand <- as.data.frame(dbGetQuery(
314336
"
315337
))
316338
317-
post_total_subs_by_rand <- post_total_subs_by_rand |>
339+
post_total_subs_by_rand <- post_total_subs_by_rand_sql |>
318340
left_join(all_clinicians, by = "clinician_id") |>
319341
select(num, clinician_name, clinician_randomized)
320342
321343
post_total_subs_by_rand <- post_total_subs_by_rand |>
322344
group_by(clinician_randomized) |>
323345
summarise(num = sum(num))
346+
347+
post_total_subs_by_rand_no_sc <- post_total_subs_by_rand_sql |>
348+
left_join(no_site_champs, by = "clinician_id") |>
349+
select(num, clinician_name, clinician_randomized)
350+
351+
post_total_subs_by_rand_no_sc <- post_total_subs_by_rand_no_sc |>
352+
group_by(clinician_randomized) |>
353+
drop_na() |>
354+
summarise(num = sum(num))
324355
```
325356

326357
### Overall
@@ -353,16 +384,18 @@ list(
353384
)
354385
```
355386

356-
### Launch
387+
### Launch {orientation="rows"}
388+
389+
####
357390

358391
```{r}
359392
#| label: valuebox pre-launch total submissions by randomized clinicians
360-
#| title: Pre-launch Total Submissions by Randomized Clinicians
361393
#| content: valuebox
362394
363395
list(
364396
icon = "clipboard-check-fill",
365397
color = "info",
398+
title = "Pre-launch Total Submissions by Randomized Clinicians",
366399
value = pre_total_subs_by_rand[
367400
pre_total_subs_by_rand$clinician_randomized == 1,
368401
]$num
@@ -371,26 +404,28 @@ list(
371404

372405
```{r}
373406
#| label: valuebox pre-launch total submissions by non-randomized clinicians
374-
#| title: Pre-launch Total Submissions by Non-Randomized Clinicians
375407
#| content: valuebox
376408
377409
list(
378410
icon = "clipboard-x-fill",
379411
color = "info",
412+
title = "Pre-launch Total Submissions by Non-Randomized Clinicians",
380413
value = pre_total_subs_by_rand[
381414
pre_total_subs_by_rand$clinician_randomized == 0,
382415
]$num
383416
)
384417
```
385418

419+
####
420+
386421
```{r}
387422
#| label: valuebox post-launch total submissions by randomized clinicians
388-
#| title: Post-launch Total Submissions by Randomized Clinicians
389423
#| content: valuebox
390424
391425
list(
392426
icon = "clipboard-check-fill",
393427
color = "warning",
428+
title = "Post-launch Total Submissions by Randomized Clinicians",
394429
value = post_total_subs_by_rand[
395430
post_total_subs_by_rand$clinician_randomized == 1,
396431
]$num
@@ -399,7 +434,6 @@ list(
399434

400435
```{r}
401436
#| label: valuebox post-launch total submissions by non-randomized clinicians
402-
#| title: Post-launch Total Submissions by Non-Randomized Clinicians
403437
#| content: valuebox
404438
405439
value <- post_total_subs_by_rand[
@@ -413,6 +447,73 @@ if (identical(value, numeric(0))) {
413447
list(
414448
icon = "clipboard-x-fill",
415449
color = "warning",
450+
title = "Post-launch Total Submissions by Non-Randomized Clinicians",
451+
value = value
452+
)
453+
```
454+
455+
####
456+
457+
```{r}
458+
#| label: valuebox pre-launch total submissions by randomized clinicians no site champs
459+
#| content: valuebox
460+
461+
list(
462+
icon = "clipboard-check-fill",
463+
color = "info",
464+
title = "Pre-launch Total Submissions by Randomized Clinicians (No Site Champions)",
465+
value = pre_total_subs_by_rand_no_sc[
466+
pre_total_subs_by_rand_no_sc$clinician_randomized == 1,
467+
]$num
468+
)
469+
```
470+
471+
```{r}
472+
#| label: valuebox pre-launch total submissions by non-randomized clinicians no site champs
473+
#| content: valuebox
474+
475+
list(
476+
icon = "clipboard-x-fill",
477+
color = "info",
478+
title = "Pre-launch Total Submissions by Non-Randomized Clinicians (No Site Champions)",
479+
value = pre_total_subs_by_rand_no_sc[
480+
pre_total_subs_by_rand_no_sc$clinician_randomized == 0,
481+
]$num
482+
)
483+
```
484+
485+
####
486+
487+
```{r}
488+
#| label: valuebox post-launch total submissions by randomized clinicians no site champs
489+
#| content: valuebox
490+
491+
list(
492+
icon = "clipboard-check-fill",
493+
color = "warning",
494+
title = "Post-launch Total Submissions by Randomized Clinicians (No Site Champions)",
495+
value = post_total_subs_by_rand_no_sc[
496+
post_total_subs_by_rand_no_sc$clinician_randomized == 1,
497+
]$num
498+
)
499+
```
500+
501+
```{r}
502+
#| label: valuebox post-launch total submissions by non-randomized clinicians no site champs
503+
#| content: valuebox
504+
505+
value <- post_total_subs_by_rand_no_sc[
506+
post_total_subs_by_rand_no_sc$clinician_randomized == 0,
507+
]$num
508+
509+
if (identical(value, numeric(0))) {
510+
value <- 0
511+
}
512+
513+
list(
514+
icon = "clipboard-x-fill",
515+
color = "warning",
516+
title = "Post-launch Total Submissions by Non-Randomized Clinicians (No Site Champions)",
416517
value = value
417518
)
418519
```

0 commit comments

Comments
 (0)