hydroserverpy.core.endpoints package

Submodules

hydroserverpy.core.endpoints.base module

class hydroserverpy.core.endpoints.base.HydroServerEndpoint(service)[source]

Bases: object

A base class for interacting with specific API endpoints within a HydroServer service.

Variables:
  • _model – The model class associated with this endpoint.

  • _api_route – The base route of the API.

  • _endpoint_route – The specific route of the endpoint.

hydroserverpy.core.endpoints.base.expand_docstring(model=None, include_uid=False)[source]

hydroserverpy.core.endpoints.data_loaders module

class hydroserverpy.core.endpoints.data_loaders.DataLoaderEndpoint(service)[source]

Bases: HydroServerEndpoint

An endpoint for interacting with DataLoader entities in the HydroServer service.

Variables:
  • _model – The model class associated with this endpoint, set to DataLoader.

  • _api_route – The base route of the API, derived from the service.

  • _endpoint_route – The specific route of the endpoint, set to ‘data-loaders’.

create(**kwargs)[source]

Create a new data loader in HydroServer.

Parameters:

name (str) – The name of the data loader.

Return type:

DataLoader

delete(uid)[source]

Delete an existing data loader in HydroServer.

Parameters:

uid (Union[UUID, str]) – The entity ID.

Return type:

None

get(uid)[source]

Retrieve a data loader owned by the logged-in user.

Parameters:

uid (Union[UUID, str]) – The entity ID.

Return type:

DataLoader

list()[source]

Retrieve a collection of data loaders owned by the logged-in user.

Return type:

List[DataLoader]

list_data_sources(uid)[source]

Retrieve a list of data source entities associated with a specific data loader.

Parameters:

uid (Union[UUID, str]) – The unique identifier of the data loader.

Returns:

A list of data sour instances associated with the data loader.

Return type:

List[DataSource]

update(uid, **kwargs)[source]

Update an existing data loader in HydroServer.

Parameters:
  • uid (Union[UUID, str]) – The entity ID.

  • name (str) – The name of the data loader.

Return type:

DataLoader

hydroserverpy.core.endpoints.data_sources module

class hydroserverpy.core.endpoints.data_sources.DataSourceEndpoint(service)[source]

Bases: HydroServerEndpoint

An endpoint for interacting with data source entities in the HydroServer service.

Variables:
  • _model – The model class associated with this endpoint, set to DataSource.

  • _api_route – The base route of the API, derived from the service.

  • _endpoint_route – The specific route of the endpoint, set to ‘data-sources’.

create(**kwargs)[source]

Create a new data source in HydroServer.

Parameters:
  • name (str) – The name of the data source.

  • path (Optional[str]) – The path to a local data source file.

  • link (Optional[str]) – The link to a remote data source file.

  • header_row (Optional[int]) – The row number where the data begins.

  • data_start_row (Optional[int]) – The row number where the data begins.

  • delimiter (Optional[str]) – The delimiter used by the data source file.

  • quote_char (Optional[str]) – The quote delimiter character used by the data source file.

  • interval (Optional[int]) – The time interval at which the data source should be loaded.

  • interval_units (Optional[Literal['minutes', 'hours', 'days', 'weeks', 'months']]) – The interval units used by the data source file.

  • crontab (Optional[str]) – The crontab used to schedule when the data source should be loaded.

  • start_time (Optional[datetime.datetime]) – When the data source should begin being loaded.

  • end_time (Optional[datetime.datetime]) – When the data source should stop being loaded.

  • paused (Optional[bool]) – Whether loading the data source should be paused or not.

  • timestamp_column (Union[int, str]) – The column of the data source file containing the timestamps.

  • timestamp_format (Optional[str]) – The format of the timestamps, using Python’s datetime strftime codes.

  • timestamp_offset (Optional[str]) – An ISO 8601 time zone offset designator code to be applied to timestamps in the data source file.

  • data_loader_id (UUID) – The ID of the data loader responsible for loading this data source.

  • data_source_thru (Optional[datetime.datetime]) – The timestamp through which the data source contains data.

  • last_sync_successful (Optional[bool]) – Whether the last data loading attempt was successful of not.

  • last_sync_message (Optional[str]) – A message generated by the data loader it attempted to load data from this data source.

  • last_synced (Optional[datetime.datetime]) – The last time the data loader attempted to load data from this data source.

  • next_sync (Optional[datetime.datetime]) – The next time the data loader will attempt to load data from this data source.

