Skip to content

Updates to HealthSystem Module to Improve Usability

Tim Hallett edited this page Sep 2, 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 a footprint (appt_footprint)

Clone this wiki locally