Class: MalawiHivProgramReports::Pepfar::TxCurrMmd

Inherits:
Object
  • Object
show all
Includes:
Adapters::Moh::Custom, Utils, Utils::CommonSqlQueryUtils
Defined in:
app/services/malawi_hiv_program_reports/pepfar/tx_curr_mmd.rb

Constant Summary

Constants included from Utils

Utils::COHORT_REGIMENS, Utils::FULL_3HP_COURSE_DAYS, Utils::FULL_6H_COURSE_PILLS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Adapters::Moh::Custom

#cast_manager, #current_partition, #exe_create_drill_down_table, #exe_temp_cohort_members_table, #exe_temp_order_details_table, #exe_temp_other_patient_types, #exe_temp_register_start_date_table, #exe_tmp_patient_table, #function_manager, #group_by_columns, #in_manager, #interval_manager, #min_filt, #site_manager, #timestampdiff_manager

Methods included from Utils::CommonSqlQueryUtils

#current_occupation_query, #external_client_query, #occupation_filter, #partition_by_site, #process_occupation

Methods included from Utils

#drug_refills_and_external_consultation_list, #isoniazid_rifapentine_concept, #patient_completed_tpt?, #patient_on_3hp?, #patient_on_tb_treatment?, #pepfar_age_groups, #pepfar_patient_drilldown_information, #pepfar_patient_identifier_type, #rifapentine_concept

Constructor Details

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

Returns a new instance of TxCurrMmd.



15
16
17
18
19
20
21
22
23
24
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_curr_mmd.rb', line 15

def initialize(start_date:, end_date:, **kwargs)
  @start_date = start_date.to_date.strftime('%Y-%m-%d 00:00:00')
  @end_date = end_date.to_date.strftime('%Y-%m-%d 23:59:59')
  @org = kwargs[:definition]
  @location = kwargs[:location]
  raise 'Location is required' if @location.blank?

  @report = init_report
  addittional_groups
end

Instance Attribute Details

#end_dateObject

Returns the value of attribute end_date.



13
14
15
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_curr_mmd.rb', line 13

def end_date
  @end_date
end

#locationObject

Returns the value of attribute location.



13
14
15
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_curr_mmd.rb', line 13

def location
  @location
end

#orgObject

Returns the value of attribute org.



13
14
15
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_curr_mmd.rb', line 13

def org
  @org
end

#reportObject

Returns the value of attribute report.



13
14
15
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_curr_mmd.rb', line 13

def report
  @report
end

#start_dateObject

Returns the value of attribute start_date.



13
14
15
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_curr_mmd.rb', line 13

def start_date
  @start_date
end

Instance Method Details

#find_reportObject



26
27
28
29
30
31
32
33
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_curr_mmd.rb', line 26

def find_report
  process_data
  flatten_the_report
rescue StandardError => e
  Rails.logger.error e.message
  Rails.logger.error e.backtrace.join("\n")
  raise e
end