class

PlaceOS::Model::AiIncident

Inherits PlaceOS::Model::Timestamps < PlaceOS::Model::ModelBase < PlaceOS::Model::Associations < Neuroplastic < PgORM::Base < PgORM::Validators < PgORM::Table < PgORM::Persistence < PgORM::Associations < ActiveModel::Callbacks < ActiveModel::Validation < ActiveModel::Model < DB::Mappable < DB::Serializable < YAML::Serializable < JSON::Serializable < Reference < Object

Constants

CALLBACKS = { before_save: [] of Nil, after_save: [] of Nil, before_create: [do self.created_at = self.updated_at = Time.utc end] of Nil, after_create: [] of Nil, before_update: [do self.updated_at = Time.utc end] of Nil, after_update: [] of Nil, before_destroy: [:destroy_events, :destroy_reports, :destroy_agent_runs, :destroy_approval_requests, :destroy_report_deliveries, :destroy_verification_runs, :destroy_escalation_records, :destroy_feedback] of Nil, after_destroy: [] of Nil, }
Log = ::Log.for(self)
PRIMARY_KEY_TYPES = {:id => (String | Nil)} of Nil => Nil

macro level key => type

PRIMARY_KEYS = [{:id}]

Constructors

from_json(string_or_io : String | IO, trusted : Bool = false) : self
from_json(string_or_io : String | IO, root : String, trusted : Bool = false) : self

Deserializes the given JSON in string_or_io into an instance of self, assuming the JSON consists of an JSON object with key root, and whose value is the value to deserialize. Will not deserialise from fields with mass_assign: false

class User < ActiveModel::Model
  attribute name : String
  attribute google_id : UUID, mass_assign: false
end

User.from_json(%({"main": {"name": "Jason", "google_id": "f6f70bfb-c882-446d-8758-7ce47db39620"}}), root: "main") # => #<User:0x103131b20 @name="Jason">
from_trusted_json(string_or_io : String | IO, root : String) : self
from_trusted_json(string_or_io : String | IO) : self

Serialize from a trusted JSON source

from_trusted_yaml(string_or_io : String | IO) : self

Serialize from a trusted YAML source

from_yaml(string_or_io : String | IO, trusted : Bool = false) : self
new(rs : DB::ResultSet)
new(created_at : Time | ActiveModel::Model::None = ::ActiveModel::Model::None.new, updated_at : Time | ActiveModel::Model::None = ::ActiveModel::Model::None.new, status : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, severity : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, source : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, classification : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, confidence : Float64 | ActiveModel::Model::None = ::ActiveModel::Model::None.new, summary : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, correlation_key : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, report_schema_version : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, tenant_id : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, system_id : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, module_id : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, module_name : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, module_index : Int32 | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, duplicate_count : Int32 | ActiveModel::Model::None = ::ActiveModel::Model::None.new, last_seen_at : Time | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, resolved_at : Time | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, claim_token : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, claim_expires_at : Time | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, id : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new)

Initialize PlaceOS::Model::AiIncident from HTTP::Params.

Class methods

attributes

Returns all attribute keys.

changes(id : String | Nil | Nil = nil) : ChangeFeed

Changefeed at row (if id passed) or whole table level. Returns a ChangeFeed instance which can be used to invoke async callbacks via on or use blocking Iterator via each method.

elastic
from_rs(__temp_1696 : DB::ResultSet)
on_error(err : Exception | IO::Error)
primary_key

Base class for all Engine models

Source
table_name

Instance methods

after_create

Base class for all Engine models

after_destroy

Base class for all Engine models

after_initialize(trusted : Bool)
after_save

Base class for all Engine models

after_update

Base class for all Engine models

agent_runs
Source
apply_defaults

Generate code to apply default values

approval_requests
Source
assign_attributes(created_at : Time | Missing = Missing, updated_at : Time | Missing = Missing, status : String | Missing = Missing, severity : String | Missing = Missing, source : String | Missing = Missing, classification : String | Missing = Missing, confidence : Float64 | Missing = Missing, summary : String | Missing = Missing, correlation_key : String | Missing = Missing, report_schema_version : String | Missing = Missing, tenant_id : String | Nil | Missing = Missing, system_id : String | Nil | Missing = Missing, module_id : String | Nil | Missing = Missing, module_name : String | Nil | Missing = Missing, module_index : Int32 | Nil | Missing = Missing, duplicate_count : Int32 | Missing = Missing, last_seen_at : Time | Nil | Missing = Missing, resolved_at : Time | Nil | Missing = Missing, claim_token : String | Nil | Missing = Missing, claim_expires_at : Time | Nil | Missing = Missing, id : String | Nil | Missing = Missing)

