Module: Canql::Nodes::PatientEvents::WithCondition

Defined in:
lib/canql/nodes/patient_events.rb

Instance Method Summary collapse

Instance Method Details

#event_type_nameObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/canql/nodes/patient_events.rb', line 16

def event_type_name
  map = {
    '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'
  }
  map[event_type.text_value.strip]
end

#existence_filterObject



30
31
32
# File 'lib/canql/nodes/patient_events.rb', line 30

def existence_filter
  { Canql::EQUALS => existence_modifier.text_value.strip != 'no' }
end

#maternal_relevant_event_typesObject



12
13
14
# File 'lib/canql/nodes/patient_events.rb', line 12

def maternal_relevant_event_types
  %w[pregnancy_loss_hes pregnancy_loss_bpas msds]
end

#to_eventsObject



7
8
9
10
# File 'lib/canql/nodes/patient_events.rb', line 7

def to_events
  event_name = event_type_name
  { "#{event_name}_event" => existence_filter }
end