interventions.products
interventions.products
Base product classes for DataFrame-driven multi-outcome products.
Classes
| Name | Description |
|---|---|
| ProductMulti | Base product with DataFrame-driven, multi-outcome probability logic. |
ProductMulti
interventions.products.ProductMulti(df, hierarchy=None, **kwargs)Base product with DataFrame-driven, multi-outcome probability logic.
Supports per-agent outcome probabilities based on TB state and optional filter columns (age_min, age_max, hiv). Used as the base class for diagnostics (Dx) and multi-outcome treatments (TxMulti).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| df | DataFrame with required columns (state, result, probability) and optional filter columns (age_min, age_max, hiv). Only include filter columns relevant to the specific product. | required | |
| hierarchy | List of result strings in priority order, e.g. [‘positive’, ‘negative’]. Agents in states not listed in df get the last entry (default). | None |
Attributes
| Name | Description |
|---|---|
| default_value | Index of the default (most benign) result, i.e. the last entry in the hierarchy. |
Methods
| Name | Description |
|---|---|
| administer | Administer product to agents. |
administer
interventions.products.ProductMulti.administer(sim, uids)Administer product to agents.
Returns
| Name | Type | Description |
|---|---|---|
| dict keyed by hierarchy strings, e.g. {‘positive’: uids, ‘negative’: uids} |