Return type:

DataSource

delete(uid)[source]

Delete an existing data source in HydroServer.

Parameters:

uid (Union[UUID, str]) – The entity ID.

Return type:

None

get(uid)[source]

Retrieve a data source owned by the logged-in user.

Parameters:

uid (Union[UUID, str]) – The entity ID.

Return type:

DataSource

list()[source]

Retrieve a collection of data sources owned by the logged-in user.

Return type:

List[DataSource]

list_datastreams(uid)[source]

Retrieve a list of datastream entities associated with a specific data source.

Parameters:

uid (Union[UUID, str]) – The unique identifier of the data source.

Returns:

A list of datastream instances associated with the data source.

Return type:

List[Datastream]

update(uid, **kwargs)[source]

Update an existing data source in HydroServer.

Parameters:
  • uid (Union[UUID, str]) – The entity ID.

  • name (str) – The name of the data source.

  • path (Optional[str]) – The path to a local data source file.

  • link (Optional[str]) – The link to a remote data source file.

  • header_row (Optional[int]) – The row number where the data begins.

  • data_start_row (Optional[int]) – The row number where the data begins.

  • delimiter (Optional[str]) – The delimiter used by the data source file.

  • quote_char (Optional[str]) – The quote delimiter character used by the data source file.

  • interval (Optional[int]) – The time interval at which the data source should be loaded.

  • interval_units (Optional[Literal['minutes', 'hours', 'days', 'weeks', 'months']]) – The interval units used by the data source file.

  • crontab (Optional[str]) – The crontab used to schedule when the data source should be loaded.

  • start_time (Optional[datetime.datetime]) – When the data source should begin being loaded.

  • end_time (Optional[datetime.datetime]) – When the data source should stop being loaded.

  • paused (Optional[bool]) – Whether loading the data source should be paused or not.

  • timestamp_column (Union[int, str]) – The column of the data source file containing the timestamps.

  • timestamp_format (Optional[str]) – The format of the timestamps, using Python’s datetime strftime codes.

  • timestamp_offset (Optional[str]) – An ISO 8601 time zone offset designator code to be applied to timestamps in the data source file.

  • data_loader_id (UUID) – The ID of the data loader responsible for loading this data source.

  • data_source_thru (Optional[datetime.datetime]) – The timestamp through which the data source contains data.

  • last_sync_successful (Optional[bool]) – Whether the last data loading attempt was successful of not.

  • last_sync_message (Optional[str]) – A message generated by the data loader it attempted to load data from this data source.

  • last_synced (Optional[datetime.datetime]) – The last time the data loader attempted to load data from this data source.

  • next_sync (Optional[datetime.datetime]) – The next time the data loader will attempt to load data from this data source.

Return type:

DataSource

hydroserverpy.core.endpoints.datastreams module

class hydroserverpy.core.endpoints.datastreams.DatastreamEndpoint(service)[source]

Bases: HydroServerEndpoint

An endpoint for interacting with datastream entities in the HydroServer service.

Variables:
  • _model – The model class associated with this endpoint, set to Datastream.

  • _api_route – The base route of the API, derived from the service.

  • _endpoint_route – The specific route of the endpoint, set to ‘datastreams’.

create(**kwargs)[source]

Create a new datastream in HydroServer.

