phenome_core.core.database.model.api module

Control all aspects of the Object, Property and Relation models.

add_object_model(model, delete_if_exists)
add_property(property, delete_if_exists)
add_property_model(model, delete_if_exists)
add_relation(src_object, dest_object, relation_type_id, details)
create_object(model_id, ip_address, mac_address, unique_id, properties=None)
create_temporary_object(model_id, ip_address, mac_address, unique_id)
delete_model_by_id(model_id)
delete_object(object, delete_all_related_objects=False, remove_from_lookups=True)
delete_object_by_id(object_id)
delete_object_by_ip_and_mac(ipaddress, macaddress, delete_all_related_objects=False, remove_from_lookups=True)
delete_object_by_ip_and_model_id(ipaddress, model_id, delete_all_related_objects=False, remove_from_lookups=True)
delete_object_by_ipaddress(ipaddress, delete_all_related_objects=False, remove_from_lookups=True)
delete_object_by_mac_and_model_id(macaddress, model_id, delete_all_related_objects=False, remove_from_lookups=True)
delete_object_by_macaddress(macaddress, delete_all_related_objects=False, remove_from_lookups=True)
delete_relation(src_object, dest_object, relation_type_id)
delete_relations(src_object)
get_active_prediction_models_by_object(object_id)

Returns active prediction models for a particular object :param object_id: The object ID :return: list of prediction model definitions currently active for this object

get_active_predictions_by_object(object_id, models_only=False)

Returns active predictions (latest values) for a particular object :param object_id: The object ID :param models_only: Bool if True only return the models, not the predicted values :return: list of prediction values currently active for this object

get_all_objects()
get_all_properties_by_objectmodel(model)
get_datamodel_columns(model_classtype)

Returns the datamodel columns for a specified model classtype :param model_classtype: Model Classtype :return: list of columns

get_default_propertyvalues_by_classtype_and_property(model_classtype, property_name)
get_extended_datamodel_columns(model_classtype, data_column_list)

Creates an extended datacolumn list and expands an existing list if needed :param model_classtype: The Model Classtype for the DataModel :param data_column_list: the list if any :return: list of datacolumns

get_model_classtype_id_by_model_id(model_id)
get_object_by_id(id)
get_object_by_ip(ip_address)
get_object_by_ip_and_mac(ip_address, mac_address)
get_object_by_ip_and_model_id(ip_address, model_id)
get_object_by_mac(mac_address)
get_object_by_mac_and_model_id(mac_address, model_id)
get_object_by_unique_id(unique_id)
get_object_count()
get_object_count_by_classtype(model_classtype)
get_object_properties(object)
get_object_property_value(object, property_name)
get_object_raw(object)
get_objectmodel_by_id(model_id)
get_objectmodel_by_name(model_name)
get_objectmodels()
get_objectmodels_by_classtype(model_classtype)
get_objectmodels_by_subclasstype(model_subclasstype)
get_objects_by_ip_and_model_classtype(ip_address, model_classtype)
get_objects_by_ip_and_model_id(ip_address, model_id)
get_objects_by_mac_and_model_classtype(mac, model_classtype)
get_objects_by_mac_and_model_id(mac, model_id)
get_objects_by_model_classtype(model_classtype)
get_objects_by_model_classtype_raw(model_classtype)
get_objects_by_model_id(model_id)
get_objects_by_model_subclasstype(model_subclasstype)
get_objects_by_model_subclasstype_raw(model_subclasstype)
get_objects_by_uniqueid_and_model_classtype(uniqueid, model_classtype)
get_predictions(model_classtype, metric_id=None, period_id=None, object_id=None, include_current=False, combine=False, time_ascending=True)

Returns predictions (and current values if desired) for a variety of filters / situations.

Parameters
  • model_classtype – The model classtype filter

  • metric_id – The predicted object (i.e. temperature)

  • period_id – The period (1 minute, 1 hour, etc.)

  • object_id – The object ID

  • include_current – Includes the current values in the dataset as well as the predicted values

  • combine – combines both current and predicted values

Returns

json dict of prediction (and current values if specified)

get_predictive_model_stats_by_classtype(model_classtype, model_id=None)
get_properties_by_objectmodel(model)
get_propertymodels_by_classtype(model_classtype)
get_propertymodels_by_object(object)
get_propertymodels_by_objectmodel(model)
get_required_properties(property_models)
refresh_object(object)
reload_object(object)