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)

Retrieves 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.

Returns:

Dictionary with fertilizer information.

get_field(party_id, field_id)

Retrieves 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)

Retrieves 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.

Returns:

Dictionary with harvest information.

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

Retrieves 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.

  • sources (List[str], default: []) – (optional) 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)

Retrieves 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.

Returns:

Dictionary with organic amendments information.

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

Retrieves 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:
  • resource – resource linked to 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.

Returns:

Dictionary with planting information.

get_prescription(party_id, prescription_id)

Retrieves 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.

return: Dictionary with prescription.

get_prescription_map_id(party_id, field_id, crop_id)

Retrieves 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.

return: Dictionary with prescription map ID.

get_prescriptions(party_id, prescription_map_id, geometry={})

Retrieves 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], default: {}) – geometry intersect with prescriptions.

Return type:

Dict[str, Any]

return: Dictionary with prescriptions.

get_season(season_id)

Retrieves 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)

Retrieves 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={})

Retrieves the seasonal fields for a given party.

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

  • params (Dict[str, Any], default: {}) – 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)

Retrieves 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.

Returns:

Dictionary with tillage information.

get_token(client_id, client_secret, authority, default_scope)

Generates 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()

Generates a header containing authorization for ADMAg API requests.

Returns:

Dict[str, str] – A dictionary containing the header for the API requests.

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.