Skip to main content

CTNS, Contact Tracing Network Simulator: a tool to simulate contact tracing in a population where a disease is spreading

Project description

CTNS

Contact Tracing Network Simulator, a tool to simulate digital contact networks beetween people in a population where a disease is spreading. The simulation is highly customizable and will return (or dump) a time series of networks. We suggest to use https://gitlab.com/migliouni/ctns_visualizer to analize the results. If you prefer to interact with this library througt a web app, you can take a look to https://gitlab.com/migliouni/ctns_simulator, which provides a web interface to run simulation and some summary plots.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Installing

The easiest way to install this library is simply run:

pip install ctns

on you terminal.

Usage

To run a simulation, you first need to import this library in your python code:

from ctns.contact_network_simulator import run_simulation

and then simply call the function run_simulation.

If you would like to launch the tool directly from Terminal/CMD, you can just type

ctns

from Linux terminal or

ctns.bat

from Windows CMD/Power Shell.

Remember to specify a path to a file for the network dump.

You can alternatively clone the repo, navigate to the ctns/ctns folder and run

python3 contact_network_simulator.py

Network structure

The networks are igraph networks that will have nodes (representing people) and weighed edges (representing contacts). Each node will have the following relevant attributes:

  • sex -> either man or woman
  • age -> a number representing the age slice of the node (e.g., 40 represent a node with age between [40,50))
  • family_id -> id of the family of the node
  • sociability -> a value that can be either low, medium or high and represent how social (average number of edge) a node is
  • pre_existing_conditions -> number of existing pathologies of the node
  • agent_status -> the status of the node in the simulation. It can be either S(susceptible), E(Exposed), I(Infective), R(Recovered) or D(Dead)
  • infected -> if the node is currently infected or not
  • quarantine -> 0 if the node is not in quarantine, an int representing how many days of quarantine remains otherwise
  • test_result -> -1 if no test has been made on the node, 0 if the test result is negative, 1 if the test result is positive
  • symptoms -> a list of symptoms shown by the node

Please note that you will find other attributes used in the simulation process.

Each edge will have a weight, representing the duration of the contact between two people and a category, that can be either family, frequent, occasional or random.

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

ctns-1.0.1.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

ctns-1.0.1-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

Details for the file ctns-1.0.1.tar.gz.

File metadata

  • Download URL: ctns-1.0.1.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0

File hashes

Hashes for ctns-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0ddb6fe19e2b6fa51cbf411cb62ef9b7832d40d4851414d5493f817827bdb733
MD5 5aa727b8eaf1d74f96219cb795fbf753
BLAKE2b-256 bc85bf0c98c88e9db86e334be226479fc8c4e42c07096222355a133de094e8f9

See more details on using hashes here.

File details

Details for the file ctns-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: ctns-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 28.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0

File hashes

Hashes for ctns-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b708c1ed6012b9aab8af36078fc5e9da130f67a918adab453617c3b81307c978
MD5 a39d530f54f4e06051c0c01bebfaa3e7
BLAKE2b-256 73ee22ac206c9e0901ca0104274568b4c185afac4b6fe7548d989d632b439082

See more details on using hashes here.

Supported by

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