This repository contains two components:
- Hypergraph Animations
- Hypergraphs for Multimorbidity
The first components contains the code to create hypergraph animations using manim
, explaining how
hypergraphs are constructed.
The second component is a streamlit applet which provides an interactive walkthrough of calculating node centrality and PageRank scores of hypergraphs. This code supports the Transforming Healthcare Data with Graph-based Techniques Using SAIL DataBank project and a link to the original project proposal can be found here.
Note: Only public or fake data are shared in this repository.
.pre-commit-config.yaml
for more details. These hooks will also need installing locally via:
pre-commit autoupdate
pre-commit install
and then will be checked on commit.
A library of animations explaining hypergraphs using manim
.
A detailed tutorial for installing manim
can be found here:
-
Clone the repository locally
-
Install Manim in a virtual environment (use the instructions found above)
-
Run virtual environment
$ source venv/bin/activate venv
-
Run the following command to create the Hypergraph Example
$ manim -qm src/hypergraphs/hypergraphs.py HypergraphExample
-
The mp4 will autoplay. If not please find the video in the following directory:
$ media/videos/hypergraphs/720p30/
Please find a colab workbook here:
This prototype tool has been built using Streamlit, a Python app framework that can be used to create web apps. This Streamlit app allows users to explore hypergraphs in the context of multimoribidity.
This is not an official NHS England product or service but instead is an interactive applet prototype containing ongoing work. This prototype aims only to demonstrate work that may be of interest to others. Opinions expressed in this applet are not representative of the views of NHS England and any content here should not be regarded as official output in any form. For more information about NHS England please visit our official website.
The Streamlit applet explains what multimorbidity is, what hypergraphs are and why hypergraphs are useful for modelling multimoribidity. This applet randomly generates a set of fictious 'patients' and their disease pathways to demonstrate the use of hypergraphs in understanding multimorbidity. The sidebar on the left of this page can be used to change the number of 'patients' to generate and the maximum number of diseases to include in their pathways. In changing the number of patients and diseases, the hypergraph outputs will change and this is purposeful to enable you to observe how population alterations result in different outcomes.
Users can follow through the examples to find out how the hypergraph-mm works by generating hyperedge and hyperarc weights for the population, followed by calculating centrality to show the importance of different diseases within the population.
To deploy the streamlit app locally we advise following the instructions below:
To clone the repository:
git clone https:github.com/nhsx/hypergraphical
To create a suitable environment, in the terminal run the following command:
-
Build conda environment via
conda create --name hg-streamlit python=3.8
-
Activate environment
conda activate hg-streamlit
-
Install requirements via
python -m pip install -r ./requirements.txt
To run the tool locally, open a terminal whilst in the directory containing the app and run
streamlit run streamlit_hypergraphs.py
Streamlit will then render the tool and display it in your default web browser at
http://localhost:8501/
Run tests by using pytest test_streamlit/test_edge_count.py
.
See the repo Issues for a list of proposed features (and known problems).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
See CONTRIBUTING.md for detailed guidance.
Unless stated otherwise, the codebase is released under the MIT Licence. This covers both the codebase and any sample code in the documentation.
See LICENSE for more information.
The project specific documentation is © Crown copyright and available under the terms of the Open Government 3.0 licence.
To find out more about DART visit our project website or get in touch here.