RUFAS.routines.animal.life_cycle.animal_events module#

class RUFAS.routines.animal.life_cycle.animal_events.AnimalEvents#

Bases: object

A class to represent animal events in a farm simulation.

This class tracks the events related to animals including birth and other significant occurrences.

Attributes#

eventsdict[int, list[str]]

A dictionary containing the events indexed by the animal’s age in days. The values are lists of descriptions for the events on that day.

__init__() None#

Initialize a new AnimalEvents object.

init_from_string(events_str: str) None#

Initialize event from a string

Args:

events_str: string representation of events

add_event(animal_age: int, simulation_day: int, description: str) None#

Add a cow life event

Args:

animal_age: the date counter for the cow (from birth) simulation_day: day in the simulation description: the event happened on that day

get_most_recent_date(event_description: str) int#

Return the most recent age at which the event_description happened

Parameters#

event_descriptionstr

The description of the event to search for.

Returns#

int

The most recent age at which the event_description happened, -1 if not found.