Class: MalawiHivProgramReports::Pepfar::TxTb
- Inherits:
-
Object
- Object
- MalawiHivProgramReports::Pepfar::TxTb
- Includes:
- Adapters::Moh::Custom, Utils
- Defined in:
- app/services/malawi_hiv_program_reports/pepfar/tx_tb.rb
Overview
TxTb report rubocop:disable Metrics/ClassLength
Constant Summary
Constants included from Utils
Utils::COHORT_REGIMENS, Utils::FULL_3HP_COURSE_DAYS, Utils::FULL_6H_COURSE_PILLS
Instance Attribute Summary collapse
-
#end_date ⇒ Object
Returns the value of attribute end_date.
-
#rebuild_outcome ⇒ Object
Returns the value of attribute rebuild_outcome.
-
#report ⇒ Object
Returns the value of attribute report.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
Instance Method Summary collapse
- #find_report ⇒ Object
-
#initialize(start_date:, end_date:, **kwargs) ⇒ TxTb
constructor
A new instance of TxTb.
- #process_tb_data ⇒ Object
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
#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) ⇒ TxTb
Returns a new instance of TxTb.
13 14 15 16 17 18 19 |
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_tb.rb', line 13 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') @rebuild_outcome = ActiveModel::Type::Boolean.new.cast(kwargs[:rebuild_outcome]) || false @occupation = kwargs[:occupation] @location = kwargs[:location] end |
Instance Attribute Details
#end_date ⇒ Object
Returns the value of attribute end_date.
8 9 10 |
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_tb.rb', line 8 def end_date @end_date end |
#rebuild_outcome ⇒ Object
Returns the value of attribute rebuild_outcome.
8 9 10 |
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_tb.rb', line 8 def rebuild_outcome @rebuild_outcome end |
#report ⇒ Object
Returns the value of attribute report.
8 9 10 |
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_tb.rb', line 8 def report @report end |
#start_date ⇒ Object
Returns the value of attribute start_date.
8 9 10 |
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_tb.rb', line 8 def start_date @start_date end |
Instance Method Details
#find_report ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_tb.rb', line 21 def find_report init_report build_cohort_tables process_patients_alive_and_on_art process_tb_screened process_tb_confirmed flatten_the_report rescue StandardError => e Rails.logger.error("Error generating TxTb report: #{e.}") Rails.logger.error(e.backtrace.join("\n")) raise e end |
#process_tb_data ⇒ Object
34 35 36 37 38 |
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_tb.rb', line 34 def process_tb_data delete_patients_in_temp_table process_tb_screening process_tb_confirmed_and_on_treatment end |