Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ VignetteBuilder:
Config/testthat/edition: 3
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
X-schema.org-isPartOf: http://ropengov.org/
X-schema.org-keywords: ropengov
12 changes: 7 additions & 5 deletions R/ok.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@
#' o311_api("Bonn")
#' o311_ok()
#'
#' # check if Helsinki API is reachable - fails
#' o311_api("Helsinki, FI")
#' o311_ok()
#'
#' # check if Savonlinna API is reachable - should fail
#' o311_add_endpoint(
#' name = "Helsinki",
#' root = "asiointi.hel.fi/palautews/rest/v1/"
#' name = "Savonlinna, FI",
#' root = "https://savonlinna.asiointi.fi/eFeedback/api/georeport/v2"
#' )
#'
#' o311_api("Helsinki")
#' o311_ok()
#' o311_api("Savonlinna, FI")
#'
#' # return error message
#' try(o311_ok(error = TRUE))
Expand Down
7 changes: 7 additions & 0 deletions inst/endpoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@
"json": true,
"dialect": "Mark-a-Spot"
},
{
"name": "Helsinki, FI",
"root": "https://palautteet.hel.fi/public-api/open311-public-service/v1/",
"key": false,
"pagination": false,
"json": true
},
{
"name": "Turku, FI",
"root": "https://opaskartta.turku.fi/efeedback/api/georeport/6aika/",
Expand Down
5 changes: 4 additions & 1 deletion man/o311_endpoints.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions man/o311_ok.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 20 additions & 15 deletions vignettes/r311.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,14 @@ incomplete or outdated. `r311` offers an updated and modifiable endpoint list
that defines a number of open311 implementations that are defined for use in
the package. The list can be read using `o311_endpoints`.

Load the package:

``` r
```{r, eval=FALSE}
library(r311)
```


```{r, eval=FALSE}
o311_endpoints()
#> # A tibble: 69 × 12
#> name root docs jurisdiction key pagination limit json dialect deprecated deprecated_reason deprecated_url
Expand All @@ -83,7 +89,7 @@ The following code adds the open311 test server of Mecklenburg-Vorpommern,
Germany.


``` r
```{r, eval=FALSE}
o311_add_endpoint(
name = "MV Test",
root = "https://klarschiff-mv.sis-schwerin.de/backoffice/citysdk/",
Expand All @@ -95,7 +101,7 @@ Retrieving the endpoints list again confirms that you successfully added a
new row to the endpoints dataframe.


``` r
```{r, eval=FALSE}
nrow(o311_endpoints())
#> [1] 70
```
Expand All @@ -105,16 +111,15 @@ This function matches an API using endpoint name and jurisdiction ID and
attaches it to the active session. Query functions automatically detect the
attached API.


``` r
```{r, eval=FALSE}
o311_api("MV Test")
```

After attaching an API, `o311_ok` confirms that the selected endpoint is able
to handle request queries.


``` r
```{r, eval=FALSE}
o311_ok()
#> [1] TRUE
```
Expand All @@ -135,7 +140,7 @@ use `o311_services`, which returns a list of Rostock's administrative
services.


``` r
```{r, eval=FALSE}
o311_services()
#> # A tibble: 183 × 8
#> service_code service_name description metadata type keywords group group_id
Expand All @@ -159,7 +164,7 @@ o311_services()
To get data about civic issues in the city area, run `o311_requests`.


``` r
```{r, eval=FALSE}
o311_requests()
#> Simple feature collection with 52 features and 15 fields
#> Geometry type: POINT
Expand Down Expand Up @@ -190,7 +195,7 @@ by all endpoints. Using the `service_code` parameter with one of the previously
returned service codes, only complaints about broken traffic lights are returned.


``` r
```{r, eval=FALSE}
o311_requests(service_code = "3")
#> Simple feature collection with 6 features and 15 fields
#> Geometry type: POINT
Expand All @@ -214,7 +219,7 @@ Similarly, using a `service_request_id` from the output, you can retrieve a
single service request from the API.


``` r
```{r, eval=FALSE}
o311_request("250")
#> Simple feature collection with 1 feature and 15 fields
#> Geometry type: POINT
Expand All @@ -241,7 +246,7 @@ retrieves data from the first two pages, resulting in a tibble with 200
service requests.


``` r
```{r, eval=FALSE}
o311_api("Cologne")
o311_request_all(max_pages = 2)
#> Simple feature collection with 200 features and 11 fields
Expand Down Expand Up @@ -278,7 +283,7 @@ usually be found in the respective documentation (e.g. on GitHub for
The following query returns the last 50 requests tagged with the "idea" keyword.


``` r
```{r, eval=FALSE}
o311_api("Rostock, DE")
tickets <- o311_requests(keyword = "idea", max_requests = 50)
tickets
Expand Down Expand Up @@ -310,7 +315,7 @@ example, we query just the count of total requests using the `just_count`
parameter. The result is a 1×1 tibble containing a count value.


``` r
```{r, eval=FALSE}
o311_requests(just_count = TRUE)
#> # A tibble: 1 × 1
#> value
Expand All @@ -322,7 +327,7 @@ The CitySDK extensions also offers additional URL paths which can be queried
using the generic `o311_query` function.


``` r
```{r, eval=FALSE}
poly <- o311_query("areas")
plot(poly$grenze)
plot(tickets$geometry, add = TRUE, pch = 16)
Expand All @@ -339,7 +344,7 @@ user directory as returned by `tools::R_user_dir("r311")`. To reset the
database, run


``` r
```{r, eval=FALSE}
o311_reset_endpoints()
```

Expand Down
Loading