Skip to content

Commit 6ab7bdd

Browse files
committed
fix scatterplot on frontpage by adding cumulative submission function
1 parent 3eeb502 commit 6ab7bdd

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

aps-dashboard.qmd

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,22 +138,31 @@ ggplotly(chart_1, tooltip = c("x", "fill"))
138138
subs_over_time <- as.data.frame(dbGetQuery(
139139
con,
140140
"SELECT
141-
form_id AS sub,
142-
ar_institution AS institution,
143-
ar_aps_report_date AS date
144-
FROM 'APS-BL'
145-
ORDER BY date ASC;
141+
t.form_id AS sub,
142+
t.ar_institution AS institution,
143+
t.ar_aps_report_date AS date,
144+
COUNT(*) OVER (
145+
ORDER BY
146+
t.ar_aps_report_date
147+
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
148+
) AS cum_submissions
149+
FROM
150+
'APS-BL' AS t
151+
WHERE
152+
t.ar_aps_report_date IS NOT NULL
153+
ORDER BY
154+
date
146155
"
147156
))
148157
149158
# replace uninformative columns with string names
150159
subs_over_time <- subs_over_time |>
151160
left_join(institution, by = "institution") |>
152-
select(sub, date, institution_label)
161+
select(sub, cum_submissions, date, institution_label)
153162
154163
chart_2 <- ggplot(
155164
data = subs_over_time,
156-
aes(x = date, y = sub, color = institution_label)
165+
aes(x = date, y = cum_submissions, color = institution_label)
157166
) +
158167
geom_point() +
159168
theme(legend.position = "none", legend.title = element_blank()) +

0 commit comments

Comments
 (0)