Parameters:
  • name (str) – The name of the datastream.

  • description (str) – A description of the datastream.

  • observation_type (str) – The type of observation recorded in this datastream

  • sampled_medium (str) – The physical medium in which the observations were sampled.

  • no_data_value (float) – A numerical value representing no data at a given timestamp.

  • aggregation_statistic (str) – The statistic calculated over the time aggregation interval of observations in this datastream.

  • time_aggregation_interval (float) – The time interval over which the aggregation statistic is applied to observations.

  • status (Optional[str]) – The current status of this datastream.

  • result_type (str) – The type of result recorded in this datastream.

  • value_count (Optional[int]) – The total number of observations in this datastream.

  • phenomenon_begin_time (Optional[datetime.datetime]) – The timestamp representing when the first phenomenon recorded in this datastream occurred.

  • phenomenon_end_time (Optional[datetime.datetime]) – The timestamp representing when the last phenomenon recorded in this datastream occurred.

  • result_begin_time (Optional[datetime.datetime]) – The timestamp representing when the first observation of this datastream was recorded.

  • result_end_time (Optional[datetime.datetime]) – The timestamp representing when the last observation of this datastream was recorded.

  • data_source_id (Optional[uuid.UUID]) – The data source for observations of this datastream.

  • data_source_column (Optional[str]) – The name of the column containing this datastream’s observations in the data source file.

  • is_visible (bool) – Whether this datastream is publicly visible.

  • is_data_visible (bool) – Whether this observations associated with this datastream are publicly visible.

  • thing_id (UUID) – The site/thing from which observations of this datastream were recorded.

  • sensor_id (UUID) – The sensor used to record observations of this datastream.

  • observed_property_id (UUID) – The physical property being observed for this datastream.

  • processing_level_id (UUID) – The processing level applied to this datastream.

  • unit_id (UUID) – The unit used to record observations for this datastream.

  • time_aggregation_interval_units (Literal['seconds', 'minutes', 'hours', 'days']) – The time unit for this datastream’s time aggregation interval

  • intended_time_spacing (Optional[float]) – The time interval at which observations should be made for this datastream.

  • intended_time_spacing_units (Optional[Literal['seconds', 'minutes', 'hours', 'days']]) – The time unit for this datastream’s intended time spacing interval

Return type:

Datastream

delete(uid)[source]

Delete an existing datastream in HydroServer.

Parameters:

uid (Union[UUID, str]) – The entity ID.

Return type:

None

get(uid)[source]

Retrieve a datastream owned by the logged-in user.

Parameters:

uid (Union[UUID, str]) – The entity ID.

Return type:

Datastream

get_observations(uid, start_time=None, end_time=None, page=1, page_size=100000, include_quality=False, fetch_all=False)[source]

Retrieve observations from a specific datastream.

Parameters:
  • uid (Union[UUID, str]) – The unique identifier of the datastream.

  • start_time (datetime, optional) – The start time for filtering observations.

  • end_time (datetime, optional) – The end time for filtering observations.

  • page (int, optional) – The page number to retrieve (used for pagination).

  • page_size (int, optional) – The number of observations per page.

  • include_quality (bool, optional) – Whether to include quality information with each observation.

  • fetch_all (bool, optional) – Whether to fetch all observations (ignoring pagination).

Returns:

A DataFrame containing the retrieved observations.

Return type:

pd.DataFrame

list(owned_only=False, primary_owned_only=False)[source]

Retrieve a collection of datastreams owned by the logged-in user.

Parameters:
  • owned_only (bool) – Only list datastreams owned by the logged-in user.

  • primary_owned_only (bool) – Only list datastreams primary owned by the logged-in user.

Return type:

List[Datastream]

load_observations(uid, observations)[source]

Load observations to a specific datastream.

Parameters:
  • uid (Union[UUID, str]) – The unique identifier of the datastream.

  • observations (pd.DataFrame) – A DataFrame containing the observations to upload.

Return type:

None

Returns:

None

update(uid, **kwargs)[source]

Update an existing datastream in HydroServer.

