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 of the footprint. A common use case is to do something only if all of the consumables requested are returned. Now, the HSI_Event base class has a function to streamline it. 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