Skip to content

Updates to HealthSystem Module to Improve Usability

Tim Hallett edited this page Sep 16, 2020 · 6 revisions

The following updates have been made for the interactions with the health system.

1) Requesting consumables

The old method required users to specify their request in a 'footprint' and then interpret the results for each item and package code seperately. A common use case is to want to know if all of the consumables requested are available. So now the HSI_Event base class has a function to streamline such a test. The additional assumption made is that one of each item or package is required. If this is not the case, you must keep using the full footprint method.

See example below from ChronicSyndrome:

Old Way:

        consumables_needed = {
            'Intervention_Package_Code': {pkg_code1: 1, pkg_code2: 1},
            'Item_Code': {item_code1: 1, item_code2: 1},
        }

        outcome_of_request_for_consumables = self.sim.modules['HealthSystem'].request_consumables(
            hsi_event=self, cons_req_as_footprint=consumables_needed
        )

        # check if all available:
        all_available = (outcome_of_request_for_consumables['Intervention_Package_Code'][pkg_code1]) and \
                        (outcome_of_request_for_consumables['Intervention_Package_Code'][pkg_code2]) and \
                        (outcome_of_request_for_consumables['Item_Code'][item_code1]) and \
                        (outcome_of_request_for_consumables['Item_Code'][item_code2])

New Way:

        all_available = self.get_all_consumables(
            item_codes=[item_code1, item_code2],
            pkg_codes=[pkg_code1, pkg_code2]
        )

2) Declaring an APPT_FOOTPRINT

In order to express the APPT_FOOTPRINT (either in the definition of the HSI as self.EXPECTED_APPT_FOOTPRINT or at the end of the HSI as return actual_appt_footprint, the footprint used to require that a number is given for each possible type of appointment. This required the following typical code:

Old Way:

        appt_footprint = self.sim.modules['HealthSystem'].get_blank_appt_footprint()
        appt_footprint['ConWithDCSA'] = 0.5
        self.EXPECTED_APPT_FOOTPRINT = appt_footprint

This can now be streamlined, where any type of appointment not included in the dictionary is taken to be 0.

        self.EXPECTED_APPT_FOOTPRINT = self.make_appt_footprint({'ConWithDCSA': 0.5})

3) Metadata

Declare the METADATA at the top of the disease module (just after PROPERTIES and PARAMETERS) to signal what functionality this module should have access to. It can be any combination of:

    # Declare Metadata
     METADATA = {
         Metadata.DISEASE_MODULE,       # Disease modules: Any disease module should carry this label.
         Metadata.USES_SYMPTOMMANAGER,  # The 'Symptom Manager' recognises modules with this label.
         Metadata.USES_HEALTHSYSTEM,    # The 'HealthSystem' recognises modules with this label.
         Metadata.USES_HEALTHBURDEN     # The 'HealthBurden' module recognises modules with this label.
     }
Clone this wiki locally