Parameters:
  • uid (Union[UUID, str]) – The entity ID.

  • name (str) – The name of the datastream.

  • description (str) – A description of the datastream.

  • observation_type (str) – The type of observation recorded in this datastream

  • sampled_medium (str) – The physical medium in which the observations were sampled.

  • no_data_value (float) – A numerical value representing no data at a given timestamp.

  • aggregation_statistic (str) – The statistic calculated over the time aggregation interval of observations in this datastream.

  • time_aggregation_interval (float) – The time interval over which the aggregation statistic is applied to observations.

  • status (Optional[str]) – The current status of this datastream.

  • result_type (str) – The type of result recorded in this datastream.

  • value_count (Optional[int]) – The total number of observations in this datastream.

  • phenomenon_begin_time (Optional[datetime.datetime]) – The timestamp representing when the first phenomenon recorded in this datastream occurred.

  • phenomenon_end_time (Optional[datetime.datetime]) – The timestamp representing when the last phenomenon recorded in this datastream occurred.

  • result_begin_time (Optional[datetime.datetime]) – The timestamp representing when the first observation of this datastream was recorded.

  • result_end_time (Optional[datetime.datetime]) – The timestamp representing when the last observation of this datastream was recorded.

  • data_source_id (Optional[uuid.UUID]) – The data source for observations of this datastream.

  • data_source_column (Optional[str]) – The name of the column containing this datastream’s observations in the data source file.

  • is_visible (bool) – Whether this datastream is publicly visible.

  • is_data_visible (bool) – Whether this observations associated with this datastream are publicly visible.

  • thing_id (UUID) – The site/thing from which observations of this datastream were recorded.

  • sensor_id (UUID) – The sensor used to record observations of this datastream.

  • observed_property_id (UUID) – The physical property being observed for this datastream.

  • processing_level_id (UUID) – The processing level applied to this datastream.

  • unit_id (UUID) – The unit used to record observations for this datastream.

  • time_aggregation_interval_units (Literal['seconds', 'minutes', 'hours', 'days']) – The time unit for this datastream’s time aggregation interval

  • intended_time_spacing (Optional[float]) – The time interval at which observations should be made for this datastream.

  • intended_time_spacing_units (Optional[Literal['seconds', 'minutes', 'hours', 'days']]) – The time unit for this datastream’s intended time spacing interval

Return type:

Datastream

hydroserverpy.core.endpoints.observed_properties module

class hydroserverpy.core.endpoints.observed_properties.ObservedPropertyEndpoint(service)[source]

Bases: HydroServerEndpoint

An endpoint for interacting with observed property entities in the HydroServer service.

Variables:
  • _model – The model class associated with this endpoint, set to ObservedProperty.

  • _api_route – The base route of the API, derived from the service.

  • _endpoint_route – The specific route of the endpoint, set to ‘observed-properties’.

create(**kwargs)[source]

Create a new observed property in HydroServer.

Parameters:
  • name (str) – The name of the observed property.

  • definition (str) – The definition of the observed property.

  • description (Optional[str]) – A description of the observed property.

  • type (Optional[str]) – The type of the observed property.

  • code (Optional[str]) – A code representing the observed property.

Return type:

ObservedProperty

delete(uid)[source]

Delete an existing observed property in HydroServer.

Parameters:

uid (Union[UUID, str]) – The entity ID.

Return type:

None

get(uid)[source]

Retrieve an observed property owned by the logged-in user.

Parameters:

uid (Union[UUID, str]) – The entity ID.

Return type:

ObservedProperty

list(include_owned=True, include_unowned=True, include_templates=True)[source]

Retrieve a collection of observed properties.

Parameters:
  • include_owned (bool) – Whether to include owned observed properties.

  • include_unowned (bool) – Whether to include unowned observed properties.

  • include_templates (bool) – Whether to include template observed properties.

Return type:

List[ObservedProperty]

update(uid, **kwargs)[source]

Update an existing observed property in HydroServer.

Parameters:
  • uid (Union[UUID, str]) – The entity ID.

  • name (str) – The name of the observed property.

  • definition (str) – The definition of the observed property.

  • description (Optional[str]) – A description of the observed property.

  • type (Optional[str]) – The type of the observed property.

  • code (Optional[str]) – A code representing the observed property.

Return type:

ObservedProperty

hydroserverpy.core.endpoints.processing_levels module

class hydroserverpy.core.endpoints.processing_levels.ProcessingLevelEndpoint(service)[source]

Bases: HydroServerEndpoint

An endpoint for interacting with processing level entities in the HydroServer service.

Variables:
  • _model – The model class associated with this endpoint, set to ProcessingLevel.

  • _api_route – The base route of the API, derived from the service.

  • _endpoint_route – The specific route of the endpoint, set to ‘processing-levels’.

create(**kwargs)[source]

