Class: ConceptQL::Operators::ToSeerVisits

Inherits:
Operator
  • Object
show all
Defined in:
lib/conceptql/operators/to_seer_visits.rb

Constant Summary

Constants inherited from Operator

Operator::COLUMNS

Instance Attribute Summary

Attributes inherited from Operator

#arguments, #options, #upstreams, #values

Instance Method Summary collapse

Methods inherited from Operator

#columns, #evaluate, #initialize, #label, #select_it, #set_values, #sql, #stream, #types

Methods included from Metadatable

#allows_many_upstreams, #allows_one_upstream, #argument, #category, #desc, #humanized_class_name, #inherited, #just_class_name, #option, #predominant_types, #preferred_name, #reset_categories, #to_metadata, #types

Constructor Details

This class inherits a constructor from ConceptQL::Operators::Operator

Instance Method Details

#query(db) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/conceptql/operators/to_seer_visits.rb', line 10

def query(db)
  query = options.map do |k, v|
    next if v.nil?
    db[:observation]
      .where(observation_source_value: k.to_s.upcase, value_as_string: v)
      .select(:visit_occurrence_id)
      .from_self
  end.compact.inject { |q, i| i.intersect(q) }
  db[:visit_occurrence].where(visit_occurrence_id: query)
end

#typeObject



6
7
8
# File 'lib/conceptql/operators/to_seer_visits.rb', line 6

def type
  :visit_occurrence
end