Skip to content

Event

EventUseCase

Bases: AbstractUseCase

Use case to handle events

_ask_for_event_city()

Ask user in which city to search for events

Returns:

Type Description
str

Possible cities: ["Stuttgart", "Berlin", "Koeln", "Muenchen", "Dortmund"]

_determine_trip_medium(event_summary)

Determines which `MapsTripMode to use depending on trip duration and user possessions.

If the trip via walking is longer than 45 min then the user should, depending on possessions, use MapsTripMode.DRIVING or MapsTripMode.TRANSIT

Parameters:

Name Type Description Default
event_summary EventSummary

Used event to determine trip duration

required

Returns:

Type Description
Tuple[MapsTrip, MapsTripMode]

Trip and Medium user should use

_event_is_attendable(event, calendar_events)

Checks whether a single event can be attended

Parameters:

Name Type Description Default
event ReducedEvent

single event retrieved from aswe.api.event.event.events

required
calendar_events list[Any]

retrieved calendar events from aswe.api.calendar.calendar.get_events_by_timeframe

required

Returns:

Type Description
bool

whether event can be attended

_format_event_summary(event_summary)

Formats event summary to a readable string

Parameters:

Name Type Description Default
event_summary EventSummary

Short event summary

required

Returns:

Type Description
str

Single string that can be read by assistant

_get_attendable_events(raw_events, calendar_events)

Checks whether or not given events can be attended depending on existing events in the users calendar.

Parameters:

Name Type Description Default
raw_events list[ReducedEvent]

retrieved events from aswe.api.event.event.events

required
calendar_events list[Event]

retrieved calendar events from aswe.api.calendar.calendar.get_events_by_timeframe

required

Returns:

Type Description
list[EventSummary]

List of short summaries of events that can be attended.

_get_event_summary(event)

Collects short summary about event using weather & gmaps api

  • TODO: Fix typing for event

Parameters:

Name Type Description Default
event Any

raw event information

required

Returns:

Type Description
dict[str, Any]

short summary of given event which can be formatted to readable string

_get_event_times(event, event_duration=2)

Gets start and end time of event

  • TODO: Extract function as util

Parameters:

Name Type Description Default
event ReducedEvent

single event

required
event_duration int, optional

configurable duration in hours event should have. By default 2.

2

Returns:

Type Description
Tuple[datetime, datetime]

start and end datetime of given event

_get_events_in_preferred_city(start_datetime, end_datetime)

Asks user for preferred city and searches for events in given city.

Parameters:

Name Type Description Default
start_datetime datetime

Start of timeframe assistant should look for events

required
end_datetime datetime

End of timeframe assistant should look for events

required

Returns:

Type Description
list[ReducedEvent]

List of events in given timeframe

check_proactivity()

Check if there are any events in the next 30 minutes and trigger the assistant

trigger_assistant(best_match)

UseCase for events

  • TODO: Implement quotes_key

Parameters:

Name Type Description Default
best_match BestMatch

An object containing the best match for the user input.

required

Raises:

Type Description
NotImplementedError

If the given key was not found in the match case statement for implemented functions, or if the function is not implemented yet.