Class: MalawiHivProgramReports::Pepfar::TxNew
- Inherits:
-
Object
- Object
- MalawiHivProgramReports::Pepfar::TxNew
- Includes:
- Adapters::Moh::Custom, Utils, Utils::ModelUtils
- Defined in:
- app/services/malawi_hiv_program_reports/pepfar/tx_new.rb
Overview
This class is responsible for generating the tx_new 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
readonly
Returns the value of attribute end_date.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#rebuild ⇒ Object
readonly
Returns the value of attribute rebuild.
-
#start_date ⇒ Object
readonly
Returns the value of attribute start_date.
Instance Method Summary collapse
- #find_report ⇒ Object
-
#initialize(start_date:, end_date:, **kwargs) ⇒ TxNew
constructor
A new instance of TxNew.
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
Methods included from Utils::ModelUtils
#concept, #concept_id_to_name, #concept_name, #concept_name_to_id, #drug, #encounter_type, #global_property, #order_type, #patient_identifier_type, #program, #report_type, #user_property
Constructor Details
#initialize(start_date:, end_date:, **kwargs) ⇒ TxNew
Returns a new instance of TxNew.
14 15 16 17 18 19 |
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_new.rb', line 14 def initialize(start_date:, end_date:, **kwargs) @start_date = start_date.to_date.beginning_of_day.strftime('%Y-%m-%d %H:%M:%S') @end_date = end_date.to_date.end_of_day.strftime('%Y-%m-%d %H:%M:%S') @rebuild = kwargs[:rebuild]&.casecmp?('true') @location = kwargs[:location] end |
Instance Attribute Details
#end_date ⇒ Object (readonly)
Returns the value of attribute end_date.
12 13 14 |
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_new.rb', line 12 def end_date @end_date end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
12 13 14 |
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_new.rb', line 12 def location @location end |
#rebuild ⇒ Object (readonly)
Returns the value of attribute rebuild.
12 13 14 |
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_new.rb', line 12 def rebuild @rebuild end |
#start_date ⇒ Object (readonly)
Returns the value of attribute start_date.
12 13 14 |
# File 'app/services/malawi_hiv_program_reports/pepfar/tx_new.rb', line 12 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_new.rb', line 21 def find_report report = init_report addittional_groups report process_rebuild if rebuild process_data report flatten_the_report report rescue StandardError => e Rails.logger.error e. Rails.logger.error e.backtrace.join("\n") raise e end |