Class: ConceptQL::Operators::DateRange

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

Overview

Represents a operator that will create a date_range for every person in the database

Accepts two params: start and end formateed as ‘YYYY-MM-DD’ or ‘START’ or ‘END’ ‘START’ represents the first date of data in the data source, ‘END’ represents the last date of data in the data source,

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

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

Constructor Details

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

Instance Method Details

#query(db) ⇒ Object



16
17
18
19
20
21
# File 'lib/conceptql/operators/date_range.rb', line 16

def query(db)
  db.from(:person)
    .select_append(Sequel.cast_string('person').as(:criterion_type))
    .select_append(Sequel.expr(:person_id).as(:criterion_id))
    .select_append(start_date(db).as(:start_date), end_date(db).as(:end_date)).from_self
end

#typesObject



23
24
25
# File 'lib/conceptql/operators/date_range.rb', line 23

def types
  [:person]
end