Module: Canql::Nodes::Events::WithCondition
- Defined in:
- lib/canql/nodes/events.rb
Instance Method Summary collapse
- #event_relevance_flag(relevance) ⇒ Object
- #event_type_name ⇒ Object
- #existence_filter ⇒ Object
- #to_events ⇒ Object
Instance Method Details
#event_relevance_flag(relevance) ⇒ Object
30 31 32 |
# File 'lib/canql/nodes/events.rb', line 30 def event_relevance_flag(relevance) %w[linked relevant related].include?(relevance) end |
#event_type_name ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/canql/nodes/events.rb', line 17 def event_type_name { 'birth' => 'birth', 'death' => 'death', 'hes' => 'hes', 'preg loss hes' => 'pregnancy_loss_hes', 'pregnancy loss hes' => 'pregnancy_loss_hes', 'preg loss bpas' => 'pregnancy_loss_bpas', 'pregnancy loss bpas' => 'pregnancy_loss_bpas', 'msds' => 'msds' } end |
#existence_filter ⇒ Object
34 35 36 |
# File 'lib/canql/nodes/events.rb', line 34 def existence_filter { Canql::EQUALS => existence_modifier.text_value.strip != 'no' } end |
#to_events ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/canql/nodes/events.rb', line 7 def to_events event_type = text_values_for_marker(:event_type).first.strip event_relevance = text_values_for_marker(:event_relevance).first.to_s.strip hash = existence_filter hash['type'] = event_type_name[event_type] hash['relevant'] = event_relevance_flag(event_relevance) || false hash end |