Class: ConceptQL::Operators::Race

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

Overview

Represents a operator that will grab all person rows that match the given races

Race parameters are passed in as a set of strings. Each string represents a single race. The race string must match one of the values in the concept_name column of the concept table. If you misspell the race name you won’t get any matches

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



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

def query(db)
  db.from(:person___p)
    .join(:vocabulary__concept___vc, { vc__concept_id: :p__race_concept_id })
    .where(Sequel.function(:lower, :vc__concept_name) => arguments.map(&:downcase))
end