Assign to multiple attributes.

assign_attributes(params : HTTP::Params | Hash(String, String) | Tuple(String, String))

Assign to multiple attributes via HTTP::Params.

assign_attributes(model : PlaceOS::Model::AiIncident)

Assign to multiple attributes from a model object

assign_attributes_from_json(json, root : String)
assign_attributes_from_json(json)
assign_attributes_from_trusted_json(json, root : String)
assign_attributes_from_trusted_json(json)

Assign each field from JSON if field exists in JSON and has changed in model

assign_attributes_from_trusted_yaml(yaml)
assign_attributes_from_yaml(yaml)

Uses the YAML parser as JSON is valid YAML

attributes

Returns a Hash of all attribute values

attributes_tuple

Returns a NamedTuple of all attribute values.

before_create

Base class for all Engine models

before_destroy

Base class for all Engine models

before_save

Base class for all Engine models

before_update

Base class for all Engine models

changed?

Check if any attributes have changed.

changed_attributes

Returns a Hash with all changed attributes.

changed_json(io : IO) : Nil

Serialize the set of changed attributes to JSON.

changed_json

Serialize the set of changed attributes to JSON.

changed_persist_attributes
changed_yaml(io : IO) : Nil

Serialize the set of changed attributes to YAML.

changed_yaml

Serialize the set of changed attributes to YAML.

claim_expires_at

claim_expires_at getter

claim_expires_at=(value : Time | Nil)

claim_expires_at setter

claim_expires_at_assigned?
claim_expires_at_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

claim_expires_at_changed?
claim_expires_at_default

claim_expires_at's default value

Source
claim_expires_at_present?
claim_expires_at_removed?
claim_expires_at_was
claim_expires_at_will_change!

Include claim_expires_at in the set of changed attributes, whether it has changed or not.

claim_token

claim_token getter

claim_token=(value : String | Nil)

claim_token setter

claim_token_assigned?
claim_token_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

claim_token_changed?
claim_token_default

claim_token's default value

Source
claim_token_present?
claim_token_removed?
claim_token_was
claim_token_will_change!

Include claim_token in the set of changed attributes, whether it has changed or not.

classification

classification getter

classification=(value : String)

classification setter

classification?

NOTE: use getter / getter! (not property / property!) so that the setter defined later in __create_initializer__ is the only setter on the field. Crystal's overload resolution silently fails to replace a property-defined setter with one of identical signature for generic types (e.g. Set(String)?, Array(String)?, String | Array(String)), although it does work for non-generic ones like String?. Defining the setter only once via __create_initializer__ ensures change tracking, sanitization, and custom setter blocks run uniformly across all types.

classification_assigned?
classification_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

classification_changed?
classification_default

classification's default value

Source
classification_present?
classification_removed?
classification_was
classification_will_change!

Include classification in the set of changed attributes, whether it has changed or not.

clear_changes_information

Reset changes for all attributes.

confidence

confidence getter

confidence=(value : Float64)

confidence setter

confidence?

NOTE: use getter / getter! (not property / property!) so that the setter defined later in __create_initializer__ is the only setter on the field. Crystal's overload resolution silently fails to replace a property-defined setter with one of identical signature for generic types (e.g. Set(String)?, Array(String)?, String | Array(String)), although it does work for non-generic ones like String?. Defining the setter only once via __create_initializer__ ensures change tracking, sanitization, and custom setter blocks run uniformly across all types.

confidence_assigned?
confidence_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

confidence_changed?
confidence_default

confidence's default value

Source
confidence_present?
confidence_removed?
confidence_was
confidence_will_change!

Include confidence in the set of changed attributes, whether it has changed or not.

correlation_key

correlation_key getter

correlation_key=(value : String)

correlation_key setter

correlation_key?

NOTE: use getter / getter! (not property / property!) so that the setter defined later in __create_initializer__ is the only setter on the field. Crystal's overload resolution silently fails to replace a property-defined setter with one of identical signature for generic types (e.g. Set(String)?, Array(String)?, String | Array(String)), although it does work for non-generic ones like String?. Defining the setter only once via __create_initializer__ ensures change tracking, sanitization, and custom setter blocks run uniformly across all types.

correlation_key_assigned?
correlation_key_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

correlation_key_changed?
correlation_key_default

correlation_key's default value

Source
correlation_key_present?
correlation_key_removed?
correlation_key_was
correlation_key_will_change!

Include correlation_key in the set of changed attributes, whether it has changed or not.

created_at

created_at getter

created_at=(value : Time)

Setters created_at setter

