Class: NcsNavigator::Mdes::TransmissionTable
- Inherits:
-
Object
- Object
- NcsNavigator::Mdes::TransmissionTable
- Defined in:
- lib/ncs_navigator/warehouse/table_modeler/mdes_ext.rb
Instance Method Summary collapse
- #wh_keys ⇒ Object
- #wh_manual_validations ⇒ Object
- #wh_model_name(module_name = nil) ⇒ Object
- #wh_variables ⇒ Object
Instance Method Details
#wh_keys ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ncs_navigator/warehouse/table_modeler/mdes_ext.rb', line 34 def wh_keys @wh_keys ||= begin pks = variables.select { |v| v.type.name == 'primaryKeyType' } if !pks.empty? pks elsif name == 'study_center' variables.select { |v| v.name == 'sc_id' } elsif name == 'psu' variables.select { |v| v.name == 'psu_id' } else fail "Could not determine key to use for #{name} table" end end end |
#wh_manual_validations ⇒ Object
50 51 52 53 54 |
# File 'lib/ncs_navigator/warehouse/table_modeler/mdes_ext.rb', line 50 def wh_manual_validations variables.collect do |v| v.wh_manual_validations end.flatten end |
#wh_model_name(module_name = nil) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/ncs_navigator/warehouse/table_modeler/mdes_ext.rb', line 21 def wh_model_name(module_name=nil) name_text, numeric_suffix = name.scan(/^(.*?)([_\d]*)$/).first [ module_name, [name_text.camelize, numeric_suffix].compact.join ].compact.join('::') end |
#wh_variables ⇒ Object
30 31 32 |
# File 'lib/ncs_navigator/warehouse/table_modeler/mdes_ext.rb', line 30 def wh_variables variables.reject { |v| v.name == 'transaction_type' } end |