Create a new processing level in HydroServer.

Parameters:
  • code (str) – A code representing the processing level.

  • definition (Optional[str]) – The definition of the processing level.

  • explanation (Optional[str]) – The explanation of the processing level.

Return type:

ProcessingLevel

delete(uid)[source]

Delete an existing processing level in HydroServer.

Parameters:

uid (Union[UUID, str]) – The entity ID.

Return type:

None

get(uid)[source]

Retrieve a processing level owned by the logged-in user.

Parameters:

uid (Union[UUID, str]) – The entity ID.

Return type:

ProcessingLevel

list(include_owned=True, include_unowned=True, include_templates=True)[source]

Retrieve a collection of processing levels.

Parameters:
  • include_owned (bool) – Whether to include owned observed properties.

  • include_unowned (bool) – Whether to include unowned observed properties.

  • include_templates (bool) – Whether to include template observed properties.

Return type:

List[ProcessingLevel]

update(uid, **kwargs)[source]

Update an existing processing level in HydroServer.

Parameters:
  • uid (Union[UUID, str]) – The entity ID.

  • code (str) – A code representing the processing level.

  • definition (Optional[str]) – The definition of the processing level.

  • explanation (Optional[str]) – The explanation of the processing level.

Return type:

ProcessingLevel

hydroserverpy.core.endpoints.result_qualifiers module

class hydroserverpy.core.endpoints.result_qualifiers.ResultQualifierEndpoint(service)[source]

Bases: HydroServerEndpoint

An endpoint for interacting with result qualifier entities in the HydroServer service.

Variables:
  • _model – The model class associated with this endpoint, set to ResultQualifier.

  • _api_route – The base route of the API, derived from the service.

  • _endpoint_route – The specific route of the endpoint, set to ‘result-qualifiers’.

create(**kwargs)[source]

Create a new result qualifier in HydroServer.

Parameters:
  • code (str) – A code representing the result qualifier.

  • description (Optional[str]) – A description of the result qualifier.

Return type:

ResultQualifier

delete(uid)[source]

Delete an existing result qualifier in HydroServer.

Parameters:

uid (Union[UUID, str]) – The entity ID.

Return type:

None

get(uid)[source]

Retrieve a result qualifier owned by the logged-in user.

Parameters:

uid (Union[UUID, str]) – The entity ID.

Return type:

ResultQualifier

list(include_owned=True, include_unowned=True, include_templates=True)[source]

Retrieve a collection of result qualifiers.

Parameters:
  • include_owned (bool) – Whether to include owned observed properties.

  • include_unowned (bool) – Whether to include unowned observed properties.

  • include_templates (bool) – Whether to include template observed properties.

Return type:

List[ResultQualifier]

update(uid, **kwargs)[source]

Update an existing result qualifier in HydroServer.

Parameters:
  • uid (Union[UUID, str]) – The entity ID.

  • code (str) – A code representing the result qualifier.

  • description (Optional[str]) – A description of the result qualifier.

Return type:

ResultQualifier

hydroserverpy.core.endpoints.sensors module

class hydroserverpy.core.endpoints.sensors.SensorEndpoint(service)[source]

Bases: HydroServerEndpoint

An endpoint for interacting with sensor entities in the HydroServer service.

Variables:
  • _model – The model class associated with this endpoint, set to Sensor.

  • _api_route – The base route of the API, derived from the service.

  • _endpoint_route – The specific route of the endpoint, set to ‘sensors’.

create(**kwargs)[source]

Create a new sensor in HydroServer.

Parameters:
  • name (str) – The name of the sensor.

  • description (str) – A description of the sensor.

  • encoding_type (str) – The encoding type of the sensor.

  • manufacturer (Optional[str]) – The manufacturer of the sensor.

  • model (Optional[str]) – The model of the sensor.

  • model_link (Optional[str]) – A link to a website or file that describes the sensor model.

  • method_type (str) – The type of method used by this sensor to collect observations.

  • method_link (Optional[str]) – A link to a website or file that describes the sensor method.

  • method_code (Optional[str]) – A code representing the sensor method.

Return type:

Sensor

delete(uid)[source]

