sailor.assetcentral.system

System module can be used to retrieve System information from AssetCentral.

Classes are provided for individual Systems as well as groups of Systems (SystemSet).

class sailor.assetcentral.system.System(ac_json)[source]

Bases: AssetcentralEntity

AssetCentral System Object.

Parameters

ac_json (dict) –

classmethod get_available_properties()

Return the available properties for this class.

get_indicator_data(start, end, indicator_set=None, *, timeout=None)[source]

Get timeseries data for all Equipment in the System.

This is a wrapper for sailor.sap_iot.fetch.get_indicator_data() that limits the fetch query to the equipment in this System.

Each component equipment will be returned as separate rows in the dataset, potentially making the dataset very sparse.

Parameters
  • start (Union[str, pd.Timestamp, datetime.timestamp, datetime.date]) – Begin of time series data.

  • end (Union[str, pd.Timestamp, datetime.timestamp, datetime.date]) – End of time series data.

  • indicator_set (IndicatorSet) – IndicatorSet for which timeseries data is returned.

  • timeout (Union[str, pd.Timedelta, datetime.timedelta]) – Maximum amount of time the request may take. Can be specified as an ISO 8601 string (like PT2M for 2-minute duration) or as a pandas.Timedelta or datetime.timedelta object. If None, there is no time limit.

Return type

sap_iot.TimeseriesDataset

get_leading_equipment(path=None)[source]

Get leading piece of equipment (by path or default).

New in version 1.9.0.

Parameters

path (Optional[List[Tuple[str, int]]]) –

property id

Return the ID of the object.

class sailor.assetcentral.system.SystemSet(elements)[source]

Bases: AssetcentralEntitySet

Class representing a group of Systems.

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

get_indicator_data(start, end, indicator_set=None, *, timeout=None)[source]

Fetch data for a set of systems for all component equipment of each system.

This is a wrapper for sailor.sap_iot.fetch.get_indicator_data() that limits the fetch query to the equipment in this SystemSet.

Similar to System.get_indicator_data each component will be returned as separate rows in the dataset, potentially making the dataset very sparse.

Parameters
  • start (Union[str, pd.Timestamp, datetime.timestamp, datetime.date]) – Begin of time series data.

  • end (Union[str, pd.Timestamp, datetime.timestamp, datetime.date]) – End of time series data.

  • indicator_set (IndicatorSet) – IndicatorSet for which timeseries data is returned.

  • timeout (Union[str, pd.Timedelta, datetime.timedelta]) – Maximum amount of time the request may take. Can be specified as an ISO 8601 string (like PT2M for 2-minute duration) or as a pandas.Timedelta or datetime.timedelta object. If None, there is no time limit.

Return type

sap_iot.TimeseriesDataset

get_leading_equipment(path=None)[source]

Get a DataFrame that contains all system ids together with their leading equipment id.

New in version 1.9.0.

Parameters

path (Optional[List[Tuple[str, int]]]) –

Return type

DataFrame

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.

sailor.assetcentral.system.create_analysis_table(system_set, indicator_data, selection=None, leading_equipment_path=None)[source]

Create analysis table for a system set.

An analysis table is a table in which each row contains all indicator data that are valid for a system and a timestamp. The system is represented by its leading piece of equipment. The data columns are represented by SystemIndicators or SystemAggregatedIndicators, i.e. their key consists of information about the indicator, the equipment counter, and for SystemAggregatedIndicators the aggregation function.

New in version 1.9.0.

Parameters
  • system_set (SystemSet) – Set of systems for which data is collected

  • indicator_data (TimeseriesDataset) – TimeseriesDataset containing the relevant indicator data

  • selection (Optional[Dict]) – dictionary that contains information about the pieces of equipment and indicators that are to be selected

  • leading_equipment_path (Optional[List[Tuple[str, int]]]) – path to the leading piece of equipment of a system

Return type

TimeseriesDataset

sailor.assetcentral.system.find_systems(*, extended_filters=(), **kwargs)[source]

Fetch Systems from AssetCentral with the applied filters, return a SystemSet.

This method supports the usual filter criteria, i.e. - Any named keyword arguments applied as equality filters, i.e. the name of the System property is checked against the value of the keyword argument. If the value of the keyword argument is an iterable (e.g. a list) then all objects matching any of the values in the iterable are returned.

Parameters
Return type

SystemSet

Examples

Find all Systems with name ‘MySystem’:

find_systems(name='MySystem')

Find all Systems which either have the name ‘MySystem’ or the name ‘MyOtherSystem’:

find_systems(name=['MySystem', 'MyOtherSystem'])

If multiple named arguments are provided then all conditions have to match.

Example

Find all Systems with name ‘MySystem’ which also is published (status_text = ‘Published’):

find_systems(name='MySystem', status_text='Published')

The extended_filters parameter can be used to specify filters that can not be expressed as an equality. Each extended_filter needs to be provided as a string, multiple filters can be passed as a list of strings. As above, all filter criteria need to match. Extended filters can be freely combined with named arguments. Here, too all filter criteria need to match for a System to be returned.

Example

Find all Systems with creation date higher or equal to 01.01.2020:

find_systems(extended_filters=['created_on >= "2020-01-01"'])