Method: Abstractor::Abstractable::InstanceMethods#abstract

Defined in:
lib/abstractor/abstractable.rb

#abstract(options = {}) ⇒ void

This method returns an undefined value.

The method for generating abstractions from the abstractable entity.

The generation of abstactions is based on the setup of Abstactor::AbstractorAbstactionSchema, Abstractor::AbstractorSubject, Abstractor::AbstractorSubjectGroup and Abstractor::AbstractorAbstractionSource associated to the abstractable entity.

Namespacing allows for different sets data points to be associated to the same abstractable entity.

Namespacing is achieved by setting the Abstractor::AbstractorSubject#namespace_type and Abstractor::AbstractorSubject#namespace_id attributes.

Passing a namespace to this method will restrict the generation of abstractions to the given namespace. Otherwise, all configured abstractions associated to the abstractable entity will be generated.

A practical example of the use of a namespace would be two different clincal departments wanting to chart abstract two distinct sets of datapoints for progress notes extracted from an electronic medical record system.

Options Hash (options):

  • :namespace_type (String)

    The type parameter of the namespace.

  • :namespace_id (Integer)

    The instance parameter of the namespace.

  • :abstractor_abstraction_schema_ids (List of integers)

    List of abstractor_abstraction_schema_ids to limit abstraction.



89
90
91
92
93
94
95
96
97
# File 'lib/abstractor/abstractable.rb', line 89

def abstract(options = {})
  options = { namespace_type: nil, namespace_id: nil, abstractor_abstraction_schema_ids: [] }.merge(options)
  sentinental_groups = []
  self.class.abstractor_subjects(options).each do |abstractor_subject|
    abstractor_subject.abstract(self)
    sentinental_groups << abstractor_subject.abstractor_subject_group if abstractor_subject.abstractor_subject_group && abstractor_subject.abstractor_subject_group.has_subtype?(Abstractor::Enum::ABSTRACTOR_GROUP_SENTINENTAL_SUBTYPE)
  end
  sentinental_groups.uniq.map{|sentinental_group| regroup_sentinental_suggestions(sentinental_group, options)}
end