Skip to content

Commit

Permalink
initial version with only sources endpoints supported
Browse files Browse the repository at this point in the history
  • Loading branch information
e-kotov committed Dec 15, 2024
1 parent 862337d commit 4aec232
Show file tree
Hide file tree
Showing 21 changed files with 893 additions and 22 deletions.
9 changes: 9 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
^mapineqr\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
^README\.qmd$
^cran-comments\.md$
^private$
^tools$
^CITATION\.cff$
^codemeta\.json$
152 changes: 152 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# --------------------------------------------
# CITATION file created with {cffr} R package
# See also: https://docs.ropensci.org/cffr/
# --------------------------------------------

cff-version: 1.2.0
message: 'To cite package "mapineqr" in publications use:'
type: software
license: MIT
title: 'mapineqr: Access Mapineq inequality indicators via API'
version: 0.0.0.9000
doi: 10.32614/CRAN.package.mapineqr
abstract: Access Mapineq inequality indicators via API.
authors:
- family-names: Kotov
given-names: Egor
email: [email protected]
orcid: https://orcid.org/0000-0001-6690-5345
preferred-citation:
type: manual
title: mapineqr. Access Mapineq inequality indicators via API
authors:
- family-names: Kotov
given-names: Egor
email: [email protected]
orcid: https://orcid.org/0000-0001-6690-5345
year: '2024'
url: https://github.com/e-kotov/mapineqr
doi: 10.32614/CRAN.package.mapineqr
contact:
- family-names: Kotov
given-names: Egor
email: [email protected]
orcid: https://orcid.org/0000-0001-6690-5345
references:
- type: generic
title: 'Mapineq Link: Geospatial Dashboard and Database'
authors:
- family-names: Mills
given-names: Melinda C
- family-names: Leasure
given-names: Douglas
year: '2024'
month: '10'
publisher:
name: 'Mapineq deliverables. Turku: INVEST Research Flagship Centre / University
of Turku'
doi: 10.5281/zenodo.13864000
- type: software
title: checkmate
abstract: 'checkmate: Fast and Versatile Argument Checks'
notes: Imports
url: https://mllg.github.io/checkmate/
repository: https://CRAN.R-project.org/package=checkmate
authors:
- family-names: Lang
given-names: Michel
email: [email protected]
orcid: https://orcid.org/0000-0001-9754-0393
year: '2024'
- type: software
title: dplyr
abstract: 'dplyr: A Grammar of Data Manipulation'
notes: Imports
url: https://dplyr.tidyverse.org
repository: https://CRAN.R-project.org/package=dplyr
authors:
- family-names: Wickham
given-names: Hadley
email: [email protected]
orcid: https://orcid.org/0000-0003-4757-117X
- family-names: François
given-names: Romain
orcid: https://orcid.org/0000-0002-2444-4226
- family-names: Henry
given-names: Lionel
- family-names: Müller
given-names: Kirill
orcid: https://orcid.org/0000-0002-1416-3412
- family-names: Vaughan
given-names: Davis
email: [email protected]
orcid: https://orcid.org/0000-0003-4777-038X
year: '2024'
- type: software
title: httr2
abstract: 'httr2: Perform HTTP Requests and Process the Responses'
notes: Imports
url: https://httr2.r-lib.org
repository: https://CRAN.R-project.org/package=httr2
authors:
- family-names: Wickham
given-names: Hadley
email: [email protected]
year: '2024'
- type: software
title: purrr
abstract: 'purrr: Functional Programming Tools'
notes: Imports
url: https://purrr.tidyverse.org/
repository: https://CRAN.R-project.org/package=purrr
authors:
- family-names: Wickham
given-names: Hadley
email: [email protected]
orcid: https://orcid.org/0000-0003-4757-117X
- family-names: Henry
given-names: Lionel
email: [email protected]
year: '2024'
- type: software
title: rlang
abstract: 'rlang: Functions for Base Types and Core R and ''Tidyverse'' Features'
notes: Imports
url: https://rlang.r-lib.org
repository: https://CRAN.R-project.org/package=rlang
authors:
- family-names: Henry
given-names: Lionel
email: [email protected]
- family-names: Wickham
given-names: Hadley
email: [email protected]
year: '2024'
- type: software
title: tibble
abstract: 'tibble: Simple Data Frames'
notes: Imports
url: https://tibble.tidyverse.org/
repository: https://CRAN.R-project.org/package=tibble
authors:
- family-names: Müller
given-names: Kirill
email: [email protected]
orcid: https://orcid.org/0000-0002-1416-3412
- family-names: Wickham
given-names: Hadley
email: [email protected]
year: '2024'
- type: software
title: testthat
abstract: 'testthat: Unit Testing for R'
notes: Suggests
url: https://testthat.r-lib.org
repository: https://CRAN.R-project.org/package=testthat
authors:
- family-names: Wickham
given-names: Hadley
email: [email protected]
year: '2024'
version: '>= 3.0.0'

21 changes: 21 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Package: mapineqr
Title: Access Mapineq inequality indicators via API
Version: 0.0.0.9000
Authors@R:
person("Egor", "Kotov", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-6690-5345"))
Description: Access Mapineq inequality indicators via API.
License: MIT + file LICENSE
Imports:
checkmate,
dplyr,
httr2,
purrr,
rlang,
tibble
Suggests:
testthat (>= 3.0.0)
Config/testthat/edition: 3
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
23 changes: 2 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
MIT License

Copyright (c) 2024 Egor Kotov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
YEAR: 2024
COPYRIGHT HOLDER: mapineqr authors
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2024 mapineqr authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 6 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Generated by roxygen2: do not edit by hand

export(mi_nuts_levels)
export(mi_source_coverage)
export(mi_sources)
importFrom(rlang,.data)
27 changes: 27 additions & 0 deletions R/levels.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#' Get a list of available NUTS levels
#'
#' @return a `character` vector of valid NUTS levels that will be accepted by other functions.
#'
#' @export
#'
#' @examples
#' \dontrun{
#' mi_nuts_levels()
#' }
#'
mi_nuts_levels <- function(){
base_api_endpoint <- getOption("mapineqr.base_api_endpoint")
url_endpoint <- paste0(base_api_endpoint,
"get_levels/items.json")

response <- httr2::request(url_endpoint) |>
httr2::req_headers(
"Content-Type" = "application/json",
"User-Agent" = getOption("mapineqr.user_agent")
) |>
httr2::req_method("GET") |>
httr2::req_perform()

response_data <- httr2::resp_body_json(response) |> unlist()
return(response_data)
}
12 changes: 12 additions & 0 deletions R/onLoad.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.onLoad <- function(libname, pkgname) {
op <- options()
op.mapineqr <- list(
mapineqr.api_spec_json = "https://mapineqfeatures.web.rug.nl/api.json",
mapineqr.base_api_endpoint = "https://mapineqfeatures.web.rug.nl/functions/postgisftw.",
mapineq.user_agent = "mapineqr R package"
)
toset <- !(names(op.mapineqr) %in% names(op))
if (any(toset)) options(op.mapineqr[toset])

invisible()
}
Loading

0 comments on commit 4aec232

Please sign in to comment.