-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathREADME.Rmd
279 lines (216 loc) · 7.74 KB
/
README.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
---
output: github_document
html_preview: true
---
<!--
Copyright 2018 Province of British Columbia
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
-->
<!-- README.md is generated from README.Rmd. Please edit that file and re-knit-->
```{r setup, echo=FALSE, warning=FALSE}
library(gh)
library(rvest, quietly = TRUE) #web scraping
make_repo_info <- function(repo_name) {
repo_meta <- get_repo(repo_name)
repo_link <- paste0("#### [", repo_name, "](", repo_meta$repo$html_url, ")")
repo_description <- paste0("* ", repo_meta$repo$description)
badge <- get_badge(repo_meta$readme$message)
# travis_status <- get_travis_status(repo_name, repo_meta$contents)
cat(repo_link, repo_description, badge, "\n", sep = "\n")
}
get_repo <- function(repo_name) {
repo <- gh("/repos/bcgov/:repo", repo = repo_name)
contents <- gh("/repos/bcgov/:repo/contents/", repo = repo_name)
readme <- gh("/repos/bcgov/:repo/readme", repo = repo_name,
.send_headers = c(Accept = "application/vnd.github.VERSION.html"))
list(repo = repo, contents = contents, readme = readme)
}
## Get the html of the badge from the readme of a bcgov repo
get_badge <- function(html) {
html <- read_html(html)
tagged_badge_node <- tryCatch(rvest::html_node(html, "#user-content-devex-badge"),
error = function(e) NULL)
if (is.null(tagged_badge_node) || length(tagged_badge_node) == 0) {
ret <- find_badge(html)
} else {
ret <- paste0(gsub("\\n", "", as(tagged_badge_node, "character")), collapse = "")
}
paste0("* ", ret)
}
## Find the badge from the 'a' nodes
find_badge <- function(html) {
a_nodes <- rvest::html_nodes(html, "a")
node_text <- vapply(a_nodes, function(x) as(x, "character"), FUN.VALUE = character(1))
badge_nodes <- grep("BCDevExchange.+/(README|projectstates).md", node_text)
node_text[badge_nodes[1]]
}
# get_travis_status <- function(repo_name, contents) {
# if (any(vapply(contents, function(x) x$name == ".travis.yml", FUN.VALUE = logical(1)))) {
# ret <- paste0("* [![Travis-CI Build Status](https://travis-ci.org/bcgov/",
# repo_name, ".svg?branch=master)](https://travis-ci.org/bcgov/",
# repo_name, ")")
# } else {
# ret <- NULL
# }
# ret
# }
```
[![img](https://img.shields.io/badge/Lifecycle-Stable-97ca00)](https://github.com/bcgov/repomountie/blob/master/doc/lifecycle-badges.md)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
# Environmental Reporting BC - Repository List
Index of GitHub repositories administered by [Environmental Reporting BC](http://www2.gov.bc.ca/gov/content?id=FF80E0B985F245CEA62808414D78C41B)
Environmental Reporting BC provides access to information about our environment and how it relates to British Columbians. This information comes in the form of indicators that examine the state and trends of different aspects of our environment.
## Indicators
<details><summary><strong>Air</strong></summary>
```{r echo=FALSE, results='asis'}
air_indicators <- c("ozone-caaqs-indicator",
"pm25-caaqs-indicator"
)
invisible(lapply(air_indicators, make_repo_info))
```
</details>
<details><summary><strong>Climate Change</strong></summary>
```{r echo=FALSE, results='asis'}
cc_indicators <- c(
"climate-change-indicators-2015"
)
invisible(lapply(cc_indicators, make_repo_info))
```
</details>
<details><summary><strong>Land & Forests</strong></summary>
```{r echo=FALSE, results='asis'}
land_indicators <- c(
"land-designations-indicator",
"protected-lands-and-waters-indicator",
"roadless-areas-indicator",
"forest-management-indicators"
)
invisible(lapply(land_indicators, make_repo_info))
```
</details>
<details><summary><strong>Plants & Animals</strong></summary>
```{r echo=FALSE, results='asis'}
pa_indicators <- c(
"invasive-species-indicator",
"native-species-rank-indicator",
"grizzly-bear-status-indicator"
)
invisible(lapply(pa_indicators, make_repo_info))
```
</details>
<details><summary><strong>Sustainability</strong></summary>
```{r echo=FALSE, results='asis'}
susty_indicators <- c("bc-population-indicator",
"ghg-emissions-indicator",
"msw-disposal-indicator",
"tire-recycling-indicator",
"recycling-indicator"
)
invisible(lapply(susty_indicators, make_repo_info))
```
</details>
<details><summary><strong>Water</strong></summary>
```{r echo=FALSE, results='asis'}
water_indicators <- c("groundwater-levels-indicator",
"water-quality-analysis"
)
invisible(lapply(water_indicators, make_repo_info))
```
</details>
<!--
```{r echo=FALSE, results='asis'}
indicators <- c("bc-population-indicator",
"climate-change-indicators-2015",
"ghg-emissions-indicator",
"groundwater-levels-indicator",
"invasive-species-indicator",
"land-designations-indicator",
"msw-disposal-indicator",
"ozone-caaqs-indicator",
"pm25-caaqs-indicator",
"protected-lands-and-waters-indicator",
"tire-recycling-indicator"
)
invisible(lapply(indicators, make_repo_info))
```
-->
## [R](http://www.r-project.org) & [Python](https://www.python.org/) Packages
<details><summary><strong>R</strong></summary>
```{r echo=FALSE, results='asis'}
rpackages <- c("bcdata",
"bcgovr",
"bcgroundwater",
"bcmaps",
"bcmapsdata",
"canwqdata",
"cccharts",
"envreportutils",
"rcaaqs",
"rems",
"wqbc",
"wqindex",
"ranktrends"
)
invisible(lapply(rpackages, make_repo_info))
```
</details>
<details><summary><strong>Python</strong></summary>
```{r echo=FALSE, results='asis'}
pypackages <- c(
"designatedlands"
)
invisible(lapply(pypackages, make_repo_info))
```
</details>
<!--
```{r echo=FALSE, results='asis'}
rpackages <- c( "bcgovr",
"bcgroundwater",
"bcmaps",
"bcmaps.rdata",
"canwqdata",
"cccharts",
"designatedlands",
"envreportutils",
"rcaaqs",
"rems",
"wqbc",
"wqindex"
)
invisible(lapply(rpackages, make_repo_info))
```
-->
## Supporting & Other Analyses
<details><summary><strong>Interactive Data Visualizations</strong></summary>
```{r echo=FALSE, results='asis'}
int_tools <- c("land-designations-shinyapp")
invisible(lapply(int_tools, make_repo_info))
```
</details>
<details><summary><strong>Supporting Analyses</strong></summary>
```{r echo=FALSE, results='asis'}
analyses <- c(
"bc-raster-roads"
)
invisible(lapply(analyses, make_repo_info))
```
</details>
<details><summary><strong>Other Stuff</strong></summary>
```{r echo=FALSE, results='asis'}
analyses <- c("envreportbc-snippets"
)
invisible(lapply(analyses, make_repo_info))
```
</details>
## Getting Help or Reporting an Issue
To report bugs/issues/feature requests, please file an [Issue](https://github.com/bcgov/EnvReportBC/issues).
## How to Contribute
If you would like to contribute, please see our [CONTRIBUTING](CONTRIBUTING.md) guidelines.
## License
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons Licence" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/80x15.png" /></a><br /><a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.