sampo.schemas.schedule#

Overview#

Classes#

Schedule

Represents work schedule. Is a wrapper around DataFrame with specific structure.

Function#

order_nodes_by_start_time(works, wg)

Makes ScheduledWorks’ ordering that satisfies:

Classes#

class sampo.schemas.schedule.Schedule(schedule: pandas.DataFrame)#

Bases: sampo.schemas.serializable.JSONSerializable[Schedule]

Represents work schedule. Is a wrapper around DataFrame with specific structure.

property full_schedule_df: pandas.DataFrame#

The full schedule DataFrame with all works, data columns and a distinct column for ScheduledWork objects

Returns:

Full schedule DataFrame.

property pure_schedule_df: pandas.DataFrame#

Schedule DataFrame without service units and containing only original columns (stored in _data_columns field).

Returns:

Pure schedule DataFrame.

property works: Iterable[sampo.schemas.scheduled_work.ScheduledWork]#

Enumerates ScheduledWorks in the Schedule.

Returns:

Iterable collection of all the scheduled works.

property to_schedule_work_dict: ScheduleWorkDict#

Builds a ScheduleWorkDict from the Schedule.

Returns:

ScheduleWorkDict with all the scheduled works.

property execution_time: sampo.schemas.time.Time#

Calculates total schedule execution time.

Returns:

Finish time of the last work.

_data_columns: list[str] = ['idx', 'task_id', 'task_name', 'task_name_mapped', 'contractor', 'cost', 'volume',...#
_scheduled_work_column: str = 'scheduled_work_object'#
_columns: list[str]#
_serialize() sampo.schemas.serializable.T#

Converts all the meaningful information from this instance to a generic representation :return: A generic representation

classmethod _deserialize(dict_representation: sampo.schemas.serializable.T) Schedule#

Creates class instance from a representation :param representation: Representation produced by _serialize method :return: New class instance

merged_stages_datetime_df(offset: datetime.datetime | str) pandas.DataFrame#

Merges split stages of same works after lag optimization and returns schedule DataFrame shifted to start. :param offset: Start of schedule, to add as an offset. :return: Shifted schedule DataFrame with merged tasks.

offset_schedule(offset: datetime.datetime | str) pandas.DataFrame#

Returns full schedule object with start and finish columns pushed by date in offset argument. :param offset: Start of schedule, to add as an offset. :return: Shifted schedule DataFrame.

static from_scheduled_works(works: Iterable[sampo.schemas.scheduled_work.ScheduledWork], wg: sampo.schemas.graph.WorkGraph = None) Schedule#

Factory method to create a Schedule object from list of Schedule works and additional info :param wg: Work graph. If passed, given order of works should be

overridden by time-topological order supported by given WorkGraph

Parameters:

works – Iterable collection of ScheduledWork’s.

Returns:

Schedule.

Functions#

sampo.schemas.schedule.order_nodes_by_start_time(works: Iterable[sampo.schemas.scheduled_work.ScheduledWork], wg: sampo.schemas.graph.WorkGraph) list[str]#

Makes ScheduledWorks’ ordering that satisfies: 1. Ascending order by start time 2. Toposort

Parameters:
  • works

  • wg

Returns:

Attributes#

sampo.schemas.schedule.ResourceSchedule#
sampo.schemas.schedule.ScheduleWorkDict#