Class: ConceptQL::Nodes::DateRange

Inherits:
Node
  • Object
show all
Defined in:
lib/conceptql/nodes/date_range.rb

Overview

Represents a node 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 Node

Node::COLUMNS

Instance Attribute Summary

Attributes inherited from Node

#values

Instance Method Summary collapse

Methods inherited from Node

#arguments, #children, #columns, #evaluate, #initialize, #select_it, #sql, #stream

Constructor Details

This class inherits a constructor from ConceptQL::Nodes::Node

Instance Method Details

#query(db) ⇒ Object



11
12
13
14
15
16
# File 'lib/conceptql/nodes/date_range.rb', line 11

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



18
19
20
# File 'lib/conceptql/nodes/date_range.rb', line 18

def types
  [:person]
end