Delete an existing sensor in HydroServer.

Parameters:

uid (Union[UUID, str]) – The entity ID.

Return type:

None

get(uid)[source]

Retrieve a sensor owned by the logged-in user.

Parameters:

uid (Union[UUID, str]) – The entity ID.

Return type:

Sensor

list(include_owned=True, include_unowned=True, include_templates=True)[source]

Retrieve a collection of sensors.

Parameters:
  • include_owned (bool) – Whether to include owned observed properties.

  • include_unowned (bool) – Whether to include unowned observed properties.

  • include_templates (bool) – Whether to include template observed properties.

Return type:

List[Sensor]

update(uid, **kwargs)[source]

Update an existing sensor in HydroServer.

Parameters:
  • uid (Union[UUID, str]) – The entity ID.

  • name (str) – The name of the sensor.

  • description (str) – A description of the sensor.

  • encoding_type (str) – The encoding type of the sensor.

  • manufacturer (Optional[str]) – The manufacturer of the sensor.

  • model (Optional[str]) – The model of the sensor.

  • model_link (Optional[str]) – A link to a website or file that describes the sensor model.

  • method_type (str) – The type of method used by this sensor to collect observations.

  • method_link (Optional[str]) – A link to a website or file that describes the sensor method.

  • method_code (Optional[str]) – A code representing the sensor method.

Return type:

Sensor

hydroserverpy.core.endpoints.things module

class hydroserverpy.core.endpoints.things.ThingEndpoint(service)[source]

Bases: HydroServerEndpoint

An endpoint for interacting with thing entities in the HydroServer service.

Variables:
  • _model – The model class associated with this endpoint, set to Thing.

  • _api_route – The base route of the API, derived from the service.

  • _endpoint_route – The specific route of the endpoint, set to ‘things’.

create(**kwargs)[source]

Create a new thing in HydroServer.

Parameters:
  • latitude (float) – The WGS84 latitude of the location.

  • longitude (float) – The WGS84 longitude of the location.

  • elevation_m (Optional[float]) – The elevation in meters of the location.

  • elevation_datum (Optional[str]) – The datum used to represent the elevation of the location.

  • state (Optional[str]) – The state/province of the location.

  • county (Optional[str]) – The county/district of the location.

  • country (Optional[str]) – The ISO 3166-1 alpha-2 country code of the location.

  • name (str) – The name of the site/thing.

  • description (str) – A description of the site/thing.

  • sampling_feature_type (str) – The sampling feature type of the site/thing.

  • sampling_feature_code (str) – A code representing the sampling feature of the site/thing.

  • site_type (str) – The type of the site/thing.

  • data_disclaimer (Optional[str]) – An optional data disclaimer to attach to observations collected at this site/thing.

Return type:

Thing

create_tag(uid, key, value)[source]

Create a new tag for a specific thing.

Parameters:
  • uid (UUID or str) – The unique identifier of the thing.

  • key (str) – The key of the tag.

  • value (str) – The value of the tag.

Returns:

The created tag instance.

Return type:

Tag

delete(uid)[source]

Delete an existing thing in HydroServer.

Parameters:

uid (Union[UUID, str]) – The entity ID.

Return type:

None

delete_photo(uid, photo_uid)[source]

Delete a photo from a specific thing.

Parameters:
  • uid (UUID or str) – The unique identifier of the thing.

  • photo_uid (UUID or str) – The unique identifier of the photo.

Return type:

None

delete_tag(uid, tag_uid)[source]

Delete a tag from a specific thing.

Parameters:
  • uid (UUID or str) – The unique identifier of the thing.

  • tag_uid (UUID or str) – The unique identifier of the tag.

Return type:

None

get(uid)[source]

Retrieve a thing owned by the logged-in user.

Parameters:

uid (Union[UUID, str]) – The entity ID.

Return type:

Thing

get_archive(uid)[source]

Retrieve the archive associated with a specific thing.

Parameters:

uid (UUID or str) – The unique identifier of the thing.

Returns:

The archive instance associated with the thing.

Return type:

Archive

list(owned_only=False, primary_owned_only=False)[source]

Retrieve a collection of things owned by the logged-in user.

