Commit a239825b authored by Pauline Maury Laribière's avatar Pauline Maury Laribière
Browse files

Merge branch 'moving' into 'master'

Moving

See merge request !4
parents 0fd00bb3 505286c9
Pipeline #323957 passed with stage
in 11 seconds
^.*\.Rproj$
^\.Rproj\.user$
.gitattributes
.gitignore
.gitlab-ci.yml
Dockerfile
environment.yml
install.R
requirements.txt
data/*
.dockerignore
.renkulfsignore
.renku
example.html
example.Rmd
\ No newline at end of file
#' Get a codelist based on an identifier
#'
#' @param identifier the codelist's identifier
#' @param language string for language to return.
#' Available are 'fr', 'de', 'it', 'en'.
#' @param export_format the export's format
#' Available are CSV, XLSX, SDMX-ML or JSON.
#' @param version_format the export format's version
......@@ -20,25 +22,9 @@ get_codelist <- function(identifier,
parameters = glue::glue("annotations={tolower(annotations)}"),
id = identifier
)
dplyr::select(api$get_response(), contains(language) | matches("id"))
}
#' Get the data structure
#'
#' @param identifier the dataset's identifier
#' @param language the language of the response data
#' Available are 'fr', 'de', 'it', 'en'.
#'
#' @return data structure
#' @export
get_data_structure <- function(identifier, language = "fr") {
api <- api_class(
api_type = "dcat_data_structure",
id = identifier,
language = language
dplyr::select(
api$get_response(), dplyr::contains(language) | dplyr::matches("id")
)
api$get_response()
}
......@@ -55,7 +41,7 @@ get_data_structure <- function(identifier, language = "fr") {
#' (Code, Parent and Name in the selected language)
#' @export
get_nomenclature_one_level <- function(identifier,
filters=hash::hash(),
filters = hash::hash(),
level_number = 1,
language = "fr",
annotations = FALSE) {
......@@ -90,7 +76,7 @@ get_nomenclature_one_level <- function(identifier,
#' from `level_from` to `level_to` codes
#' @export
get_nomenclature_multiple_levels <- function(identifier,
filters=hash::hash(),
filters = hash::hash(),
level_from = 1,
level_to = 2,
language = "fr",
......@@ -110,3 +96,4 @@ get_nomenclature_multiple_levels <- function(identifier,
)
res <- api$get_response()
}
......@@ -10,12 +10,12 @@ This public library is made available for the internal FSO staff, the federal ad
You can install the library with
```
install.packages("fso.metadata")
devtools::install_github("SDCC/metadata-auto-r-library")
```
then at the beginning of your R script, you will need to
```
library("fso.metadata")
library("metadata-auto-r-library")
```
......
......@@ -14,12 +14,12 @@ knitr::opts_chunk$set(echo = TRUE)
You can install the library with
```{r install}
install.packages("fso.metadata")
devtools::install_github("SDCC/metadata-auto-r-library")
```
then at the beginning of your R script, you will need to
```{r library}
library("fso.metadata")
library("metadata-auto-r-library")
```
......@@ -32,12 +32,6 @@ get_codelist(identifier='CL_NOGA_SECTION', language='de')
```
## Data Structure
```{r , echo=FALSE}
get_data_structure(identifier='HCL_NOGA', language='it')
```
## Nomenclature
```{r , echo=FALSE}
my_filters <- hash::hash(
......
This diff is collapsed.
......@@ -10,6 +10,7 @@ library(httr)
library(jsonlite)
library(rsdmx)
# pkgload::load_all('fso.metadata')
# styler::style_pkg('fso.metadata')
# testthat::test_file("fso.metadata/tests/testthat.R")
\ No newline at end of file
# pkgload::load_all('.')
# styler::style_pkg('.')
# devtools::check('.')
# testthat::test_file("tests/testthat.R")
\ No newline at end of file
......@@ -20,11 +20,11 @@ Available are CSV, XLSX, SDMX-ML and JSON}
\item{\code{id}}{character. The identifier or id of the request's object}
\item{\code{language}}{character (default = "en"). The language of the response data.
\item{\code{language}}{character (default = "en"). Language of the response data.
Available are 'fr', 'de', 'it', 'en'}
\item{\code{version_format}}{numeric (default = 2.1). The export format's version
(2.0 or 2.1 when format is SDMX-ML)
(2.0 or 2.1 when format is SDMX-ML)
(for 'codelist')}
\item{\code{api_url}}{character. The url to make the request to.}
......
......@@ -6,6 +6,7 @@
\usage{
get_codelist(
identifier,
language = "fr",
export_format = "SDMX-ML",
version_format = 2.1,
annotations = FALSE
......@@ -14,6 +15,9 @@ get_codelist(
\arguments{
\item{identifier}{the codelist's identifier}
\item{language}{string for language to return.
Available are 'fr', 'de', 'it', 'en'.}
\item{export_format}{the export's format
Available are CSV, XLSX, SDMX-ML or JSON.}
......
......@@ -4,16 +4,16 @@
\alias{get_data_structure}
\title{Get the data structure}
\usage{
get_data_structure(identifier, language = "en")
get_data_structure(identifier, language)
}
\arguments{
\item{identifier}{the dataset's identifier}
\item{language}{the language of the response data
Available are 'fr', 'de', 'it', 'en'.}
Available are 'fr', 'de', 'it', 'en'}
}
\value{
data structure
data structure of dcat
}
\description{
Get the data structure
......
......@@ -6,10 +6,10 @@
\usage{
get_nomenclature_multiple_levels(
identifier,
filters,
filters = hash::hash(),
level_from = 1,
level_to = 2,
language = "en",
language = "fr",
annotations = FALSE
)
}
......
......@@ -6,9 +6,9 @@
\usage{
get_nomenclature_one_level(
identifier,
filters,
filters = hash::hash(),
level_number = 1,
language = "en",
language = "fr",
annotations = FALSE
)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment