Class: MalawiHivProgramReports::Cohort::Disaggregated
- Inherits:
-
Object
- Object
- MalawiHivProgramReports::Cohort::Disaggregated
- Includes:
- Adapters::Moh::Custom, Pepfar::Utils, Utils::ModelUtils
- Defined in:
- app/services/malawi_hiv_program_reports/cohort/disaggregated.rb
Overview
Disaggregated cohort report rubocop:disable Metrics/ClassLength
Constant Summary
Constants included from Pepfar::Utils
Pepfar::Utils::COHORT_REGIMENS, Pepfar::Utils::FULL_3HP_COURSE_DAYS, Pepfar::Utils::FULL_6H_COURSE_PILLS
Instance Attribute Summary collapse
-
#aggregation ⇒ Object
Returns the value of attribute aggregation.
-
#end_date ⇒ Object
Returns the value of attribute end_date.
-
#location ⇒ Object
Returns the value of attribute location.
-
#maternal ⇒ Object
Returns the value of attribute maternal.
-
#occupation ⇒ Object
Returns the value of attribute occupation.
-
#rebuild ⇒ Object
Returns the value of attribute rebuild.
-
#report ⇒ Object
Returns the value of attribute report.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #find_report ⇒ Object
-
#initialize(start_date:, end_date:, **kwargs) ⇒ Disaggregated
constructor
A new instance of Disaggregated.
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 Pepfar::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) ⇒ Disaggregated
Returns a new instance of Disaggregated.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/services/malawi_hiv_program_reports/cohort/disaggregated.rb', line 14 def initialize(start_date:, end_date:, **kwargs) @type = kwargs[:definition] || 'pepfar' @start_date = start_date @end_date = end_date @rebuild = kwargs[:rebuild]&.casecmp?('true') @aggregation = kwargs[:aggregation]&.casecmp?('false') @occupation = kwargs[:occupation] @location = kwargs[:location] @maternal = {} # raise an error if location is empty raise 'Location cannot be empty' if @location.blank? end |
Instance Attribute Details
#aggregation ⇒ Object
Returns the value of attribute aggregation.
8 9 10 |
# File 'app/services/malawi_hiv_program_reports/cohort/disaggregated.rb', line 8 def aggregation @aggregation end |
#end_date ⇒ Object
Returns the value of attribute end_date.
8 9 10 |
# File 'app/services/malawi_hiv_program_reports/cohort/disaggregated.rb', line 8 def end_date @end_date end |
#location ⇒ Object
Returns the value of attribute location.
8 9 10 |
# File 'app/services/malawi_hiv_program_reports/cohort/disaggregated.rb', line 8 def location @location end |
#maternal ⇒ Object
Returns the value of attribute maternal.
8 9 10 |
# File 'app/services/malawi_hiv_program_reports/cohort/disaggregated.rb', line 8 def maternal @maternal end |
#occupation ⇒ Object
Returns the value of attribute occupation.
8 9 10 |
# File 'app/services/malawi_hiv_program_reports/cohort/disaggregated.rb', line 8 def occupation @occupation end |
#rebuild ⇒ Object
Returns the value of attribute rebuild.
8 9 10 |
# File 'app/services/malawi_hiv_program_reports/cohort/disaggregated.rb', line 8 def rebuild @rebuild end |
#report ⇒ Object
Returns the value of attribute report.
8 9 10 |
# File 'app/services/malawi_hiv_program_reports/cohort/disaggregated.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/cohort/disaggregated.rb', line 8 def start_date @start_date end |
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'app/services/malawi_hiv_program_reports/cohort/disaggregated.rb', line 8 def type @type end |
Instance Method Details
#find_report ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'app/services/malawi_hiv_program_reports/cohort/disaggregated.rb', line 28 def find_report rebuild_report if rebuild process_initialization process_data flatten_the_report rescue StandardError => e Rails.logger.info("Error processing location #{location}: #{e.}") Rails.logger.info(e.backtrace.join("\n")) raise e end |