Skip to content

Commit

Permalink
Merge pull request #44 from inrae/40-update-api-poisson-with-new-endp…
Browse files Browse the repository at this point in the history
…oints

feat(poisson): add new endpoints
  • Loading branch information
DDorch authored Feb 22, 2024
2 parents f7555b9 + 3f4a33b commit 4430238
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 9 deletions.
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ export(get_indicateurs_services_services)
export(get_niveaux_nappes_chroniques)
export(get_niveaux_nappes_chroniques_tr)
export(get_niveaux_nappes_stations)
export(get_poisson_indicateurs)
export(get_poisson_observations)
export(get_poisson_operations)
export(get_poisson_stations)
export(get_prelevements_chroniques)
export(get_prelevements_ouvrages)
export(get_prelevements_points_prelevement)
Expand Down
51 changes: 48 additions & 3 deletions R/get_poisson.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,29 @@
#'
#' @examples
#' \dontrun{
#' # Get the endpoints available for the API "Poisson"
#' list_endpoints(api = "poisson")
#'
#' # List the stations available in Brest
#' get_poisson_stations(libelle_commune = "Brest")
#'
#' # List the operations available in Brest
#' get_poisson_operations(libelle_commune = "Brest")
#'
#' # List the indicators available in Brest
#' get_poisson_indicateurs(libelle_commune = "Brest")
#'
#' # Get the query parameters for the requested API/endpoint
#' list_params(api = "poisson",
#' endpoint = "observations")
#'
#' # Retrieve selected fields on a river fish sampled in Brest
#' library(dplyr)
#' fields <- paste("code_operation",
#' fields <- c("code_operation",
#' "date_operation",
#' "libelle_point_prelevement_aspe",
#' "effectif_lot",
#' "code_alternatif_taxon",
#' sep = ",")
#' "code_alternatif_taxon")
#'
#' brest_fishes <- get_poisson_observations(
#' list(
Expand All @@ -47,3 +58,37 @@ get_poisson_observations <- function(...) {

convert_list_to_tibble(l)
}

#' @export
#' @rdname get_poisson
get_poisson_indicateurs <- function(...) {

l <- doApiQuery(api = "poisson",
endpoint = "indicateurs",
...)

convert_list_to_tibble(l)
}

#' @export
#' @rdname get_poisson
get_poisson_operations <- function(...) {

l <- doApiQuery(api = "poisson",
endpoint = "operations",
...)

convert_list_to_tibble(l)
}

#' @export
#' @rdname get_poisson
get_poisson_stations <- function(...) {

l <- doApiQuery(api = "poisson",
endpoint = "stations",
...)

convert_list_to_tibble(l)
}

Binary file modified R/sysdata.rda
Binary file not shown.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,15 @@ API documentation: <https://hubeau.eaufrance.fr/page/api-poisson>

Available function:

- [`get_poisson_operations`](https://inrae.github.io/hubeau/reference/get_poisson.html):
sampling operations carried out at stations measuring the quality of
rivers
- [`get_poisson_observations`](https://inrae.github.io/hubeau/reference/get_poisson.html):
scientific fishery observations
fish observations made during sampling operations
- [`get_poisson_indicateurs`](https://inrae.github.io/hubeau/reference/get_poisson.html):
the IPR and IPR+ indicators calculated from fish observations
- [`get_poisson_stations`](https://inrae.github.io/hubeau/reference/get_poisson.html):
stations measuring the quality of rivers

## API “Prélèvements en eau”

Expand Down
5 changes: 4 additions & 1 deletion man-roxygen/hubeau.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ API documentation: <https://hubeau.eaufrance.fr/page/api-poisson>

Available function:

- [get_poisson_observations()]: scientific fishery observations
- [get_poisson_operations()]: sampling operations carried out at stations measuring the quality of rivers
- [get_poisson_observations()]: fish observations made during sampling operations
- [get_poisson_indicateurs()]: the IPR and IPR+ indicators calculated from fish observations
- [get_poisson_stations()]: stations measuring the quality of rivers

## API "Prélèvements en eau"

Expand Down
26 changes: 23 additions & 3 deletions man/get_poisson.Rd

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

5 changes: 4 additions & 1 deletion man/hubeau.Rd

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

0 comments on commit 4430238

Please sign in to comment.