Parameters:
  • owned_only (bool) – Only list things owned by the logged-in user.

  • primary_owned_only (bool) – Only list things primary owned by the logged-in user.

Return type:

List[Thing]

list_datastreams(uid)[source]

List all datastreams associated with a specific thing.

Parameters:

uid (UUID or str) – The unique identifier of the thing.

Returns:

A list of datastream instances.

Return type:

List[Datastream]

list_photos(uid)[source]

List all photos associated with a specific thing.

Parameters:

uid (UUID or str) – The unique identifier of the thing.

Returns:

A list of photo instances.

Return type:

List[Photo]

list_tags(uid)[source]

List all tags associated with a specific thing.

Parameters:

uid (UUID or str) – The unique identifier of the thing.

Returns:

A list of tag instances.

Return type:

List[Tag]

update(uid, **kwargs)[source]

Update an existing thing in HydroServer.

Parameters:
  • uid (Union[UUID, str]) – The entity ID.

  • latitude (float) – The WGS84 latitude of the location.

  • longitude (float) – The WGS84 longitude of the location.

  • elevation_m (Optional[float]) – The elevation in meters of the location.

  • elevation_datum (Optional[str]) – The datum used to represent the elevation of the location.

  • state (Optional[str]) – The state/province of the location.

  • county (Optional[str]) – The county/district of the location.

  • country (Optional[str]) – The ISO 3166-1 alpha-2 country code of the location.

  • name (str) – The name of the site/thing.

  • description (str) – A description of the site/thing.

  • sampling_feature_type (str) – The sampling feature type of the site/thing.

  • sampling_feature_code (str) – A code representing the sampling feature of the site/thing.

  • site_type (str) – The type of the site/thing.

  • data_disclaimer (Optional[str]) – An optional data disclaimer to attach to observations collected at this site/thing.

Return type:

Thing

update_tag(uid, tag_uid, value)[source]

Update an existing tag for a specific thing.

Parameters:
  • uid (UUID or str) – The unique identifier of the thing.

  • tag_uid (UUID or str) – The unique identifier of the tag.

  • value (str) – The new value for the tag.

Returns:

The updated tag instance.

Return type:

Tag

upload_photo(uid, file)[source]

Upload a new photo to a specific thing.

Parameters:
  • uid (UUID or str) – The unique identifier of the thing.

  • file (IO) – The file-like object representing the photo to upload.

Returns:

A list of photo instances created by the upload.

Return type:

List[Photo]

hydroserverpy.core.endpoints.units module

class hydroserverpy.core.endpoints.units.UnitEndpoint(service)[source]

Bases: HydroServerEndpoint

An endpoint for interacting with unit entities in the HydroServer service.

Variables:
  • _model – The model class associated with this endpoint, set to Unit.

  • _api_route – The base route of the API, derived from the service.

  • _endpoint_route – The specific route of the endpoint, set to ‘units’.

create(**kwargs)[source]

Create a new unit in HydroServer.

Parameters:
  • name (str) – The name of the unit.

  • symbol (str) – The symbol of the unit.

  • definition (str) – The definition of the unit.

  • type (str) – The type of the unit.

Return type:

Unit

delete(uid)[source]

Delete an existing unit in HydroServer.

Parameters:

uid (Union[UUID, str]) – The entity ID.

Return type:

None

get(uid)[source]

Retrieve a unit owned by the logged-in user.

Parameters:

uid (Union[UUID, str]) – The entity ID.

Return type:

Unit

list(include_owned=True, include_unowned=True, include_templates=True)[source]

Retrieve a collection of units.

Parameters:
  • include_owned (bool) – Whether to include owned observed properties.

  • include_unowned (bool) – Whether to include unowned observed properties.

  • include_templates (bool) – Whether to include template observed properties.

Return type:

List[Unit]

update(uid, **kwargs)[source]

Update an existing unit in HydroServer.

Parameters:
  • uid (Union[UUID, str]) – The entity ID.

  • name (str) – The name of the unit.

  • symbol (str) – The symbol of the unit.

  • definition (str) – The definition of the unit.

  • type (str) – The type of the unit.

Return type:

Unit