leap.cost module

class leap.cost.AsthmaCost(config: dict | None = None, exac: numpy.ndarray | list[float] | None = None, control_probs: numpy.ndarray | list[float] | None = None, exchange_rate_usd_cad: float | None = None)[source]

Bases: object

A class containing information about the dollar cost of asthma.

property exchange_rate_usd_cad : float

The exchange rate from USD to CAD.

property exac : numpy.ndarray

A vector of 4 factors to multiply by the 4 exacerbation severity levels.

property control_probs : numpy.ndarray

A vector of 3 factors to multiply by the 3 control level probabilities.

compute_cost(agent: Agent) float[source]

Compute the cost in dollars for the current year due to asthma exacerbations and control.

Parameters:
agent: Agent

A person in the model.

Returns:

The cost in Canadian dollars for the current year due to asthma exacerbations and control.

Examples

>>> from leap.agent import Agent
>>> from leap.control import ControlLevels
>>> from leap.severity import ExacerbationSeverityHistory
>>> from leap.cost import AsthmaCost
>>> agent = Agent(
...     sex="F",
...     age=30,
...     year=2027,
...     year_index=0,
...     control_levels=ControlLevels(0.1, 0.2, 0.7),
...     exacerbation_severity_history=ExacerbationSeverityHistory(
...         current_year=[0, 1, 5, 6], prev_year=[0, 0, 0, 0]
...     ),
...     has_family_history=True,
...     has_asthma=True,
...     num_antibiotic_use=0
... )
>>> asthma_cost = AsthmaCost(
...     control_probs=[2372, 2965, 3127],
...     exac=[130, 594, 2425, 9900],
...     exchange_rate_usd_cad=1.25
... )
>>> cost = asthma_cost.compute_cost(agent)
>>> print(f"Total cost in 2027 for female aged 30: ${cost:.2f} CAD")
Total cost in 2027 for female aged 30: $93922.62 CAD