created_at?

NOTE: use getter / getter! (not property / property!) so that the setter defined later in __create_initializer__ is the only setter on the field. Crystal's overload resolution silently fails to replace a property-defined setter with one of identical signature for generic types (e.g. Set(String)?, Array(String)?, String | Array(String)), although it does work for non-generic ones like String?. Defining the setter only once via __create_initializer__ ensures change tracking, sanitization, and custom setter blocks run uniformly across all types.

created_at_assigned?
created_at_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

created_at_changed?
created_at_default

created_at's default value

created_at_present?
created_at_removed?
created_at_was
created_at_will_change!

Include created_at in the set of changed attributes, whether it has changed or not.

destroy_agent_runs
destroy_approval_requests
destroy_escalation_records
destroy_events
destroy_feedback
destroy_report_deliveries
destroy_reports
destroy_verification_runs
duplicate_count

duplicate_count getter

duplicate_count=(value : Int32)

duplicate_count setter

duplicate_count?

NOTE: use getter / getter! (not property / property!) so that the setter defined later in __create_initializer__ is the only setter on the field. Crystal's overload resolution silently fails to replace a property-defined setter with one of identical signature for generic types (e.g. Set(String)?, Array(String)?, String | Array(String)), although it does work for non-generic ones like String?. Defining the setter only once via __create_initializer__ ensures change tracking, sanitization, and custom setter blocks run uniformly across all types.

duplicate_count_assigned?
duplicate_count_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

duplicate_count_changed?
duplicate_count_default

duplicate_count's default value

Source
duplicate_count_present?
duplicate_count_removed?
duplicate_count_was
duplicate_count_will_change!

Include duplicate_count in the set of changed attributes, whether it has changed or not.

escalation_records
Source
events
Source
feedback
Source
id

id getter

id=(value : String | Nil)

id setter

id?
id_assigned?
id_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

id_changed?
id_default

id's default value

id_present?
id_removed?
id_was
id_will_change!

Include id in the set of changed attributes, whether it has changed or not.

invoke_props

Base class for all Engine models

last_seen_at

last_seen_at getter

last_seen_at=(value : Time | Nil)

last_seen_at setter

last_seen_at_assigned?
last_seen_at_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

last_seen_at_changed?
last_seen_at_default

last_seen_at's default value

Source
last_seen_at_present?
last_seen_at_removed?
last_seen_at_was
last_seen_at_will_change!

Include last_seen_at in the set of changed attributes, whether it has changed or not.

module_id

module_id getter

module_id=(value : String | Nil)

module_id setter

module_id_assigned?
module_id_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

module_id_changed?
module_id_default

module_id's default value

Source
module_id_present?
module_id_removed?
module_id_was
module_id_will_change!

Include module_id in the set of changed attributes, whether it has changed or not.

module_index

module_index getter

module_index=(value : Int32 | Nil)

module_index setter

module_index_assigned?
module_index_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

module_index_changed?
module_index_default

module_index's default value

Source
module_index_present?
module_index_removed?
module_index_was
module_index_will_change!

Include module_index in the set of changed attributes, whether it has changed or not.

module_name

module_name getter

module_name=(value : String | Nil)

module_name setter

module_name_assigned?
module_name_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

module_name_changed?
module_name_default

module_name's default value

Source
module_name_present?
module_name_removed?
module_name_was
module_name_will_change!

Include module_name in the set of changed attributes, whether it has changed or not.

persistent_attributes

Returns a Hash of all attributes that can be persisted.

primary_key

Base class for all Engine models

Source
primary_key_hash
report_deliveries
Source
report_schema_version

report_schema_version getter

report_schema_version=(value : String)

report_schema_version setter

report_schema_version?

NOTE: use getter / getter! (not property / property!) so that the setter defined later in __create_initializer__ is the only setter on the field. Crystal's overload resolution silently fails to replace a property-defined setter with one of identical signature for generic types (e.g. Set(String)?, Array(String)?, String | Array(String)), although it does work for non-generic ones like String?. Defining the setter only once via __create_initializer__ ensures change tracking, sanitization, and custom setter blocks run uniformly across all types.

report_schema_version_assigned?
report_schema_version_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

report_schema_version_changed?
report_schema_version_default

report_schema_version's default value

Source
report_schema_version_present?
report_schema_version_removed?
report_schema_version_was
report_schema_version_will_change!

Include report_schema_version in the set of changed attributes, whether it has changed or not.

reports
Source
resolved_at

resolved_at getter

resolved_at=(value : Time | Nil)

resolved_at setter

resolved_at_assigned?
resolved_at_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

