-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSMT_Report.Rmd
290 lines (200 loc) · 7.29 KB
/
SMT_Report.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
---
title: "Sketch Map Tool Numbers"
author: "Team Sketch Map Tool"
date: "`r Sys.Date()`"
output:
html_document:
code_folding: hide
toc: true
number_sections: true
toc_float:
collapsed: true
theme: cerulean
editor_options:
chunk_output_type: console
markdown:
wrap: sentence
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(readr)
library(ggplot2)
library(lubridate)
library(plotly)
library(tmap)
library(sf)
library(rnaturalearth)
```
# Background and data
Since 2024-12-05 we are analyzing the Apache Log which provides us with insides of the tool usage based in the IP adress.
# Creation of Sketch Maps
```{r, echo=FALSE, message=FALSE, warning=FALSE}
sketchmap_report_sketchmaps_20250115 <- read_delim("sketchmap-report-sketchmaps_20250115.csv",
delim = ";", escape_double = FALSE, trim_ws = TRUE)
sketchmap_report_sketchmaps_20250115_filter <- sketchmap_report_sketchmaps_20250115 |> filter(created_at > '2024-12-05' |> as.Date())
# cum counts per day for each layer
cumulative_counts <- sketchmap_report_sketchmaps_20250115_filter |>
arrange(created_at) |>
mutate(day = floor_date(created_at, "day")) |>
count(day, layer) |>
group_by(layer) |>
arrange(day) |> # Ensure correct order within each layer
mutate(cumulative_count = cumsum(n)) |>
ungroup()
# cum counts per day for all sketch maps
total_counts <- cumulative_counts |>
group_by(day) |>
summarise(n = sum(n), .groups = "drop") |>
mutate(layer = "Total") |>
arrange(day) |>
mutate(cumulative_count = cumsum(n))
# combine to one long table
final_counts <- bind_rows(cumulative_counts, total_counts) |>
arrange(day, layer)
# plot
chart1 <- final_counts |>
ggplot(aes(x = day, y = cumulative_count, color=layer)) +
geom_line() +
geom_point() +
labs(title = "Cumulative Count of Sketchmaps Over Time",
x = "Days",
y = "Cumulative Count") +
theme_classic()
ggplotly(chart1)
```
# Downloaded Sketch Maps
```{r,message=FALSE}
#How many created SKetch Maps were actually dowloaded?
sketchmap_report_sketchmaps_20250115_filter |> filter(!is.na(downloaded_at))|> nrow()
```
#Mapframes with downloads and uploads (can be multiple uploads per mapframe)
```{r,message=FALSE}
# Number of downloaded Sketch Maps vs. created Sketch Maps
sketchmap_report_sketchmaps_20250115_filter |> filter(!is.na(downloaded_at) & uploads>0) |> nrow()
#67
#67 downloads mapframes show and uploads. Uploads csv = 296. Does that mean that there were several multiple uploads???
```
#How was often consent was given to use uploaded sketchmaps to contribute to model training?
```{r,message=FALSE}
sketchmap_report_sketchmaps_20250115_filter |> filter(!is.na(downloaded_at) & uploads>0 & consenses>0) |> nrow()
#24
```
# Uploaded Sketch Maps and share of dowloaded results
```{r}
```
# SHare of Opt-in used
# Use of baselayers
```{r,message=FALSE}
#osm esri chart
donut <-sketchmap_report_sketchmaps_20250115_filter |>
group_by(layer) |>
summarise(count=n())
donut$fraction <- donut$count / sum(donut$count)
donut$ymax <- cumsum(donut$fraction)
donut$ymin <- c(0, head(donut$ymax, n=-1))
chart2 <- ggplot(donut, aes(ymax=ymax, ymin=ymin, xmax=2, xmin=1, fill=layer)) +
geom_rect() +
coord_polar(theta="y") +
xlim(c(0.2, 2.5)) +
theme_void() +
theme(legend.position = "right") +
labs(fill="Layer")
chart2
```
# Map format used for map creation
```{r,message=FALSE}
donut_format <-sketchmap_report_sketchmaps_20250115_filter |>
group_by(format) |>
summarise(count=n())
donut_format$fraction <- donut_format$count / sum(donut_format$count)
donut_format$ymax <- cumsum(donut_format$fraction)
donut_format$ymin <- c(0, head(donut_format$ymax, n=-1))
chart_format <- ggplot(donut_format, aes(ymax=ymax, ymin=ymin, xmax=2, xmin=1, fill=format)) +
geom_rect() +
coord_polar(theta="y") +
xlim(c(0.2, 2.5)) +
theme_void() +
theme(legend.position = "right") +
labs(fill="Layer")
chart_format
```
# Orientation chosen for map creation
```{r,message=FALSE}
#why is this not binary and other languages included
donut_orientation <-sketchmap_report_sketchmaps_20250115_filter |>
group_by(orientation) |>
summarise(count=n())
donut_orientation$fraction <- donut_orientation$count / sum(donut_format$count)
donut_orientation$ymax <- cumsum(donut_orientation$fraction)
donut_orientation$ymin <- c(0, head(donut_orientation$ymax, n=-1))
chart_orientation <- ggplot(donut_orientation, aes(ymax=ymax, ymin=ymin, xmax=2, xmin=1, fill=orientation)) +
geom_rect() +
coord_polar(theta="y") +
xlim(c(0.2, 2.5)) +
theme_void() +
theme(legend.position = "right") +
labs(fill="Layer")
chart_orientation
```
# Language used to create Sketch Map
```{r, message = FALSE}
#why are there ES and es, why are there missing values if we have filtered already to dec 5
donut_lang <-sketchmap_report_sketchmaps_20250115_filter |>
group_by(created_lang) |>
summarise(count=n())
donut_lang$fraction <- donut_lang$count / sum(donut_lang$count)
donut_lang$ymax <- cumsum(donut_lang$fraction)
donut_lang$ymin <- c(0, head(donut_lang$ymax, n=-1))
# Total count of all values(to put to the legend, does not work so far)
total_count <- sum(donut_lang$count)
chart_lang <- ggplot(donut_lang, aes(ymax=ymax, ymin=ymin, xmax=2, xmin=1, fill=created_lang)) +
geom_rect() +
coord_polar(theta="y") +
xlim(c(0.2, 2.5)) +
theme_void() +
theme(legend.position = "right") +
labs(fill="Layer") +
annotate("text", x = 2.7, y = 0, label = paste("Total: ", total_count), size = 5,hjust = 0)
chart_lang
```
# Countries where Sketch Maps have been created from
```{r,message=FALSE}
plot_data_country <- sketchmap_report_sketchmaps_20250115_filter %>%
group_by(created_from_country) %>%
summarise(n = n())
#why are there entries since dec 5 without information created_from_country (as well as no information for other columns based on Apache)
#download worldmap
world <- ne_countries(scale = "medium", returnclass = "sf")
#world_lokal <- st_read("/Users/aschauss/Documents/SketchMapTool/Statistics/Map/world-administrative-boundaries.geojson")
#transfrom to Mollweide
world_mollweide <- st_transform(world, crs = "+proj=moll")
#world_lokal <- st_transform(world_lokal, crs = "+proj=moll")
#group by iso code
sketchmap_report_sketchmaps_20250115_filter_iso <- sketchmap_report_sketchmaps_20250115_filter %>%
group_by(created_from_iso_code) %>%
summarise(count = sum(!is.na(created_from_iso_code)))
#rightjoin with world
sketchmap_report_world_iso <- sketchmap_report_sketchmaps_20250115_filter_iso %>%
rename(iso_a2 = created_from_iso_code) %>%
right_join(world_mollweide, by = "iso_a2")
#back to sf
sketchmap_report_world_iso <- st_as_sf(sketchmap_report_world_iso)
tmap_mode("view")
#print map vr
tm_shape(sketchmap_report_world_iso) +
tm_polygons("count",
palette = "brewer.reds",
title = "Count per Country",
style = "jenks", # Change classification method
n = 5 # Number of classes
) +
tm_borders() +
tm_layout(main.title = "Created Sketch Maps",
legend.outside = TRUE,
legend.position = c("left", "bottom"),
legend.bg.color = "white",
legend.frame = FALSE,
frame = FALSE
)
```