Constructs a validated adapter object for a data source. At least one fetch function must be supplied.
Usage
new_hydrocan_adapter(
name,
description,
list_stations_fn,
fetch_flows_fn = NULL,
fetch_daily_flows_fn = NULL,
fetch_levels_fn = NULL,
fetch_daily_levels_fn = NULL,
list_stations_meta_fn = NULL,
title = NULL,
publisher = NULL,
license = NULL,
license_url = NULL,
terms_url = NULL,
docs_url = NULL
)Arguments
- name
Non-empty string identifying this source. Used as the registry key and as the
provider_namecolumn in output.- description
String describing the source and any known limitations (e.g. rolling data window). Shown by
hc_list_sources().- list_stations_fn
Function with no arguments returning a character vector of station IDs this source can serve.
- fetch_flows_fn
Optional
function(station_id, start_date, end_date)returning a tibble matching the flows schema (timestampcolumn).NULLif sub-daily flow data is not available.- fetch_daily_flows_fn
Optional
function(station_id, start_date, end_date)returning a tibble matching the daily flows schema (datecolumn).NULLif daily flow data is not available.- fetch_levels_fn
Optional
function(station_id, start_date, end_date)returning a tibble matching the flows schema (timestampcolumn) withparameter = "water_level".NULLif sub-daily level data is not available.- fetch_daily_levels_fn
Optional
function(station_id, start_date, end_date)returning a tibble matching the daily flows schema (datecolumn) withparameter = "water_level".NULLif daily level data is not available.- list_stations_meta_fn
Optional function with no arguments returning a tibble matching the stations schema.
NULLif station metadata is not available.- title
Optional string with the formal name of the dataset as published by the provider (used in citations).
- publisher
Optional string naming the organization that publishes the data (used in citations).
- license
Optional string naming the data license (e.g.
"CC-BY 4.0").- license_url
Optional string with a URL to the license text.
- terms_url
Optional string with a URL to the data provider's terms of use or data policy.
- docs_url
Optional string with a URL to human-readable documentation about the data (field definitions, codes, data structure). A machine- readable metadata endpoint is acceptable if no human-readable page exists.