resolved_at_changed?
resolved_at_default

resolved_at's default value

Source
resolved_at_present?
resolved_at_removed?
resolved_at_was
resolved_at_will_change!

Include resolved_at in the set of changed attributes, whether it has changed or not.

restore_attributes

Reset each attribute to their previous values and clears all changes.

severity

severity getter

severity=(value : String)

severity setter

severity?

NOTE: use getter / getter! (not property / property!) so that the setter defined later in __create_initializer__ is the only setter on the field. Crystal's overload resolution silently fails to replace a property-defined setter with one of identical signature for generic types (e.g. Set(String)?, Array(String)?, String | Array(String)), although it does work for non-generic ones like String?. Defining the setter only once via __create_initializer__ ensures change tracking, sanitization, and custom setter blocks run uniformly across all types.

severity_assigned?
severity_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

severity_changed?
severity_default

severity's default value

Source
severity_present?
severity_removed?
severity_was
severity_will_change!

Include severity in the set of changed attributes, whether it has changed or not.

source

source getter

source=(value : String)

source setter

source?

NOTE: use getter / getter! (not property / property!) so that the setter defined later in __create_initializer__ is the only setter on the field. Crystal's overload resolution silently fails to replace a property-defined setter with one of identical signature for generic types (e.g. Set(String)?, Array(String)?, String | Array(String)), although it does work for non-generic ones like String?. Defining the setter only once via __create_initializer__ ensures change tracking, sanitization, and custom setter blocks run uniformly across all types.

source_assigned?
source_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

source_changed?
source_default

source's default value

Source
source_present?
source_removed?
source_was
source_will_change!

Include source in the set of changed attributes, whether it has changed or not.

status

status getter

status=(value : String)

status setter

status?

NOTE: use getter / getter! (not property / property!) so that the setter defined later in __create_initializer__ is the only setter on the field. Crystal's overload resolution silently fails to replace a property-defined setter with one of identical signature for generic types (e.g. Set(String)?, Array(String)?, String | Array(String)), although it does work for non-generic ones like String?. Defining the setter only once via __create_initializer__ ensures change tracking, sanitization, and custom setter blocks run uniformly across all types.

status_assigned?
status_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

status_changed?
status_default

status's default value

Source
status_present?
status_removed?
status_was
status_will_change!

Include status in the set of changed attributes, whether it has changed or not.

summary

summary getter

summary=(value : String)

summary setter

summary?

NOTE: use getter / getter! (not property / property!) so that the setter defined later in __create_initializer__ is the only setter on the field. Crystal's overload resolution silently fails to replace a property-defined setter with one of identical signature for generic types (e.g. Set(String)?, Array(String)?, String | Array(String)), although it does work for non-generic ones like String?. Defining the setter only once via __create_initializer__ ensures change tracking, sanitization, and custom setter blocks run uniformly across all types.

summary_assigned?
summary_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

summary_changed?
summary_default

summary's default value

Source
summary_present?
summary_removed?
summary_was
summary_will_change!

Include summary in the set of changed attributes, whether it has changed or not.

system_id

system_id getter

system_id=(value : String | Nil)

system_id setter

system_id_assigned?
system_id_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

system_id_changed?
system_id_default

system_id's default value

Source
system_id_present?
system_id_removed?
system_id_was
system_id_will_change!

Include system_id in the set of changed attributes, whether it has changed or not.

table_name
tenant_id

tenant_id getter

tenant_id=(value : String | Nil)

tenant_id setter

tenant_id_assigned?
tenant_id_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

tenant_id_changed?
tenant_id_default

tenant_id's default value

Source
tenant_id_present?
tenant_id_removed?
tenant_id_was
tenant_id_will_change!

Include tenant_id in the set of changed attributes, whether it has changed or not.

updated_at

updated_at getter

updated_at=(value : Time)

updated_at setter

updated_at?

NOTE: use getter / getter! (not property / property!) so that the setter defined later in __create_initializer__ is the only setter on the field. Crystal's overload resolution silently fails to replace a property-defined setter with one of identical signature for generic types (e.g. Set(String)?, Array(String)?, String | Array(String)), although it does work for non-generic ones like String?. Defining the setter only once via __create_initializer__ ensures change tracking, sanitization, and custom setter blocks run uniformly across all types.

updated_at_assigned?
updated_at_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

updated_at_changed?
updated_at_default

updated_at's default value

updated_at_present?
updated_at_removed?
updated_at_was
updated_at_will_change!

Include updated_at in the set of changed attributes, whether it has changed or not.

validate_nilability

Validate that all non-nillable fields have values.

verification_runs
Source

Nested types