Skip to main content

A Python library for calculating malaria intervention budgets

Project description

SNT Malaria Budgeting

A Python library for calculating malaria intervention budgets across different countries and time periods.

Installation

Install from PyPI:

pip install snt-malaria-budgeting

Development Installation

For development, clone the repository and install with development dependencies:

pip install -e .[dev]

This installs the package in editable mode along with all development tools (pytest, ruff, mypy, etc.).

Example usage

To fetch budgets for a given country and years:

from snt_malaria_budgeting.core.budget_calculator import get_budget
from snt_malaria_budgeting.models import (
    DEFAULT_COST_ASSUMPTIONS,
    InterventionDetailModel,
)

start_year = 2025
end_year = 2027
interventions = [InterventionDetailModel(name="iptp", type="SP", places=[1])]
settings = DEFAULT_COST_ASSUMPTIONS

budgets = []

for year in range(start_year, end_year + 1):
    print(f"Fetching budget for year: {year}")
    budgets.append(
        get_budget(
            year=year,
            interventions_input=interventions,
            settings=settings,
            cost_df=cost_df, # refer to unit tests for an example
            population_df=population_df, # refer to unit tests for an example
            spatial_planning_unit="key",
            local_currency="EUR",
            cost_overrides=[], # optional
        )
    )

print(budgets)

Development

Running Tests

After installing with development dependencies, run the test suite:

pytest
pytest -v # verbose output
pytest --cov=snt_malaria_budgeting --cov-report=html # with coverage report

# specific test files or methods:
pytest tests/core/test_budget_calculator.py
pytest tests/core/test_budget_calculator.py::TestBudgetCalculator::test_iptp_quantification

Acknowledgements

This library is a Python port of the PATH Budget Generation Function (R implementation).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snt_malaria_budgeting-0.3.0.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

snt_malaria_budgeting-0.3.0-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file snt_malaria_budgeting-0.3.0.tar.gz.

File metadata

  • Download URL: snt_malaria_budgeting-0.3.0.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for snt_malaria_budgeting-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c92adccacf5be232d45c69be4e906e2fc3e284ce254e50fa52fcbfd2b5b2f9bb
MD5 aa2b6ee496fc93f3bd506f27eb13921d
BLAKE2b-256 3e0e73e3896193ef5bd89408f2691b02db2728cbd439d05000e0532069000fb5

See more details on using hashes here.

File details

Details for the file snt_malaria_budgeting-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for snt_malaria_budgeting-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 70d47b368c955177b6e448a30d75545af96d6d3217ae6def18701ef0ec10503a
MD5 54d7de8990dfd994dba0271da790f258
BLAKE2b-256 00ff73987b0d7f221f29f678bc803cc146602eb430904fd2d854380da6f8a7e1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page