Skip to main content

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.

Metadata

Release files for ctns 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ctns 1.0.1
File Size Uploaded Provenance Actions
ctns-1.0.1.tar.gz 14.4 kB Without provenance Details for ctns-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ctns 1.0.1
File Interpreter ABI Platform Actions
ctns-1.0.1-py3-none-any.whl Python 3 none any Details for ctns-1.0.1-py3-none-any.whl

Total release size: 42.5 kB

Release files / ctns-1.0.1.tar.gz

Download URL ctns-1.0.1.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0ddb6fe19e2b6fa51cbf411cb62ef9b7832d40d4851414d5493f817827bdb733
BLAKE2b-256 checksum
How to use checksums
bc85bf0c98c88e9db86e334be226479fc8c4e42c07096222355a133de094e8f9
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / ctns-1.0.1-py3-none-any.whl

Download URL ctns-1.0.1-py3-none-any.whl
Size 28.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b708c1ed6012b9aab8af36078fc5e9da130f67a918adab453617c3b81307c978
BLAKE2b-256 checksum
How to use checksums
73ee22ac206c9e0901ca0104274568b4c185afac4b6fe7548d989d632b439082
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for ctns 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page