oscar_colony.colony_management.pyrat.api.get_pyrat_data#

oscar_colony.colony_management.pyrat.api.get_pyrat_data(line_name=None, species_name=None, birth_date_from=None, birth_date_to=None, max_n_rows=10000)[source]#

Fetch animal data directly from the pyRAT api.

To handle the potentially large number of animals returned from pyRAT, this function returns a generator of pandas dataframes (each with no more than max_n_rows).

This expects PYRAT_URL, PYRAT_CLIENT_TOKEN and PYRAT_USER_TOKEN to be set as environment variables.

Parameters:
  • line_name (str | None) – Name of line to fetch

  • species_name (str | None) – Name of species to fetch

  • birth_date_from (date | None) – Earliest birth date to include

  • birth_date_to (date | None) – Latest birth date to include

  • max_no_rows (int, optional) – Maximum number of items in each returned dataframe (and therefore returned per request to the pyRAT api)

Returns:

Generator of dataframes of returned animal data, in format matching that exported via the pyRAT UI. If no data is available for the query, the dataframe will be empty.

Return type:

Iterator[DataFrame]