Class: MalawiHivProgramReports::Clinic::RegimenSwitch

Inherits:
Object
  • Object
show all
Defined in:
app/services/malawi_hiv_program_reports/clinic/regimen_switch.rb

Instance Method Summary collapse

Constructor Details

#initialize(start_date:, end_date:, **kwargs) ⇒ RegimenSwitch

Returns a new instance of RegimenSwitch.



6
7
8
9
10
# File 'app/services/malawi_hiv_program_reports/clinic/regimen_switch.rb', line 6

def initialize(start_date:, end_date:, **kwargs)
  @start_date = start_date
  @end_date = end_date
  @occupation = kwargs[:occupation]
end

Instance Method Details

#latest_regimen_dispensed(rebuild_outcome) ⇒ Object



22
23
24
25
26
27
28
29
# File 'app/services/malawi_hiv_program_reports/clinic/regimen_switch.rb', line 22

def latest_regimen_dispensed(rebuild_outcome)
  if rebuild_outcome || @occupation.present?
    MalawiHivProgramReports::Moh::CohortBuilder.new(outcomes_definition: 'moh')
                                               .init_temporary_tables(@start_date, @end_date, @occupation)
  end

  latest_regimens
end

#regimen_report(type) ⇒ Object



16
17
18
19
20
# File 'app/services/malawi_hiv_program_reports/clinic/regimen_switch.rb', line 16

def regimen_report(type)
  RegimenDispensationData.new(type:, start_date: @start_date,
                              end_date: @end_date, occupation: @occupation)
                         .find_report
end

#regimen_switch(pepfar) ⇒ Object



12
13
14
# File 'app/services/malawi_hiv_program_reports/clinic/regimen_switch.rb', line 12

def regimen_switch(pepfar)
  swicth_report(pepfar)
end