sailor.assetcentral.group
Group module can be used to retrieve Groups information from AssetCentral.
Classes are provided for individual Groups as well as groups of Groups (GroupSet).
- class sailor.assetcentral.group.Group(ac_json)[source]
Bases:
AssetcentralEntity
AssetCentral Location Object.
- Parameters
ac_json (dict) –
- find_equipment(*, extended_filters=(), **kwargs)[source]
Retrieve all Equipment that are part of this group.
This is a wrapper for
sailor.assetcentral.equipment.find_equipment()
that limits the fetch query to members of this group.This method supports the common filter language explained at Filter Language.
- Parameters
extended_filters – See Filter Language.
**kwargs – See Filter Language.
- find_locations(*, extended_filters=(), **kwargs)[source]
Retrieve all Locations that are part of this group.
This is a wrapper for
sailor.assetcentral.location.find_location()
that limits the fetch query to members of this group.This method supports the common filter language explained at Filter Language.
- Parameters
extended_filters – See Filter Language.
**kwargs – See Filter Language.
- find_models(*, extended_filters=(), **kwargs)[source]
Retrieve all Models that are part of this group.
This is a wrapper for
sailor.assetcentral.model.find_models()
that limits the fetch query to members of this group.This method supports the common filter language explained at Filter Language.
- Parameters
extended_filters – See Filter Language.
**kwargs – See Filter Language.
- classmethod get_available_properties()
Return the available properties for this class.
- property id
Return the ID of the object.
- class sailor.assetcentral.group.GroupSet(elements)[source]
Bases:
AssetcentralEntitySet
Class representing a group of Groups.
- 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
- find_equipment(*, extended_filters=(), **kwargs)[source]
Retrieve all equipment that are part of any group in this GroupSet.
This is a wrapper for
sailor.assetcentral.equipment.find_equipment()
that limits the fetch query to members of any group in this set.This method supports the common filter language explained at Filter Language.
- Parameters
extended_filters – See Filter Language.
**kwargs – See Filter Language.
- find_locations(*, extended_filters=(), **kwargs)[source]
Retrieve all locations that are part of any group in this GroupSet.
This is a wrapper for
sailor.assetcentral.location.find_locations()
that limits the fetch query to members of any group in this set.This method supports the common filter language explained at Filter Language.
- Parameters
extended_filters – See Filter Language.
**kwargs – See Filter Language.
- find_models(*, extended_filters=(), **kwargs)[source]
Retrieve all models that are part of any group in this GroupSet.
This is a wrapper for
sailor.assetcentral.model.find_models()
that limits the fetch query to members of any group in this set.This method supports the common filter language explained at Filter Language.
- Parameters
extended_filters – See Filter Language.
**kwargs – See Filter Language.
- 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.group.find_groups(*, extended_filters=(), **kwargs)[source]
Fetch Groups from AssetCentral with the applied filters, return a GroupSet.
This method supports the common filter language explained at Filter Language, but the filters are evaluated locally rather than remotely, potentially leading to longer query times.
- Parameters
extended_filters – See Filter Language.
**kwargs – See Filter Language.
- Return type
Examples
Find all Groups with the name ‘MyGroup’:
find_groups(name='MyGroup')
Find all Groups which either have the name ‘MyGroup’ or the name ‘MyOtherGroup’:
find_group(name=['MyGroup', 'MyOtherGroup'])
Find all Groups with the name ‘MyGroup’ which are also of type ‘FLEET’:
find_groups(name='MyGroup', group_type='FLEET')
Find all Groups having a risk_value greater than 0:
groups = find_groups(extended_filters=['risk_value > 0'])