sailor.assetcentral.notification

Retrieve Notification information from AssetCentral.

Classes are provided for individual Notifications as well as groups of Notifications (NotificationSet).

class sailor.assetcentral.notification.Notification(ac_json)[source]

Bases: AssetcentralEntity

AssetCentral Notification Object.

Parameters

ac_json (dict) –

classmethod get_available_properties()

Return the available properties for this class.

plot_context(data=None, window_before=Timedelta('7 days 00:00:00'), window_after=Timedelta('2 days 00:00:00'))[source]

Plot a notification in the context of the timeseries data around the time of the notification.

This plot can be used to gain insight into the sensor behaviour around the time that a malfunction occurs. If the data parameter is left as None the data required for plotting is automatically retrieved from SAP IoT.

Parameters
  • data – TimeseriesDataset to use for plotting indicator data near the Notification.

  • window_before – Time interval plotted before a notification. Default value is 7 days before a notification

  • window_after – Time interval plotted after a notification. Default value is 2 days after a notification

update(**kwargs)[source]

Write the current state of this object to AssetCentral with updated values supplied.

After the update in the remote system was successful, this object reflects the updated state.

Accepts keyword arguments which names correspond to the available properties.

Example

notf2 = notf.update(notification_type='M1')
assert notf.notification_type == 'M1'
assert notf2 == notf
Returns

self

Return type

Notification

property id

Return the ID of the object.

class sailor.assetcentral.notification.NotificationSet(elements)[source]

Bases: AssetcentralEntitySet

Class representing a group of Notifications.

as_df(columns=None)

Return all information on the objects stored in the MasterDataEntitySet as a pandas dataframe.

columns can be specified to select the columns (and their order) for the DataFrame.

Parameters

columns (Optional[Iterable[str]]) –

filter(**kwargs)

Select a subset of the collection based on named filter criteria for the attributes of the elements.

All keyword arguments are concatenated as filters with OR operator, i.e., only one of the supplied filters must match for an entity to be selected.

Returns a new AssetcentralEntitySet object.

Return type

MasterDataEntitySet

plot_distribution(by=None, fill=None, dropna=False)

Plot the distribution of elements of a MasterDataEntitySet based on their properties.

This effectively creates a histogram with the number of elements per group on the y-axis, and the group (given by the by parameter) on the x-axis. Additionally, the fill colour of the bar can be used to distinguish a second dimension.

plot_overview()[source]

Plot an overview over all notifications in the set as a function of time.

Each notification will be shown by a rectangle, on a y-scale representing the affected equipment and with a color representing the confirmed failure mode description.

Example

Plot an overview over all notifications in the dataset “my_notifications” by time:

my_notifications.plot_overview()
sailor.assetcentral.notification.create_notification(**kwargs)[source]

Create a new notification.

Parameters

**kwargs – Keyword arguments which names correspond to the available properties.

Returns

A new notification object as retrieved from AssetCentral after the create succeeded.

Return type

Notification

Example

notf = create_notification(equipment_id=’123’, short_description=’test’,

notification_type=’M2’, status=’NEW’, priority=5)

sailor.assetcentral.notification.find_notifications(*, extended_filters=(), **kwargs)[source]

Fetch Notifications from AssetCentral with the applied filters, return a NotificationSet.

This method supports the common filter language explained at Filter Language.

Allowed entries for filter terms

Type of notifications and its meanings

M1: Maintenance Request, M2: BreakDown

Priorities and its meanings

5: Low, 10: Medium, 15: High, 20: Very High, 25: Emergency

Status types and its meanings

NEW: New, PBD: Published, CPT: Completed, IPR: InProcess

Parameters
Return type

NotificationSet

Examples

Find all notifications with short_description ‘MyNotification’:

find_notifications(short_description='MyNotification')

Find all notifications which either have the short_description ‘MyNotification’ or the short_description ‘MyOtherNotification’:

find_notifications(short_description=['MyNotification', 'MyOtherNotification'])

Find all notifications with short_description ‘MyNotification’ which also have the start date ‘2020-07-01’:

find_notifications(short_description='MyNotification', start_date='2020-07-01')

Find all notifications with a confirmed failure mode description is not empty:

find_notifications(extended_filters=['confirmed_failure_mode_description != "None"'])

Find all notifications in a given timeframe for specific equipment:

find_notifications(extended_filters=['malfunctionStartDate > "2020-08-01"',
                                     'malfunctionEndDate <= "2020-09-01"'],
                   equipment_id=['id1', 'id2'])
sailor.assetcentral.notification.update_notification(notification, **kwargs)[source]

Update an existing notification.

Write the current state of the given notification object to AssetCentral with updated values supplied. This equals a PUT request in the traditional REST programming model.

Parameters
  • **kwargs – Keyword arguments which names correspond to the available properties.

  • notification (Notification) –

Returns

A new notification object as retrieved from AssetCentral after the update succeeded.

Return type

Notification

Examples

notf = update_notification(notf, status=’IPR’, long_description=’hello world’)