AMR Hub ABM
An agent-based model (ABM) for simulating the spread of Antimicrobial Resistant (AMR) infections in hospital settings.
This project is developed in collaboration with the Centre for Advanced Research Computing, University College London.
Overview
amr-hub-abm is a Python package that provides a framework for modeling and analyzing the transmission dynamics of antimicrobial-resistant pathogens within healthcare facilities. The simulation incorporates spatial modeling, agent behavior, and task management to provide realistic representations of hospital environments and infection spread patterns.
Key Features
- Spatial modeling: Representation of hospital buildings, floors, and room layouts
- Agent-based simulation: Model individual agents (patients, healthcare workers) with distinct behaviors
- Task management: Simulate realistic workflow patterns with priority-based task assignment
- Flexible architecture: Extensible design for incorporating custom behaviors and scenarios
Installation
Prerequisites
amr-hub-abm requires Python 3.13 or higher.
We recommend using a virtual environment manager such as Conda or venv to create an isolated environment for the package.
Install from GitHub
To install the latest development version directly from GitHub:
pip install git+https://github.com/UCL-ARC/amr-hub.git
Install from Source (Development)
For development or to make local modifications:
- Clone the repository:
git clone https://github.com/UCL-ARC/amr-hub.git
cd amr-hub/python-code
- Install in editable mode:
pip install -e .
Optional Dependencies
Install additional dependencies for development and documentations:
# For development tools (testing, linting, etc.)
pip install -e ".[dev]"
# For building documentation
pip install -e ".[docs]"
# For running tests
pip install -e ".[test]"
Usage
Basic example of using the package:
from amr_hub_abm import __version__
from amr_hub_abm.space import Location, Building
from amr_hub_abm.agent import Agent
from amr_hub_abm.task import Task, TaskType, TaskPriority
# Create a location
location = Location(x=10.0, y=20.0, floor=1)
# Additional usage examples coming soon...
For more detailed examples and API documentation, please refer to the documentation.
Development
Running Tests
Tests can be run across all compatible Python versions in isolated environments using tox:
tox
To run tests manually with pytest:
pytest tests
To run tests with coverage reporting:
pytest --cov --cov-report=xml
Building Documentation
Build the MkDocs HTML documentation locally:
tox -e docs
The built documentation will be written to the site/ directory.
Alternatively, to build and preview the documentation with live reloading:
mkdocs serve
Then open your browser to http://localhost:8000.
Code Quality
This project uses several tools to maintain code quality:
- pre-commit: Git hooks for automatic code formatting and linting
- ruff: Fast Python linter and formatter
- mypy: Static type checker
To set up pre-commit hooks:
pre-commit install
To manually run all pre-commit hooks:
pre-commit run --all-files
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to:
- Update tests as appropriate
- Follow the existing code style
- Run the test suite before submitting
Contributors
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Acknowledgments
This project is supported by the Centre for Advanced Research Computing at University College London.
Contact
For questions or support, please contact:
- Project Lead: Arindam Saha (arindam.saha@ucl.ac.uk)
- ARC Collaborations: arc.collaborations@ucl.ac.uk