Azure Data Manager for Agriculture

Data types and supporting functions for interacting with Azure Data Manager for Agriculture.

class vibe_core.admag_client.ADMAgClient(base_url, api_version, client_id, client_secret, authority, default_scope)

Bases: object

Client for Azure Data Manager for Agriculture (ADMAg) API.

Parameters:
  • base_url (str) – The base URL for the ADMAg API.

  • api_version (str) – The API version to be used.

  • client_id (str) – The client ID.

  • client_secret (str) – The client secret.

  • authority (str) – The URI of the identity provider.

  • default_scope (str) – The scope of the access request.

get_fertilizer_info(party_id, intersects_with_geometry, min_start_operation, max_end_operation, associated_resource)

Retrieve the fertilizer information for a given party.

This method will return the fertilizer information for a given resource, associated with the provided party id, between the start & end operation dates specified and intersecting with input geometry.

Parameters:
  • party_id (str) – ID of the party.

  • intersects_with_geometry (Dict[str, Any]) – geometry of associated resource.

  • min_start_operation (str) – The minimum start date of the operation.

  • max_end_operation (str) – The maximum end date of the operation.

  • associated_resource (Dict[str, str]) – The associated resource.

Returns:

Dictionary with fertilizer information.

get_field(party_id, field_id)

Retrieve the field information for a given party and field.

Parameters:
  • party_id (str) – The ID of the party.

  • field_id (str) – The ID of the field.

Returns:

The field information.

get_harvest_info(party_id, intersects_with_geometry, min_start_operation, max_end_operation, associated_resource)

Retrieve the harvest information for a given party.

This method will return the harvest information for a given resource, associated with the provided party id, between the start & end operation dates specified and intersecting with input geometry.

Parameters:
  • party_id (str) – ID of the party.

  • intersects_with_geometry (Dict[str, Any]) – geometry of associated resource.

  • min_start_operation (str) – The minimum start date of the operation.

  • max_end_operation (str) – The maximum end date of the operation.

  • associated_resource (Dict[str, str]) – The associated resource.

Returns:

Dictionary with harvest information.

get_operation_info(party_id, intersects_with_geometry, operation_name, min_start_operation, max_end_operation, associated_resource, sources=[])

Retrieve the information of a specified operation for a given party.

This method will return information about the specified operation name, in the specified time range, for the given party and associated resource.

Parameters:
  • party_id (str) – The ID of the party.

  • intersects_with_geometry (Dict[str, Any]) – geometry of associated resource.

  • operation_name (str) – The name of the operation.

  • min_start_operation (str) – The minimum start date of the operation.

  • max_end_operation (str) – The maximum end date of the operation.

  • associated_resource (Dict[str, str]) – The associated resource.

  • sources (List[str]) – The sources of the operation.

Returns:

The operation information.

get_organic_amendments_info(party_id, intersects_with_geometry, min_start_operation, max_end_operation, associated_resource)

Retrieve the organic amendments information for a given party.

This method will return the organic amendments information for a given resource, associated with the provided party id, between the start & end operation dates specified and intersecting with input geometry.

Parameters:
  • party_id (str) – ID of the party.

  • intersects_with_geometry (Dict[str, Any]) – geometry of associated resource.

  • min_start_operation (str) – The minimum start date of the operation.

  • max_end_operation (str) – The maximum end date of the operation.

  • associated_resource (Dict[str, str]) – The associated resource.

Returns:

Dictionary with organic amendments information.

get_planting_info(party_id, intersects_with_geometry, min_start_operation, max_end_operation, associated_resource)

Retrieve the Planting information for a given resource.

This method will return the Planting information for a given resource, associated with the provided party id, between the start & end operation dates specified and intersecting with input geometry.

Parameters:
  • party_id (str) – id of the party to retrieve planting information.

  • intersects_with_geometry (Dict[str, Any]) – resource geometry.

  • min_start_operation (str) – The minimum start date of the operation.

  • max_end_operation (str) – The maximum end date of the operation.

  • associated_resource (Dict[str, str]) – The associated resource.

Returns:

Dictionary with planting information.

get_prescription(party_id, prescription_id)

Retrieve the prescription for a given party.

This method will return the prescription for a given party, associated with the provided party_id.

Parameters:
  • party_id (str) – ID of the Party.

  • prescription_id (str) – ID of the prescription.

Returns:

Dictionary with prescription.

get_prescription_map_id(party_id, field_id, crop_id)

Retrieve the prescription map ID for a given party.

This method will return the prescription map ID for a given party, associated with the provided field and crop IDs.

Parameters:
  • party_id (str) – ID of the Party.

  • field_id (str) – ID of the field.

  • crop_id (str) – ID of the crop.

Returns:

Dictionary with prescription map ID.

get_prescriptions(party_id, prescription_map_id, geometry={})

Retrieve the prescriptions for a given party.

This method will return the prescriptions for a given party, associated with the provided prescription map ID.

Parameters:
  • party_id (str) – ID of the party.

  • prescription_map_id (str) – ID of the prescription map.

  • geometry (Dict[str, Any]) – geometry intersect with prescriptions.

Returns:

Dictionary with prescriptions.

Return type:

Dict[str, Any]

get_season(season_id)

Retrieve season information with a given id.

Parameters:

season_id (str) – The id of the season to retrieve.

Returns:

The season data.

get_seasonal_field(party_id, seasonal_field_id)

Retrieve the information of a seasonal field for a given party.

Parameters:
  • party_id (str) – The ID of the party.

  • seasonal_field_id (str) – The ID of the seasonal field.

Returns:

The seasonal field information.

get_seasonal_fields(party_id, params={})

Retrieve the seasonal fields for a given party.

Parameters:
  • party_id (str) – The ID of the party.

  • params (Dict[str, Any]) – Additional parameters to be passed to the request. Defaults to {}.

Returns:

The information for each seasonal fields.

get_tillage_info(party_id, intersects_with_geometry, min_start_operation, max_end_operation, associated_resource)

Retrieve the tillage information for a given party.

This method will return the tillage information for a given resource, associated with the provided party id, between the start & end operation dates specified and intersecting with input geometry.

Parameters:
  • party_id (str) – ID of the Party.

  • intersects_with_geometry (Dict[str, Any]) – geometry of associated resource.

  • min_start_operation (str) – The minimum start date of the operation.

  • max_end_operation (str) – The maximum end date of the operation.

  • associated_resource (Dict[str, str]) – The associated resource.

Returns:

Dictionary with tillage information.

get_token(client_id, client_secret, authority, default_scope)

Generate the ADMAg access token to be used before each call.

Parameters:
  • client_id (str) – The client ID.

  • client_secret (str) – The client secret.

  • authority (str) – The URI of the identity provider.

  • default_scope (str) – The scope of the access request.

Returns:

The access token as a string.

Raises:

Exception – If error retrieving token.

header()

Generate a header containing authorization for ADMAg API requests.

Returns:

A dictionary containing the header for the API requests.

Return type:

Dict[str, str]

CONTENT_TAG = 'value'

Tag for the content of the response.

DEFAULT_TIMEOUT = 120

Default timeout for requests.

Tag for the next link of the response.

NEXT_PAGES_LIMIT = 100000

Maximum number of pages to retrieve in a single request.