-
Notifications
You must be signed in to change notification settings - Fork 2
/
email.Rmd
140 lines (129 loc) · 3.48 KB
/
email.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
---
output: blastula::blastula_email
---
```{r echo=FALSE, warning=FALSE, message=FALSE}
library(glue)
library(lubridate)
library(connectapi)
library(ggplot2)
library(dplyr)
library(janitor)
library(stringr)
library(scales)
library(forcats)
knitr::opts_chunk$set(
echo=FALSE,
warning=FALSE,
message=FALSE
)
colour_mapping_lang <- c(
"Python" = "#FFD43B",
"R" = "#276BBE",
"Quarto" = "#75AADB",
"Unknown" = "#C4C7C9"
)
colour_mapping_type <- c(
"Document" = "#447099",
"Web App" = "#72994E",
"API" = "#EE6331",
"Unknown" = "#C4C7C9"
)
client <- connect()
content <- get_content(client)
```
```{r}
content <- content |>
# Classify content
mutate(
language = case_when(
!is.na(r_version) ~ "R",
!is.na(py_version) ~ "Python",
!is.na(quarto_version) ~ "Quarto",
TRUE ~ "Unknown"
),
app_type = case_when(
str_ends(app_mode, "static") ~ "Document",
str_ends(app_mode, "api") ~ "API",
str_ends(app_mode, "shiny") ~ "Web App",
str_ends(app_mode, "streamlit") ~ "Web App",
str_ends(app_mode, "bokeh") ~ "Web App",
str_ends(app_mode, "dash") ~ "Web App",
TRUE ~ "Unknown"
)
) |>
# Orgnize factors
mutate(
language = factor(language, levels = c("Unknown", "QUarto", "Python", "R")),
app_type = factor(app_type, levels = c("Unknown", "API", "Web App", "Document"))
)
```
# Connect Content Report for `r today()`
This report includes a summary of all the content that is currently published on Connect. As of today, Connect has **`r comma(nrow(content))`** items deployed:
```{r fig.align='center'}
content |>
group_by(language, app_type) |>
summarise(n = n(), .groups = "drop") |>
ggplot(aes(x = app_type, y = n)) +
geom_col(aes(fill = language)) +
scale_fill_manual(values = colour_mapping_lang) +
scale_y_continuous(label=comma) +
labs(
title = "Distribution of Content Deployed on Colorado",
subtitle = "By Langauge and Type",
x = "Type",
y = "Count",
fill = "Language"
) +
coord_flip()
```
```{r fig.align='center'}
content |>
tabyl(app_mode) |>
arrange(desc(n)) |>
mutate(app_mode = fct_reorder(factor(app_mode), n)) |>
ggplot(aes(x = app_mode, y = n)) +
geom_col() +
geom_label(aes(label = percent(percent, accuracy = 1)), nudge_y = 100) +
scale_y_continuous(label=comma) +
labs(
title = "Distribution of Content Deployed on Colorado",
subtitle = "By App Mode",
x = "App Mode",
y = "Count"
) +
coord_flip()
```
```{r fig.align='center'}
content |>
mutate(create_year_month = floor_date(created_time, unit = "month")) |>
group_by(language, create_year_month) |>
summarise(count = n(), .groups = "drop") |>
ggplot(aes(x = create_year_month, y = count)) +
geom_col(aes(fill = language)) +
scale_fill_manual(values = colour_mapping_lang) +
scale_y_continuous(label=comma) +
labs(
title = "Content Creation Over Time",
subtitle = "By langauge",
x = "Month",
y = "Count",
fill = "Language"
)
```
```{r fig.align='center'}
content |>
mutate(create_year_month = floor_date(created_time, unit = "month")) |>
group_by(app_type, create_year_month) |>
summarise(count = n(), .groups = "drop") |>
ggplot(aes(x = create_year_month, y = count)) +
geom_col(aes(fill = app_type)) +
scale_fill_manual(values = colour_mapping_type) +
scale_y_continuous(label=comma) +
labs(
title = "Content Creation Over Time",
subtitle = "By app type",
x = "Month",
y = "Count",
fill = "App Type"
)
```