tlo.methods.healthsystem module =============================== .. automodule:: tlo.methods.healthsystem .. autoclass:: HealthSystem Bases: :class:`tlo.core.Module` **PARAMETERS:** .. list-table:: :widths: 25 25 50 :header-rows: 1 * - Item - Type - Description * - Master_Facilities_List - DATA_FRAME - Listing of all health facilities. * - Officer_Types_Table - DATA_FRAME - The names of the types of health workers ("officers") * - Appt_Types_Table - DATA_FRAME - The names of the type of appointments with the health system * - Appt_Offered_By_Facility_Level - DATA_FRAME - Table indicating whether or not each appointment is offered at each facility level. * - Appt_Time_Table - DATA_FRAME - The time taken for each appointment, according to officer and facility type. * - Daily_Capabilities_actual - DATA_FRAME - The capabilities (minutes of time available of each type of officer in each facility) based on the _estimated current_ number and distribution of staff estimated. * - Daily_Capabilities_funded - DATA_FRAME - The capabilities (minutes of time available of each type of officer in each facility) based on the _potential_ number and distribution of staff estimated (i.e. those positions that can be funded). * - Daily_Capabilities_funded_plus - DATA_FRAME - The capabilities (minutes of time available of each type of officer in each facility) based on the _potential_ number and distribution of staff estimated, with adjustments to permit each appointment type that should be run at facility level to do so in every district. * - use_funded_or_actual_staffing - STRING - If `actual`, then use the numbers and distribution of staff estimated to be available currently; If `funded`, then use the numbers and distribution of staff that are potentially available. If `funded_plus`, then use a dataset in which the allocation of staff to facilities is tweaked so as to allow each appointment type to run at each facility_level in each district for which it is defined. N.B. This parameter is over-ridden if an argument is provided to the module initialiser. * - item_and_package_code_lookups - DATA_FRAME - Data imported from the OneHealth Tool on consumable items, packages and costs. * - consumables_item_designations - DATA_FRAME - Look-up table for the designations of consumables (whether diagnostic, medicine, or other * - availability_estimates - DATA_FRAME - Estimated availability of consumables in the LMIS dataset. * - cons_availability - STRING - Availability of consumables. If 'default' then use the availability specified in the ResourceFile; if 'none', then let no consumable be ever be available; if 'all', then all consumables are always available. When using 'all' or 'none', requests for consumables are not logged. NB. This parameter is over-riddenif an argument is provided to the module initialiser.Note that other options are also available: see the `Consumables` class. * - BedCapacity - DATA_FRAME - Data on the number of beds available of each type by facility_id * - beds_availability - STRING - Availability of beds. If 'default' then use the availability specified in the ResourceFile; if 'none', then let no beds be ever be available; if 'all', then all beds are always available. NB. This parameter is over-ridden if an argument is provided to the module initialiser. * - EquipmentCatalogue - DATA_FRAME - Data on equipment items and packages. * - equipment_availability_estimates - DATA_FRAME - Data on the availability of equipment items and packages. * - equip_availability - STRING - What to assume about the availability of equipment. If 'default' then use the availability specified in the ResourceFile; if 'none', then let no equipment ever be available; if 'all', then all equipment is always available. NB. This parameter is over-ridden if an argument is provided to the module initialiser. * - equip_availability_postSwitch - STRING - What to assume about the availability of equipment after the switch (see `year_equip_availability_switch`). The options for this are the same as `equip_availability`. * - year_equip_availability_switch - INT - Year in which the assumption for `equip_availability` changes (The change happens on 1st January of that year.) * - Service_Availability - LIST - List of services to be available. NB. This parameter is over-ridden if an argument is provided to the module initialiser. * - policy_name - STRING - Name of priority policy adopted * - year_mode_switch - INT - Year in which mode switch is enforced * - scale_to_effective_capabilities - BOOL - In year in which mode switch takes place, will rescale available capabilities to match thosethat were effectively used (on average) in the past year if this is set to True. This way,we can approximate overtime and rushing of appts even in mode 2. * - year_cons_availability_switch - INT - Year in which consumable availability switch is enforced. The change happenson 1st January of that year.) * - year_use_funded_or_actual_staffing_switch - INT - Year in which switch for `use_funded_or_actual_staffing` is enforced. (The change happenson 1st January of that year.) * - priority_rank - DICT - Data on the priority ranking of each of the Treatment_IDs to be adopted by the queueing system under different policies, where the lower the number the higher the priority, and on which categories of individuals classify for fast-tracking for specific treatments * - HR_scaling_by_level_and_officer_type_table - DICT - Factors by which capabilities of medical officer types at different levels will bescaled at the start of the year specified by `year_HR_scaling_by_level_and_officer_type`. Thisserves to simulate a number of effects (e.g. absenteeism, boosting capabilities of specific medical cadres, etc). This is the imported from an Excel workbook: keys are the worksheet names and values are the worksheets in the format of pd.DataFrames. Additional scenarios can be added by adding worksheets to this workbook: the value of `HR_scaling_by_level_and_officer_type_mode` indicates which sheet is used. * - year_HR_scaling_by_level_and_officer_type - INT - Year in which one-off constant HR scaling will take place. (The change happenson 1st January of that year.) * - HR_scaling_by_level_and_officer_type_mode - STRING - Mode of HR scaling considered at the start of the simulation. This corresponds to the nameof the worksheet in `ResourceFile_HR_scaling_by_level_and_officer_type.xlsx` that should be used. Options are: `default` (capabilities are scaled by a constaint factor of 1); `data` (factors informed by survey data); and, `custom` (user can freely set these factors as parameters in the analysis). * - HR_scaling_by_district_table - DICT - Factors by which daily capabilities in different districts will bescaled at the start of the year specified by year_HR_scaling_by_district to simulate(e.g., through catastrophic event disrupting delivery of services in particular district(s)).This is the import of an Excel workbook: keys are the worksheet names and values are the worksheets in the format of pd.DataFrames. Additional scenarios can be added by adding worksheets to this workbook: the value of `HR_scaling_by_district_mode` indicates whichsheet is used. * - year_HR_scaling_by_district - INT - Year in which scaling of daily capabilities by district will take place. (The change happenson 1st January of that year.) * - HR_scaling_by_district_mode - STRING - Mode of scaling of daily capabilities by district. This corresponds to the name of the worksheet in the file `ResourceFile_HR_scaling_by_district.xlsx`. * - yearly_HR_scaling - DICT - Factors by which HR capabilities are scaled. Each sheet specifies a 'mode' for dynamic HR scaling. The mode to use is determined by the parameter `yearly_HR_scaling_mode`. Each sheet must have the same format, including the same column headers. On each sheet, the first row (for `2010`, when the simulation starts) specifies the initial configuration: `dynamic_HR_scaling_factor` (float) is the factor by which all human resoucres capabilities and multiplied; `scale_HR_by_popsize` (bool) specifies whether the capabilities should (also) grow by the factor by which the population has grown in the last year. Each subsequent row specifies a year where there should be a CHANGE in the configuration. If there are no further rows, then there is no change. But, for example, an additional row of the form ```2015, 1.05, TRUE``` would mean that on 1st January of 2015, 2016, 2017, ....(and the rest of the simulation), the capabilities would increase by the product of 1.05 and by the ratio of the population size to that in the year previous. * - yearly_HR_scaling_mode - STRING - Specifies which of the policies in yearly_HR_scaling should be adopted. This corresponds toa worksheet of the file `ResourceFile_dynamic_HR_scaling.xlsx`. * - tclose_overwrite - INT - Decide whether to overwrite tclose variables assigned by disease modules * - tclose_days_offset_overwrite - INT - Offset in days from topen at which tclose will be set by the healthsystem for all HSIsif tclose_overwrite is set to True. * - mode_appt_constraints - INT - Integer code in `{0, 1, 2}` determining mode of constraints with regards to officer numbers and time - 0: no constraints, all HSI events run with no squeeze factor, 1: elastic constraints, all HSI events run with squeeze factor, 2: hard constraints, only HSI events with no squeeze factor run. N.B. This parameter is over-ridden if an argument is provided to the module initialiser. * - mode_appt_constraints_postSwitch - INT - Mode considered after a mode switch in year_mode_switch. * - cons_availability_postSwitch - STRING - Consumables availability after switch in `year_cons_availability_switch`. Acceptable valuesare the same as those for Parameter `cons_availability`. * - use_funded_or_actual_staffing_postSwitch - STRING - Staffing availability after switch in `year_use_funded_or_actual_staffing_switch`. Acceptable values are the same as those for Parameter `use_funded_or_actual_staffing`. **PROPERTIES:** .. list-table:: :widths: 25 25 50 :header-rows: 1 * - Item - Type - Description * - hs_is_inpatient - BOOL - Whether or not the person is currently an in-patient at any medical facility **Class attributes:** INIT_DEPENDENCIES : {'Demography'} __annotations__ : {} capabilities_today : hsi_event_counts : never_ran_hsi_event_counts : use_funded_or_actual_staffing : **Functions (defined or overridden in class HealthSystem):** .. automethod:: __init__ .. automethod:: read_parameters .. automethod:: pre_initialise_population .. automethod:: initialise_population .. automethod:: initialise_simulation .. automethod:: on_birth .. automethod:: on_simulation_end .. automethod:: setup_priority_policy .. automethod:: process_healthsystem_organisation_files .. automethod:: setup_daily_capabilities .. automethod:: format_daily_capabilities .. automethod:: _rescale_capabilities_to_capture_effective_capability .. automethod:: update_consumables_availability_to_represent_merging_of_levels_1b_and_2 .. automethod:: get_service_availability .. automethod:: get_cons_availability .. automethod:: get_beds_availability .. automethod:: get_equip_availability .. automethod:: schedule_to_call_never_ran_on_date .. automethod:: get_mode_appt_constraints .. automethod:: get_priority_policy_initial .. automethod:: load_priority_policy .. automethod:: schedule_hsi_event .. automethod:: _add_hsi_event_queue_item_to_hsi_event_queue .. automethod:: enforce_priority_policy .. automethod:: check_hsi_event_is_valid .. automethod:: is_treatment_id_allowed .. automethod:: schedule_batch_of_individual_hsi_events .. automethod:: appt_footprint_is_valid .. automethod:: get_blank_appt_footprint .. automethod:: get_facility_info .. automethod:: get_appt_footprint_as_time_request .. automethod:: get_squeeze_factors .. automethod:: record_hsi_event .. automethod:: write_to_hsi_log .. automethod:: call_and_record_never_ran_hsi_event .. automethod:: write_to_never_ran_hsi_log .. automethod:: log_current_capabilities_and_usage .. automethod:: remove_beddays_footprint .. automethod:: find_events_for_person .. automethod:: reset_queue .. automethod:: get_item_codes_from_package_name .. automethod:: get_item_code_from_item_name .. automethod:: override_availability_of_consumables .. automethod:: _write_hsi_event_counts_to_log_and_reset .. automethod:: _write_never_ran_hsi_event_counts_to_log_and_reset .. automethod:: on_end_of_day .. automethod:: on_end_of_month .. automethod:: on_end_of_year .. automethod:: run_individual_level_events_in_mode_0_or_1 .. autoclass:: HealthSystemScheduler Bases: :class:`tlo.events.RegularEvent`, :class:`tlo.events.Event`, :class:`tlo.events.PopulationScopeEventMixin` **Class attributes:** __annotations__ : {} **Functions (defined or overridden in class HealthSystemScheduler):** .. automethod:: __init__ .. automethod:: _is_last_day_of_the_year .. automethod:: _is_last_day_of_the_month .. automethod:: _get_events_due_today .. automethod:: process_events_mode_0_and_1 .. automethod:: process_events_mode_2 .. automethod:: apply .. autoclass:: HealthSystemChangeParameters Bases: :class:`tlo.events.Event`, :class:`tlo.events.PopulationScopeEventMixin` **Class attributes:** __annotations__ : {} **Functions (defined or overridden in class HealthSystemChangeParameters):** .. automethod:: __init__ .. automethod:: apply .. autoclass:: DynamicRescalingHRCapabilities Bases: :class:`tlo.events.RegularEvent`, :class:`tlo.events.Event`, :class:`tlo.events.PopulationScopeEventMixin` **Class attributes:** __annotations__ : {} current_pop_size : **Functions (defined or overridden in class DynamicRescalingHRCapabilities):** .. automethod:: __init__ .. automethod:: _get_most_recent_year_specified_for_a_change_in_configuration .. automethod:: apply .. autoclass:: ConstantRescalingHRCapabilities Bases: :class:`tlo.events.Event`, :class:`tlo.events.PopulationScopeEventMixin` **Class attributes:** __annotations__ : {} **Functions (defined or overridden in class ConstantRescalingHRCapabilities):** .. automethod:: __init__ .. automethod:: apply .. autoclass:: RescaleHRCapabilities_ByDistrict Bases: :class:`tlo.events.Event`, :class:`tlo.events.PopulationScopeEventMixin` **Class attributes:** __annotations__ : {} **Functions (defined or overridden in class RescaleHRCapabilities_ByDistrict):** .. automethod:: __init__ .. automethod:: apply .. autoclass:: HealthSystemChangeMode Bases: :class:`tlo.events.RegularEvent`, :class:`tlo.events.Event`, :class:`tlo.events.PopulationScopeEventMixin` **Class attributes:** __annotations__ : {} **Functions (defined or overridden in class HealthSystemChangeMode):** .. automethod:: __init__ .. automethod:: apply .. autoclass:: HealthSystemLogger Bases: :class:`tlo.events.RegularEvent`, :class:`tlo.events.Event`, :class:`tlo.events.PopulationScopeEventMixin` **Class attributes:** __annotations__ : {} **Functions (defined or overridden in class HealthSystemLogger):** .. automethod:: __init__ .. automethod:: apply .. automethod:: log_number_of_staff