tlo.analysis.hsi_events module

Generate formatted description of health system interaction event details.

is_valid_hsi_event_subclass(obj: Any) bool[source]

Whether an object is a strict subclass of HSI_Event

get_hsi_event_classes_per_module(excluded_modules: Set[str], zero_module_class_map: Mapping[str, Module], multiple_module_class_map: Mapping[str, Module]) Mapping[Module, List[HSI_Event]][source]

Get details of HSI event classes for each (non-excluded) module in tlo.methods

get_details_of_defined_hsi_events(excluded_modules: Set[str] | None = None, zero_module_class_map: Mapping[str, Module] | None = None, multiple_module_class_map: Mapping[str, Module] | None = None, init_population: int = 10, resource_file_path: str | Path | None = None) Set[HSIEventDetails][source]

Get details of all HSI events defined in tlo.methods.

Parameters:
  • excluded_modules – Set of tlo.methods module names to not search for HSI events in. If None, set to the dummy modules ‘mockitis’, ‘chronicsyndrome’ and ‘skeleton’.

  • zero_module_class_map – Map from tlo.methods module name to Module `` subclass to use for HSI events in module for modules with no ``Module subclasses defined in module. If None, a map specifying only that all HSI events in the hsi_generic_first_appts module are assumed to originate from the HealthSeekingBehaviour module.

  • multiple_module_class_map – Map from tlo.methods module name to Module subclass to use for HSI events in module for modules with multiple Module subclasses defined. If None, set to a map specifying the ‘main’ fully- functional Module subclass in each module in tlo.methods with additional dummy Module subclasses defined.

  • init_population – Initial population to use in simulation instance used to get HSI event details. Smaller values will decrease computation time but some modules may raise errors if the initial population is too small.

  • resource_file_path – Path to the directory containing resource files. If None, the resources directory in the root directory of the Git repository will be used.

sort_hsi_event_details(set_of_hsi_event_details: Iterable[HSIEventDetails]) List[HSIEventDetails][source]

Hierarchically sort set of HSI event details.

format_hsi_event_details_as_csv(hsi_event_details: Iterable[HSIEventDetails]) str[source]

Format HSI event details list as comma-separated value string.

format_hsi_event_details_as_table(hsi_event_details: Iterable[HSIEventDetails], text_format: str = 'rst') str[source]

Format HSI event details into a table.

format_hsi_event_details_as_list(hsi_event_details: Iterable[HSIEventDetails], text_format: str = 'rst') str[source]

Format HSI event details into per module lists.

merge_hsi_event_details(inspect_hsi_event_details: Iterable[HSIEventDetails], run_hsi_event_details: Iterable[HSIEventDetails]) Set[HSIEventDetails][source]

Merge HSI event details collected using inspect and from simulation run.

get_all_defined_hsi_events_as_dataframe() DataFrame[source]

Return a dataframe of all the HSI events defined in the model.

main()[source]

Entry point to do the inspection of HSI events when running as script.