Class: ConceptQL::Operators::CastingOperator
- Defined in:
- lib/conceptql/operators/casting_operator.rb
Overview
Parent class of all casting operators
Subclasses must implement the following methods:
-
my_domain
-
i_point_at
-
these_point_at_me
i_point_at returns a list of domains for which the operator’s table of origin has foreign_keys pointing to another table, e.g.: procedure_occurrence has an FK to visit_occurrence, so we’d put :visit_occurrence in the i_point_at array
these_point_at_me is a list of domains for which that domain’s table of origin has a FK pointing to the current operator’s table of origin, e.g.: procedure_cost has an FK to procedure_occurrence so we’d put :procedure_cost in procedure_occurrence’s these_point_at_me array
Also, if a casting operator is passed no streams, it will return all the rows in its table as results.
Direct Known Subclasses
Death, ObservationPeriod, Person, ProcedureOccurrence, VisitOccurrence
Instance Attribute Summary
Attributes inherited from Operator
#arguments, #errors, #nodifier, #options, #upstreams, #values
Instance Method Summary collapse
Methods inherited from Operator
#annotate, #cast_column, #code_list, codes_should_match, #columns, #create_upstreams, #data_model, #database_type, default_query_columns, #dup_values, #dynamic_columns, #evaluate, inherited, #initialize, #inspect, #label, new, #operator_name, #optimized, query_columns, register, require_column, #required_columns, #scope, #select_it, #setup_select, #sql, #stream, #to_op, #unionable?, #upstreams_valid?, #valid?
Methods included from Metadatable
#allows_many_upstreams, #allows_one_upstream, #argument, #auto_label, #basic_type, #category, #derive_metadata_from_validations, #desc, #get_desc, #humanized_class_name, #inherited, #just_class_name, #no_desc, #option, #predominant_domains, #pref_name, #preferred_name, #reset_categories, #standard_description, #to_metadata, #validate_at_least_one_upstream_to_metadata, #validate_at_most_one_upstream_to_metadata, #validate_no_arguments_to_metadata, #validate_no_upstreams_to_metadata, #validate_one_upstream_to_metadata, #validate_required_options_to_metadata, #warn_about_missing_metadata
Constructor Details
This class inherits a constructor from ConceptQL::Operators::Operator
Instance Method Details
#castables ⇒ Object
39 40 41 |
# File 'lib/conceptql/operators/casting_operator.rb', line 39 def castables (i_point_at + these_point_at_me) end |
#domain ⇒ Object
35 36 37 |
# File 'lib/conceptql/operators/casting_operator.rb', line 35 def domain my_domain end |
#domains(db) ⇒ Object
31 32 33 |
# File 'lib/conceptql/operators/casting_operator.rb', line 31 def domains(db) [domain] end |
#query(db) ⇒ Object
47 48 49 50 |
# File 'lib/conceptql/operators/casting_operator.rb', line 47 def query(db) return db.from(make_table_name(my_domain)) if stream.nil? base_query(db, stream.evaluate(db)) end |
#query_cols ⇒ Object
43 44 45 |
# File 'lib/conceptql/operators/casting_operator.rb', line 43 def query_cols table_columns(make_table_name(my_domain)) end |