Commit 82cb174e authored by Dorchies David's avatar Dorchies David
Browse files

feat: add get_indicateurs_services_services`

Refs #4
parent edec2720
Pipeline #26154 failed with stages
in 1 minute and 20 seconds
......@@ -7,6 +7,7 @@ export(get_hydrometrie_sites)
export(get_hydrometrie_stations)
export(get_indicateurs_services_communes)
export(get_indicateurs_services_indicateurs)
export(get_indicateurs_services_services)
export(get_niveaux_nappes_chroniques)
export(get_niveaux_nappes_chroniques_tr)
export(get_niveaux_nappes_stations)
......
#' Retrieve performance indicators from drinking water supply and sanitation services at commune level
#'
#' See the API documentation for available filter parameters: \url{https://hubeau.eaufrance.fr/page/api-indicateurs-services}
#'
#' @template param_get_common
#'
#' @return a [tibble::tibble] with one row by commune, by service and by year and the following columns:
#'
#' - "code_service": [character] identifier of the service
#' - "nom_service": [character] name of the service
#' - "code_commune_insee": [character] identifier of the commune
#' - "nom_commune": [character] name of the commune
#' - "numero_siren ": [character] SIREN identifier of the service
#' - "type_collectivite": [character] kind of collectivity
#' - "mode_gestion": [character] management mechanism of the service
#' - "annee": [integer] year of the data
#' - The following columns are the performance indicators flagged by their respective codes. The documentation of these codes can be found at this URL: \url{https://www.services.eaufrance.fr/indicateurs/indicateurs}.
#'
#' @export
#'
#' @examples
#' # Retrieve performance indicator time series of the services in Romilly-sur-Seine
#' get_indicateurs_services_services(list(code_commune = "10323"))
#'
get_indicateurs_services_services <- function(params,
cfg = config::get(file = system.file("config.yml",
package = "hubeau"))) {
l <- doApiQuery(api = "indicateurs_services",
operation = "services",
params = params,
cfg = cfg)
l <- lapply(l, function(x) {
x <- c(x, x$indicateurs)
x$indicateurs <- NULL
x
})
convert_list_to_tibble(l)
}
......@@ -22,6 +22,7 @@
#'
#' - [get_indicateurs_services_communes]: performance indicators by commune
#' - [get_indicateurs_services_indicateurs]: performance indicators by indicator
#' - [get_indicateurs_services_services]: performance indicators by commune for each service
#'
#' **API "Piézométrie"**
#'
......
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get_indicateurs_services_services.R
\name{get_indicateurs_services_services}
\alias{get_indicateurs_services_services}
\title{Retrieve performance indicators from drinking water supply and sanitation services at commune level}
\usage{
get_indicateurs_services_services(
params,
cfg = config::get(file = system.file("config.yml", package = "hubeau"))
)
}
\arguments{
\item{params}{a \link{list} the list of parameters of the queries and their values in the format \code{list(ParamName = "Param value", ...)}, use the function \link{get_available_params} for a list of the available parameters for a given operation in an API and see the API documentation for the complete list of available filter parameters}
\item{cfg}{a \link{config} object Configuration of the communication. Use by default the internal package
configuration}
}
\value{
a \link[tibble:tibble]{tibble::tibble} with one row by commune, by service and by year and the following columns:
\itemize{
\item "code_service": \link{character} identifier of the service
\item "nom_service": \link{character} name of the service
\item "code_commune_insee": \link{character} identifier of the commune
\item "nom_commune": \link{character} name of the commune
\item "numero_siren ": \link{character} SIREN identifier of the service
\item "type_collectivite": \link{character} kind of collectivity
\item "mode_gestion": \link{character} management mechanism of the service
\item "annee": \link{integer} year of the data
\item The following columns are the performance indicators flagged by their respective codes. The documentation of these codes can be found at this URL: \url{https://www.services.eaufrance.fr/indicateurs/indicateurs}.
}
}
\description{
See the API documentation for available filter parameters: \url{https://hubeau.eaufrance.fr/page/api-indicateurs-services}
}
\examples{
# Retrieve performance indicator time series of the services in Romilly-sur-Seine
get_indicateurs_services_services(list(code_commune = "10323"))
}
......@@ -29,6 +29,7 @@ Available functions:
\itemize{
\item \link{get_indicateurs_services_communes}: performance indicators by commune
\item \link{get_indicateurs_services_indicateurs}: performance indicators by indicator
\item \link{get_indicateurs_services_services}: performance indicators by commune for each service
}
\strong{API "Piézométrie"}
......
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