forked from openpharma/openpharma.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.Rmd
511 lines (424 loc) · 13 KB
/
index.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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
---
title: "github.com/openpharma"
output:
flexdashboard::flex_dashboard:
theme:
version: 4
bootswatch: minty
orientation: rows
social: menu
source_code: https://github.com/openpharma/openpharma.github.io
navbar:
- { title: "Github", href: "https://github.com/openpharma/", align: right, icon: github}
includes:
in_header: googleanalytics.html
---
```{r, include=FALSE}
library(flexdashboard)
library(ggplot2)
library(dplyr)
library(lubridate)
library(glue)
library(tidyr)
library(fontawesome) # devtools::install_github("rstudio/fontawesome")
library(plotly)
library(purrr)
library(dm)
library(DiagrammeR)
thematic::thematic_rmd(
font = "auto",
# To get the dark bg on the geom_raster()
sequential = thematic::sequential_gradient(fg_low = FALSE, fg_weight = 0, bg_weight = 1)
)
theme_set(theme_bw(base_size = 20))
```
```{r getdata}
library(readr)
commits <- read_rds("scratch/commits.rds") %>%
mutate(author = author_clean)
people <- read_rds("scratch/people.rds")
repos <- read_rds("scratch/repos.rds")
help <- read_rds("scratch/help.rds")
badges <- read_csv("scratch/badges.csv")
```
Organization
=====================================
Value Boxes {data-width=200}
-------------------------------------
### Primary
```{r}
valueBox(n_distinct(repos$repo), caption = "Total repos", icon = "fa-github")
```
### Commits
```{r}
valueBox(nrow(commits), caption = "Commits", color = "success", icon = "fa-code-branch")
```
### People
```{r}
valueBox(
n_distinct(people$author),
caption = "People", color = "success", icon = "fa-users")
```
### Intro issues
```{r}
valueBox(
help %>% nrow(),
caption = "Open issues needing help", color = "warning", icon = "fa-question")
```
### Companies
```{r}
valueBox(
n_distinct(people$company),
caption = "Unique employers", color = "success", icon = "fa-building")
```
Value Boxes {data-width=200}
-------------------------------------
###
```{r}
lookback <- 30*3
lookback_char <- "3 months"
valueBox(
commits %>%
filter(date > Sys.Date() - lookback) %>%
pull(full_name) %>% n_distinct(),
caption = glue("Repos active | Last {lookback_char}"),
color = "info", icon = "fa-chart-line"
)
```
###
```{r}
valueBox(
commits %>%
filter(date > Sys.Date() - lookback) %>%
nrow(),
caption = glue("Commits | Last {lookback_char}"),
color = "info", icon = "glyphicon-time")
```
###
```{r}
valueBox(
commits %>%
filter(date > Sys.Date() - lookback) %>%
pull(author) %>% n_distinct(),
caption = glue("People active | Last {lookback_char}"),
color = "info", icon = "glyphicon-time")
```
###
```{r}
valueBox(
repos %>% filter(lang == "python") %>% nrow(),
caption = "Python libraries", color = "info",
icon = "fab fa-python"
)
```
###
```{r}
valueBox(
repos %>% filter(lang == "r") %>% nrow(),
caption = "R packages", color = "info",
icon = "fab fa-r-project"
)
```
Tables {.tabset}
-------------------------------------
### Repositories
```{r}
hlp_repo_details <- function(x){
DT::datatable(
x %>% ungroup %>%
mutate(
`Last updated` = as.Date(gh_updated),
) %>%
arrange(desc(`Last updated`)) %>%
select(
Repo = pretty_repo,
Description = imputed_description,
`Type` = lang,
`Last updated`,
`Contributor overlap` = similar
),
rownames = FALSE,
escape = FALSE,
fillContainer = FALSE)
}
hlp_repo_details(repos)
```
### Help needed
```{r}
DT::datatable(
help %>% ungroup %>%
arrange(desc(updated)) %>%
select(
Repo = full_name,
Link = pretty_url,
Created = created,
Comments = comments,
Updated = updated,
Title = title,
Description = body
),
rownames = FALSE,
escape = FALSE,
fillContainer = FALSE)
```
### People
```{r, echo = FALSE}
DT::datatable(
people %>%
mutate(my = format(last_active, "%Y-%m")) %>%
group_by(my) %>% mutate(month_commits = sum(commits)) %>% ungroup %>%
mutate(
last_active = Sys.Date() - last_active,
contributor = as.character(glue(
'<img src="{avatar}" alt="" height="30" width = "30"> {name} (<a href="https://github.com/{author}">{author}</a>)'
)),
Blog = case_when(
blog == "" ~ "",
TRUE ~ as.character(glue('<a href="{blog}">link</a>'))
),
Name = glue("{name} ({author})")
) %>%
arrange(desc(my),desc(month_commits), desc(contributed_to), desc(commits)) %>%
select(
`Name (GH handle)` = contributor,
Repos = contributed_to,
`Repo list` = repo_list,
`Commits` = commits,
`Days since active` = last_active,
Company = company,
Location = location,
Blog
) ,
escape = FALSE,
rownames = FALSE,
fillContainer = FALSE)
```
### Health
```{r}
# kaplan mier estimate?
repos %>% ungroup %>%
mutate(
riskmetric_score = round(riskmetric_score,2)
) %>%
# tidy title
select(
Repo = pretty_repo,
`OS Health` = os_health,
`riskmetric` = riskmetric_score,
Commits,
Contributors
) %>%
arrange(
desc(`OS Health`)
) %>%
# table it
DT::datatable(
escape = FALSE,
rownames = FALSE,
fillContainer = FALSE
)
```
### Growth
```{r}
### People activity over time
plot <- commits %>%
mutate(
month = format(date, "%m"),
year = format(date, "%Y"),
year_mon = as.Date(glue("{year}-{month}-01"))
) %>%
group_by(year_mon) %>%
summarise(
Repos = n_distinct(full_name),
People = n_distinct(author)
) %>%
filter(year_mon >= as.Date("2020-01-01")) %>%
pivot_longer(
!year_mon,
names_to = "Active by month",
values_to = "Value"
) %>%
# remove last
group_by(`Active by month`) %>%
arrange(year_mon) %>%
slice(1:(n() - 1)) %>%
ggplot(
aes(
year_mon,
Value,
group = `Active by month`,
colour = `Active by month`
)
) +
geom_line() +
geom_point() +
labs(
title = "Active repos and people defined by monthly commit activity",
x = "Monthly",
y = "Active"
) + theme(legend.title = element_blank())
ggplotly(plot)
```
### Growth - with denominator
```{r}
range <- commits %>%
mutate(
month = format(date, "%m"),
year = format(date, "%Y"),
year_mon = as.Date(glue("{year}-{month}-01"))
) %>%
summarise(
min = min(year_mon), max = max(year_mon)
)
### People activity over time
plot <- commits %>%
mutate(
month = format(date, "%m"),
year = format(date, "%Y"),
year_mon = as.Date(glue("{year}-{month}-01"))
) %>%
group_by(year_mon) %>%
summarise(
Repos = n_distinct(full_name),
People = n_distinct(author)
) %>%
left_join(
tibble(
year_mon = seq.Date(min(range$min), max(range$max), by=1)
) %>%
left_join(
commits %>%
mutate(
month = format(date, "%m"),
year = format(date, "%Y"),
year_mon = as.Date(glue("{year}-{month}-01"))
) %>%
group_by(full_name) %>%
arrange(year_mon) %>% slice(1) %>%
# check one per date!
group_by(year_mon) %>% summarise(total = n()),
by = "year_mon"
) %>%
mutate(
total = case_when(
is.na(total) ~ as.integer(0),
TRUE ~ total
),
tracked_repos = cumsum(total)
) %>%
select(year_mon, `Repo's tracked` = tracked_repos),
by = "year_mon"
) %>%
filter(year_mon >= as.Date("2020-01-01")) %>%
pivot_longer(
!year_mon,
names_to = "Active by month",
values_to = "Value"
) %>%
# remove last
group_by(`Active by month`) %>%
arrange(year_mon) %>%
slice(1:(n() - 1)) %>%
ggplot(
aes(
year_mon,
Value,
group = `Active by month`,
colour = `Active by month`
)
) +
geom_line() +
geom_point() +
labs(
title = "Active repos and people defined by monthly commit activity",
x = "Monthly",
y = "Active"
) + theme(legend.title = element_blank())
ggplotly(plot)
```
Manifesto
=====================================
Column
-------------------------------------
### Manifesto
The objective of the Github [organisation github.com/openpharm](https://github.com/openpharma) (openpharma) is to provide a neutral home for open source software that is not tied to one company or institution. This Github organization is managed under the following principals:
Hosting repositories in a neutral space:
* openpharma allows repositories housed within it to set their own governance model
* openpharma is open to any project related to the Pharma industry
* openpharma makes no assumptions on what packages are part of an ‘ideal’ workflow
* a preference is always placed on opensource from day 1, but openpharma will also host packages in private repos on request
* [at launch, Roche has admin status for the organization] openpharma will work towards a governance model that is inclusive and builds trust in those contributing to packages (e.g. use a more formalized consortia like the pharmaverse to provide governance of the Github organization)
* openpharma is open to collaborating with relevant organizations like PHUSE, R Consortium, PSI and the pharmaverse – but openpharma will remain an open host to share projects and provide a platform for repositories looking for a neutral host.
* openpharma will not hold any IP or copyright of associated projects, it will not be a platform for discussion or host initiatives, and it will not release opinions or standards on which repositories form part of an ideal workflow.
Promoting collaboration on projects:
* openpharma will aim to build an inclusive list of collaborative projects hosted on github.com that goes beyond those physically hosted in github.com/openpharma.
* openpharma will surface these projects to encourage collaboration (e.g. provide a front end like https://insights.lfx.linuxfoundation.org/projects). As a starter, a proof of concept
has been made (this site)
### Links
- R/Pharma conference: [rinpharma.com](https://rinpharma.com/)
- R Consortium: [r-consortium.org](https://www.r-consortium.org/)
- Get your R project funded!: [ISC](https://www.r-consortium.org/projects/call-for-proposals)
Data
=====================================
Row {.tabset}
-------------------------------------
### Details on the data pull
The data for this site builds daily. You can access the latest metadata via the
links on this page. See the Snakefile for an example of the build
process
The code that generates this data is in the repo
[openpharma/openpharma.github.io](https://github.com/openpharma/openpharma.github.io).
Right now the data is not stable - as it is planned to be used in the
upcoming pharmaverse.org website. Please reach out on the repo if you want to
use this data, or have ideas to improve / standardise it.
These files contains *all* the data up to today, and was pulled ~ `r Sys.time()`.
- Latest repo data ([csv](http://openpharma.s3-website.us-east-2.amazonaws.com/repos.csv), `r format(object.size(repos), units = "Mb")`)
- Latest people data ([csv](http://openpharma.s3-website.us-east-2.amazonaws.com/people.csv), `r format(object.size(people), units = "Mb")`)
- Latest who needs help data ([csv](http://openpharma.s3-website.us-east-2.amazonaws.com/help.csv), `r format(object.size(help), units = "Mb")`)
- Latest commits data ([csv](http://openpharma.s3-website.us-east-2.amazonaws.com/commits.csv), `r format(object.size(commits), units = "Mb")`)
### Data generation DAG
```{r}
grViz('
digraph snakemake_dag {
ratio=0.6
graph[bgcolor=white, margin=0];
node[shape=box, style=rounded, fontname=sans, fontsize=7, penwidth=2];
edge[penwidth=2, color=grey];
1[label = "website", color = "0.13 0.6 0.85", style="rounded"];
2[label = "merge", color = "0.27 0.6 0.85", style="rounded"];
3[label = "yaml", color = "0.40 0.6 0.85", style="rounded"];
4[label = "Github", color = "0.07 0.6 0.85", style="rounded"];
5[label = "S3 historical data", color = "0.20 0.6 0.85", style="rounded"];
6[label = "metacran", color = "0.53 0.6 0.85", style="rounded"];
7[label = "make shields", color = "0.33 0.6 0.85", style="rounded"];
2 -> 1
3 -> 2
4 -> 2
6 -> 2
5 -> 2
3 -> 4
5 -> 4
3 -> 6
2 -> 7
}
')
```
### Available data
```{r}
dm(repos, people, help, commits,badges) %>%
dm_add_pk(table = badges, columns = full_name) %>%
dm_add_pk(table = repos, columns = full_name) %>%
dm_add_pk(table = people, columns = author) %>%
dm_add_pk(table = help, columns = full_name) %>%
dm_add_pk(table = commits, columns = full_name) %>%
dm_add_fk(table = repos, columns = full_name, ref_table = commits) %>%
dm_add_fk(table = repos, columns = full_name, ref_table = help) %>%
dm_add_fk(table = repos, columns = full_name, ref_table = badges) %>%
dm_draw(
view_type = "all",
column_types = TRUE, rankdir = "TB")
```
<!-- ### Links to all raw data -->
<!-- ```{r} -->
<!-- readRDS("scratch/s3_contents.rds") %>% knitr::kable() -->
<!-- ``` -->