1 Introduction

Starting from the end of 2019, the Severe Acute Respiratory Syndrome Coronavirus 2 (SARS-CoV-2) has produced an outbreak of pulmonary disease, soon become a global pandemic. Such a global event - that profoundly affected the behaviors of individuals all over the world - abruptly focused the interest of media and researchers on a pillar field of complex systems research: computational epidemiology. During 2020, researchers from several fields (as well as the broad population) approached the rudiments of epidemic modeling, searching for a better understanding of the continuously evolving situation and trying at the same time to come out with their prediction for the future (Estrada 2020; COVID et al. 2020; Naik et al. 2020; Sarkar et al. 2020; Bastos and Cajueiro 2020; Karnakov et al. 2020; Prem et al. 2020; Perra 2021). Although such a renewed interest in epidemic modeling acts as a valuable linchpin for novel valuable research, a usual barrier often prevents newcomers from testing their ideas: the lack of easy to use tools to implement their models.

The widest adopted approach to describe a complex system to understand spreading phenomena is the adoption of compartment models (Pastor-Satorras et al. 2015b; Newman 2002; Hethcote 2000; Heesterbeek 2000; Anderson et al. 1992). The basic idea of these models is to divide the population into disjoint groups (compartments), according to a few key characteristics which are relevant to the process under consideration, then the evolution of an epidemic is modeled by keeping track of the number of individuals within each compartment. This approach relies on the assumption that populations are fully mixed, meaning that people interact with each other at random and each member in a compartment is treated indistinguishably from the others in that same compartment. These interactions, and in general transition processes between the compartments, are captured in the model as in the limit of large population size: thus, we can fully specify them with nonlinear differential equations accounting for the changes in the number of individuals in the various compartments.

A basic compartmental model that is applicable to many common infections is the SIR model (Pastor-Satorras et al. 2015a; Newman 2002), where we divide the population into those who are susceptible (S), those who are infected (I) and those who have recovered and are immune (R). Under the assumption of a fully mixed population β - the average rate of infective individuals that have contacts with other individuals per unit time - and γ - the recovery rate - regulate the transitions among Susceptible and Infected, and Infected and Recovered compartments. In the special case when γ = 0, SIR reduces to the SI model that assumes that individuals never recover from the infection. Numerous variants of the SIR model have been devised in the literature, for example by specifying further compartments such as those who have been vaccinated, those who are receiving treatment, age groups, risk groups, etc. Moreover, other more sophisticated models arise as we consider a different term for the transmission process, or assume different distribution for the time individuals spend in the infected compartment, leading to a non-constant recovery rate. For instance, spatial effects can be incorporated by adding diffusion terms to the equations, or by considering patch models and the underlying network of individuals’ mobility.

Indeed, during the last decades, several programming libraries - prevalently for the R and Python languages - and visual tools have been released to facilitate epidemic modeling. However, with few notable exceptions, most of them only provide a small set of classic models, not easily allowing the definition of novel ones. One of the main library designed to handle, manipulate and analyze graph structures in R is IgraphFootnote 1(Csardi and Nepusz 2006). It can handle large graphs very well and provides functions for generating random and regular graphs, graph visualization, centrality analysis, path length and much more. When it comes to simulating epidemic models in R one of the most famous package is undoubtedly EpiModelFootnote 2(Jenness et al. 2016). EpiModel provides facilities for build, solve, and plot mathematical models of infectious disease. It currently provides functionality for three classes of epidemic models – Deterministic Compartmental Models, Stochastic Individual Contact Models and Stochastic Network Models – and three types of infectious disease can be simulated upon them: SI, SIR, SIS. EpiModel allows generating visual summaries for the execution of epidemic models; it provides plotting facilities to show the means and standard deviations across multiple simulations while varying the initial infection status. The most famous, pure Python package, that provides graph data structures along with algorithms, synthetic generators and drawing tools is for sure NetworkXFootnote 3(Hagberg et al. 2008). Upon such general graph modeling framework is built the NepidemixFootnote 4 library: a suite tailored to programmatically describe simulation of complex processes on networks (Ahrenberg et al. 2016). Another Python library dedicated to the simulation of diffusive models is EoNFootnote 5. EoN is designed to study the spread of SIS and SIR diseases in networks (Kiss et al. 2017). It is composed of two sets of algorithms: the first set that deals with simulation of epidemics on networks (SIR and SIS) and the second designed to provide solutions of systems of equations. Finally, a recent and easily extensible library has been proposed in (Rossetti et al. 2018). NDlibFootnote 6 offers support to a vast ensamble of diffusion models both coming from the Epidemic literature and the Opinion Dynamics one.

Unfortunately, none of the such resources offers integrated facilities to embed public intervention policies within epidemic modeling (in an easy way). For this reason, in this paper we introduce a novel, simple, framework, UTLDRFootnote 7 - whose name is an acronym identifying the main “compartments” it allows to build upon while defining ad-hoc epidemic models.

Built on top of NDlib (Rossetti et al. 2018), UTLDR provides a modular backbone that allows defining compartmental epidemic models that incorporates several intervention strategies (quarantine, lockdown, testing and tracking, vaccination…) as well as refined information on population stratification and human mobility. Our framework differentiates the meta-compartments in which individuals can transit among five groups: Undetected, namely the non identified exposed/infected individuals; Tested, the infected individuals identified and followed by the healthcare system; Lockdown, the individuals that are subject to social distancing and mobility restrictions; Dead and Recovered, those individuals that completed (either with/without partial immunity in case of Recovered ones) their path. Moreover, UTLDR also provides several extensions to cover additional intervention strategies and sanitary risks (e.g., vaccination campaigns, inefficient corpse disposal…). Although not explicitly designed for SARS-CoV-2 modeling, UTLDR can be easily used to simulate diffusive scenarios and represent a starting point for advanced epidemic modeling. Conversely, from recent studies, our aim is not to describe a specific model but to allow UTLDR users to define their own. UTLDR is designed to both facilitate newcomers in testing their ideas and the general public - without a strong scientific background - to play with a simulator and, hopefully, gain consciousness of both challenges of epidemic modeling and reasons (as well as potential effects) behind standard non-medical interventions.

The paper is organized as follows. In Section 2 is described, in an incremental fashion, the UTLDR framework by proposing a few examples on how its components can be combined to include different public interventions strategies. In Section 4 a few models built with the UTLDR framework are tested against (i) synthetic social interaction networks and (ii) interacting agents stratified to match the population of an Italian region, Tuscany. The provided simulations are not specifically fitted for a specific epidemic, rather devised to illustrate the behaviour of a handful of models generated with the proposed framework on top of a realistic population. Finally, Section 5 concludes the paper.

2 UTLDR: Undetected, tested, lockdown, dead and recovered

The framework that we propose is built as a conservative extension of the SEIR model (Aron and Schwartz 1984) and designed to organize the population in five meta-statuses: (U)ndetected, (T)ested, (L)ockdown, (D)ead, (R)ecovered.

In this section, we will provide, at a high level of abstraction, a description of how alternative/complementary interventions can be (incrementally) added to such a base model to describe the modules of our framework. Our discussion will focus on the model parameters exposed by each proposed SEIR extension as well as the rationale behind the novel compartments and the transition rules we define (explained through transition diagrams). For a detailed mean-field description of UTLDR, refer to Appendix A.

Base model: SEIR

The SEIR model was introduced in 1984 to investigate the role of seasonality in cycles of recurrent epidemics. We can suppose that a population can assume four states: Susceptible (S), those individuals able to contract the disease; Exposed (E), those who have been infected but are not yet infectious; Infected (I), those capable of transmitting the disease; Recovered (R), those who have become immune or deceased.

Indeed, many diseases have a latent phase during which the individual is infected but not yet infectious. This delay between the acquisition of infection and the infectious state can be incorporated within the SIR model by adding a latent/exposed population, E, and letting infected (but not yet infectious) individuals move from S to E and, only then, from E to I. SEIR assumes that if during a generic iteration, a susceptible individual comes into contact with an infected one, it becomes infected after an exposition period (1/σ) with probability β, then it can switch to removed with probability γ (the only transition allowed are S→E→I→R). Figure 1(a) shows the transition diagrams of a classic SEIR model.

Fig. 1
figure 1

(a) In the SEIR model an individual can be in one of four states: (S)usceptible, (E)xposed, (I)nfected or (R)ecovered. Arrows indicate transitions among compartments. (b) The UTR model extends SEIR by introducing the Tested meta-compartment (blocks in green). Testing can be applied to both Exposed and Infected populations and results in transitions to Quarantine compartments (ET and IT)

Testing, tracing and quarantine

In the absence of specific therapeutic drugs or vaccines for the novel disease, it is essential to detect the diseases early and immediately isolate the infected individual from the healthy population (quarantine). Quarantine management is a crucial measure that has to be taken once the human-human transmission is confirmed.

So, we generalize the SEIR model by introducing the testing performed on exposed and infected people and the quarantine compartments. We add two statuses (as shown in the transition diagram reported in Fig. 1(b):

  • Identified Exposed (ET): the exposed population that has been identified by testing strategies;

  • Identified Infected (IT): the infected population that has been identified by testing strategies.

We consider the population that reach either of the two statuses (marked in green in Fig. 1(b)) as quarantined. The transitions \(E\rightarrow E_{T}\) and \(I\rightarrow I_{T}\) are regulated by the following parameters:

  • Testing probability: 𝜗E,𝜗I

  • Testing success rate: κE,κI

Therefore, exposed and infected individuals are tested with probability 𝜗E,𝜗I, respectively, and each test produces a false positive result with probabilities κE,κI, respectively. Testing positive moves an individual into the appropriate detected case compartment. Moreover, UTLDR also allows, in case of positive testing result, to enable contact tracing procedures (while specifying a temporal window, Ttracing, to limit the search).

While in a quarantine compartment, individuals are not allowed to infect susceptible ones. Finally, to capture different recovery rates between I and IT, respectively (assuming quarantined individuals being treated with appropriate medical care), we introduce the γT as a parameter regulating the \(I_{T}\rightarrow R\) transition.

Lockdown and social distancing

Another intervention procedure to control the spread of infectious diseases is to reduce individuals’ social interactions. The rationale for social distancing/lockdown strategies is that they slow the spread of the disease (in extreme scenarios, limiting it to individual households), smoothing the infection trend, reducing the pressure on the health care system, and finally, buying time for its strengthening.

To simulate lockdown effects, we add in UTR three statuses (see the transition schema in Fig. 2(a), new statuses marked in orange):

  • Susceptible in lockdown (SL): the susceptible population adhering to the lockdown;

  • Exposed in lockdown (EL): the exposed population adhering to the lockdown;

  • Infected in lockdown (IL): the infected population adhering to the lockdown.

Each individual can move from its current status (if in S, E, or I) to the corresponding lockdown status as regulated by the following parameters:

  • Adherence to lockdown (τ): the probability that an individual adheres to the required lockdown policy;

  • Lockdown escape probability (μ): inverse of the expected duration of the lockdown; during each iteration, socially distanced individuals can decide to leave the lockdown with a probability μ.

Also, in this case, exposed and infected individuals in lockdown are tested with probability 𝜗E,𝜗I, respectively, and a probability of false positive result of κE,κI, respectively.

Fig. 2
figure 2

(a) The UTLR extension includes lockdown compartments (blocks in orange). Restrictions can be applied to Susceptible, Exposed and Infected populations and result in transitions to locked compartments (SL, EL and IL) (b) The UTLDR compartment adds the possibility of differentiating between recovered and immunized population (R), and dead (D)

To make UTLR more general, we also add to the framework the possibility of considering two different disease outcomes: recovering (and immunization, R) or death (D). With such a new compartment, we get the UTLDR modelFootnote 8, whose transition diagram is shown in Fig. 2(b).

Since the added final compartment can be reached from all the infected ones (namely, I, IT, and IL), we extend UTLDR with different transition probabilities to regulate its incoming transition rules. In particular, we model with ω the real lethality rate (that regulates the \(I\rightarrow D\) and \(I_{L}\rightarrow D\) transitions) and ωT the observed one (that regulates the \(I_{T}\rightarrow D\) transition).

ICU with/without availability limits

So far, we considered the “tested” compartments (namely ET and IT) as a proxy to model quarantine. Indeed, we can extend such characterization to enhance their expressiveness. In particular, we can maintain the quarantine semantics for the ET status while leveraging IT as a first building block of another family of compartments: Hospitalization.

Indeed, the diffusion of some diseases can determine the increasing demand for critical care affected by medical devices’ scarcity. Such limitations occur, for instance, when there are no available ICU beds for patients with a critical illness, leading to delays in ICU admission that have significant clinical consequences. Admission delays can result in the boarding of critically ill patients in the emergency area or in other hospital units, which is associated with increased mortality.

To capture such an aspect, we extend our framework with the compartment HT, where tested individuals are hospitalized in case of severe illness - thus making of IT the compartment collecting ill individuals experiencing mild symptoms (see the extended transition diagram in Fig. 3(a).

Fig. 3
figure 3

(a) The UTLDR module with limited ICU availability includes the severe hospitalized population HT, that is differentiated to the one with mild symptoms IT; moreover, population in HT that can not be treated adequately is placed in F. (b) The UTLDR module with corpse disposal allows the contact of population in S with an infected corpse in D

Adding the HT compartment requires the definition of novel parameters: ι, namely the probability of a severe case (e.g., requiring ICU) that regulates the transition \(I_{T}\rightarrow H_{T}\). Moreover, due to lack of medical devices, it could happen that severe cases cannot be placed in HT and are allocated to standard hospitalization routines, F: as expected, the transition \(H_{T}\rightarrow F\) is subject to an upper limit on the resources that we identify as b. The F compartment models severe cases that are not adequately treated and thus potentially affected by a higher lethality (ωT instead of ω) and lower recovery probability (γT instead of γ).

Corpse disposal efficiency, partial immunity and vaccination

It is well known that in the case of some diseases, such as Ebola (Nistal et al. 2019), the infective lying corpses are infective. The dead infective corpses can be considered in the model as a new sub-population D that can infect again. In this case, to extend our model, we add the parameter z - the probability of infection from corpses - to regulate the transition \(S\rightarrow I\) in case of direct (and leaky) contact of a Susceptible individual with an Infected corpse (Fig. 3(b)).

So far, we have assumed people have lifelong immunity to disease upon recovery. Indeed, such characteristics cannot be assumed for all possible diseases. An individual’s immunity might decrease over time, or that a subset of the recovered population can not produce the antibodies for the disease. To cover these scenarios, we extend the proposed model allowing recovered individuals to return to a susceptible state, thus allowing the \(R\rightarrow S\) transition, under a re-infection probability s - as shown in Fig. 4(a).

Fig. 4
figure 4

(a) The UTLDR model with partial immunity considers the possibility that population in S can be reinfected again. (b) The UTLDR model with vaccination includes a new sub-population V that has (successfully) being vaccinated

Finally, the last building block of the proposed framework regards the activation of vaccination campaigns. To such extent, we introduce a new compartment V, collecting the sub-population that has (successfully) received the vaccination - as shown in Fig. 4(b). We assume that only susceptible individuals (either in S or in SL) can be vaccinated, imposing a vaccination probability v and a probability of vaccination nullification of f (inverse of the vaccine’s expected temporal coverage). In the case of vaccination nullification, the \(V\rightarrow S \) transition is applied.

3 Extending UTLDR: Agent-based modeling and human mobility

Although designed to capture different stages of infectious disease dynamics, the framework described so far assumes a fully mixed population: every individual in the population is equally likely to interact with every other individual, and each member in a compartment is treated indistinguishably from the others of that same compartment. Such an approach is widely adopted in epidemic modeling literature; however, it suffers from a relevant limit: it makes model simulations fully deterministic (once fixed the population and model parameters values).

Even though such a simplification allows for a closed analysis and characterization of epidemic models, it is of utmost importance to consider those stochastic effects introduced by the heterogeneous structure of contact networks. To such extent, we designed the proposed framework to exploit the available information (if any) on the population social tissue, thus transforming individuals into a (possibly) stratified population of agents (in the following we use the terms individual/agent interchangeably).

We model agents’ social circles as a node-attributed graph G = (V,E,A) where \(V=\{V_{1},V_{2},\dots ,V_{n}\}\) is the set of nodes (agents), E = {(u,v)|u,vV } is the set of edges (the social ties connecting agents), and A is the set of node attributes (identifying both the UTLDR compartments and node characteristics). We assume that in the defined feature-rich (Interdonato et al. 2019) interaction graph each agent is fully specified by a set of arguments from A, some of them mandatory (e.g., the node’s current compartment), other optional (e.g., age, gender…). For sake of simplicity we allow only the node’s compartment attribute to vary during simulation.

Moreover, to better simulate the dynamic nature of social interaction, we assume that not all social ties of a given node are active during each simulation iteration. To implement such a constraint, we leverage a simple Activity Driven (Perra et al. 2012) network model, a framework often employed to simulate evolutive dynamics of network topology in the absence of explicit temporal interaction data (Liu et al. 2014; Pozzana et al. 2017; Zino et al. 2018; Ogura et al. 2019). Each agent vV in the network has assigned an activation probability av ∈ [0,1] identifying the percentage of edges (chosen uniformly at random) he activates during each simulation iteration. Moreover, we also allow part of such interactions to occur outside the neighborhood of v. To do so, we augment the model with a probability p (evaluated once for each interaction) to account for long-range contacts. In particular, we allow each agent to interact with random ones from their neighborhood with probability (1 − p) and with random ones from anywhere in the network with probability p. Long-range interactions are introduced to model the chance that agents interact with infected people outside their neighborhood (e.g., while on public transportation or at the supermarket). Indeed, the parameter p defines the network’s locality: for p = 0 an agent interacts only with their social circle, while p = 1 represents a uniformly mixed population. The av and p parameters are vital factors in simulations involving quarantine/hospitalization and lockdown compartments: the former one is implicitly used to restrict agents’ sociality during quarantine/hospitalization, the latter one, to tune account for decreased mobility during lockdowns.

Starting from such a network refined contact model, we defined two alternative versions of the framework, each one assuming a different available knowledge: (i) explicit and (ii) implicit social tissue models.

Explicit network structure

In this scenario, the social topology connecting individuals is known apriori. Explicit social interaction topologies are often obtained from online social network platforms or built on small/medium-scale sensor tracking experiments. The main issue in working with explicit network structures - apart from being difficult to obtain - lies in the space consumption that grows rapidly as the population size increases.

Implicit network structure

In this scenario, the social topology is unknown to the analyst: we assume available (or, at least, partially inferable) other information characterizing the population (e.g., workplace, school attended, household size…). Leveraging such external knowledge, as already done in literature (e.g., the model introduced in (Ferguson et al. 2020)), we build several social contexts for each agent. From each of them, randomly sample with probability av the interactions occurring during each simulation iteration (and with probability p interactions outside them). This approach efficiently addresses the memory issue in storing the explicit interaction graph (which is now generated on the fly) while introducing higher variability on individuals’ contacts.

It is essential to underline that the provided implementation of the UTLDR framework also allows us to stratify all the discussed parameters to characterize the population better if needed. So far, we suggested that each of the compartments controlling parameters may be specified as (fixed) unique values: we opted for such simplification to ease the incremental framework introduction. However, when additional knowledge on the studied population is available (e.g., age distribution, household distribution size, gender distribution, employment type/workplace/school size distributions…), the proposed framework allows to use it to stratify controlling parameter values directly (e.g., imposing β = 0.02 for female under 18 years old agents while setting β = 0.3 for the rest of the population). Such flexibility makes it possible to define sub-populations characterized by different responses to epidemic events easily.

Another key component profoundly affecting epidemic spreading is human mobility (Barmak et al. 2011; Espinoza et al. 2020; Kraemer et al. 2020; Cintia et al. 2020). So far, we simplistically modeled long-range interactions with a simple probability; however, such a parameter does not control the actual mobility constraints that might affect random social interactions. For this reason, we incrementally extended our framework to leverage aggregated mobility information (when available) to select the most likely cohort of agents for short/medium/long-range interactions.

To do so, UTLDR requires three different, additional sources of data:

  • aggregated geographic allocation of the population (e.g., as inferable from census data);

  • a geographic tesselation (e.g., a hierarchy composed by census cells, municipalities, regions…);

  • a set of aggregated origin-destination matrices (one for each level of the tesselation hierarchy, e.g., as computable from GPS/CDR data (Jain et al. 1999; Alexander et al. 2015)) each providing the probabilities of moving from/to any given geographic area to all the others of the same hierarchy level.

In the presence of such knowledge, UTLDR will: (i) allocate each individual to several geographic regions, one for each social circle he/she is involved in (e.g., one for the neighborhood of the home location - as identified by stratification of the population over census cells - and one for the workplace), (ii) sample social interactions among individuals associated to shared social/geographical clusters (weighting them in different ways if needed), and (iii) sample long-range interaction within geographic clusters reached with probability given by the provided origin-destination matrices - assuming as starting location the individual’s home one.

4 Case studies

In this section, we report a few case studies to underline the proposed UTLDR framework’s flexibility. In particular, without losing generality, we propose two case studies: a first, detailed in Section 4.1, using synthetically generated social networks to capture individuals’ interactions; the second, discussed in Section 4.2, focusing on a population - whose social structure is not given - stratified starting from Italian census data.

4.1 Explicit Network Structure

In Figs. 5 and 6, we show the diffusion trends obtained by simulating alternative models built on top of the proposed framework. All simulations are executed assuming the underlying social structure as generated by the Barabási and Albert (1999) (henceforth, BA) and the Erdös-Rényi models (Erdös and Rényi 1959) (henceforth, ER), each one composed by N = 5000 nodes. For the sake of simplicity, we do not integrate human mobility and population stratification in the reported case studies.

Fig. 5
figure 5

Experiments on the BA model. (a) The simplest SEIR + (b) re-infection allowed transition; (c) Testing and (d) Lockdown scenarios + (e) dead-recovered distinction + (f) ICU availability

Fig. 6
figure 6

Experiments on the ER model: (a) The simplest SEIR + (b) re-infection allowed transition; (c) Testing and (d) Lockdown scenarios + (e) dead-recovered distinction + (f) ICU availability

We set an initial fraction of infected nodes to 0.0001, and simulate 150 iterations - except for the SEIR model, where the number of iterations is extended to 300, to observe better a possible re-infection effect. Moreover, while modeling the compartments where a lockdown is included (i.e., UTLR and the remaining incremental modules), the first 50 iterations are run without any social distancing policy in place, the following 50 imposing lockdown restrictions and, finally, a release of such policies during the remaining iterations.

The following sets of parameters are used for testing the compared models (models are reported in incremental order, the nth one inheriting the parameter values of all the previous):

  • SEIR: β = 0.02, σ = 0.2, γ = 0.03;

  • SEIS: s = 0.01 (partial immunization, allows \(R\rightarrow S\));

  • UTR: 𝜗E,𝜗I = 0.01, κE,κI = 0.05, γT = γ;

  • UTLR: τ = 0.8, μ = 0.01;

  • UTLDR: ω,ωt = 0.05;

  • ICU: b = N, ι = 0.8;

Please, note that the selected values are chosen for testing how the framework works and they do not reflect any real-world possible scenario. In detail, while modeling the simplest SEIR model, we used a set of parameters that take an exposition period of 5 days (i.e., 1/σ) into account, and similar infection β and recovery γ rates. Among the two structures, the breakout is quicker in the ER model than in the BA one (Figs. 5(a) and 6(a)), and such a difference continues to be observed among the other incremental modules. However, adding a re-infection parameter s, the effect is visible in the only BA model (Figs. 5(b) and 6(b)).

Introducing testing allows us to shift to the UTR module, where exposed and infected agents can be tested with probabilities 𝜗E and 𝜗I, and with the possibility to get false positives with probability κE and κI. We used the same parameter values for our synthetic networks without differentiating between exposed and infected people, also considering a very low probability of getting false positives. For simplicity, we set the recovery rate γT equal to γ. In any case, the effect of quarantine (i.e., identified exposed and identified infected agents) is visible by observing the plateau of the susceptible population curve (Figs. 5(c) and 6(c)), in both the two networks.

We then shift to the UTLR model compartment by specifying the two parameters that regulate social distancing/lockdown, i.e., the population adherence to the restrictions τ and the escape probability of the social distanced individuals μ; Here, we decide to report a scenario with high adherence to the imposed restrictions and a low escape probability to make more visible the differences between the first 50 iterations and the remaining ones where lockdown restrictions are imposed. Susceptible and infected social distanced agents permit to stop the breakout, then the infection can restart (Figs. 5(d) and 6(d)). No significant differences are observed among the two different topologies used in our experiments, except for the already underlined faster breakout in the ER model.

To finally introducing the UTLDR model, we specify the expected death rate. We decide to set a particularly high death rate ω = 0.05 (imposing a same value for ωT) so to observe better a sharp death trend - as underlined in Figs. 5(e) and 6(e). Finally, in Figs. 5(f) and 6(f), a simple parameter setting for ICU modeling is used, i.e., the number of ICU b as the same as the agents in the networks, and a high percentage of ICU needs ι.

Focusing our attention on a qualitative analysis of the trends reported in Figs. 5 and 6, we can notice the rise of different novel patterns for the infected population whenever a new policy is introduced. It is important to underline that starting from UTR such population identifies the fraction of infected individuals that were not detected by the testing: namely, the ones that are not captured by targeted interventions (e.g., testing, quarantine, hospitalization). The reported trends illustrate how - as expected - such a population reduces as more stringent restrictions and policies are set in place. Moreover, the introduction of Lockdowns causes a sudden and temporary drops of new infections (due to the limited social contacts). Indeed, when restrictions are lifted, as expected, the infected population grows again due to the incomplete eradication of the disease and the available “fuel” provided by the Susceptible individuals.

4.2 Implicit network structure

Differently from the previously discussed scenario, we assume that the social graph is not known in advance. However, we also assume the presence of a carefully stratified set of agents designed to approximate the whole population of a given geographical area. In particular, we perform our simulations on 3,73 million agents stratified to match an Italian region’s population, Tuscany. The population has been stratified by leveraging official census data as provided by ISTATFootnote 9. In particular, the following dimensions have been used to characterize each agent and assign it to the proper geographic/social clusters:

  • Age, gender, household size distribution at the census cell level;

  • Workplace (public/private sector and NACE code (Schnabl and Zenker 2013)): number and size distribution at municipality level;

  • Unemployment rate - stratified by age - at province level;

  • Schools (by order): distribution of the number of classes and students (by age) at the municipality level.

Moreover, origin-destination matrices were simulated (due to lack of precise data) to consider mobility probabilities among a three-tiered hierarchy composed of census cells, municipalities, and provinces. The simulated destination matrices rely only on geographical proximity, not on observed mobility fluxes.

The data used for this case study (along with stratified populations for all Italian regions), as well as the fine-tuned implementation of UTLDR, are available on a dedicated GitHub repositoryFootnote 10.

In Fig. 7(a-b), we report the diffusion trends for two different scenarios designed with UTLDR. Both figures refer to the same model, the only significant variation lying on the temporal schedule of lockdowns. In particular, the implemented model is completely specified by the following parameter settings:

  • Initial infected population: 0.00002% (\(\simeq 80\) individuals);

  • SEIR parameters: β = 0.006, σ = 0.25, γ = γT = 0.04;

  • Testing parameters: 𝜗E = κe = 0 (no testing on exposed), 𝜗I = κi = 0.1;

  • Tracing: Ttracing = 0 (no tracing);

  • Lethality: (real) ω = 0.001, (observed) ωT = 0.0015;

  • Long-range interactions: p = 0.008;

  • ICU: ι = 0.2, b = 200 (pre-lockdown), b = 400 (during)

  • Lockdown: τ = 0.9.

Fig. 7
figure 7

Diffusion trends for the Tuscany case study. All scenarios start with a setup phase of 30 iterations, during which only UTDR compartments are active. (a) A single lockdown of 90 iterations is activated; (b) two consecutive lockdown of length 60 and 30 iterations respectively are activated - separated by 30 iterations of UTDR; (c) The same setting of the previous scenario but the separation among consecutive lockdown is set to 60 iterations; (d) Same setting of (b) but lockdown lengths are switched

To summarize, the designed model activates both hospitalization and lockdown compartments and allows long-range interactions. Moreover, during lookdowns, mobility is allowed only within the municipality boundaries, and the only categories not affected by lockdown policies are the Health workers.

The parameters of the activity driven model (the degree of activeness of each individual) are set by stratifying per age groups and social context (home census cell, workplace, school). For instance, we assume for agents with age within [10-25] the following activeness scores [“workplace”= 0, “home census cell”= 0.05, “school”= 0.9], while for those ones in the age range [25-50] the scores [“workplace”= 0.4, “home census cell”= 0.1, “school”= 0]. We underline that the proposed simulation, although feed with ”realistic” population data it is not fitted to replicate any specific epidemic process (e.g., Ebola, SARS-CoV-2).

Leveraging the described model, we design four different scenarios, each composed of 180 iterations (one per full day). For the sake of simplicity, we report the trends only for a few compartments, namely: Infected (undetected), Hospitalized mild (quarantined), Hospitalized severe ICU, Hospitalized severe (patients requiring ICU but assigned to standard care for lack of beds), and Dead. The total of ill individuals - during each iteration - is given by the sum of the first four compartments. Exposed and Recovered populations are omitted so to increase readability.

In the first scenario, shown in Fig. 7(a), after an initialization phase of 30 iterations - common to all proposed simulations -, where only testing is enabled, a lockdown of 90 iterations is imposed. In the second scenario (Fig. 7(b)), two consecutive lockdowns are activated: one right after the initialization phase - for 60 iterations -, the other 30 iterations after the deactivation of the previous one (and lasting for 30 iterations). The third scenario follows the same pattern of the previous one while increasing the distance among the two imposed restrictions from 30 to 60 iterations (Fig. 7(c)). Finally, in the fourth scenario, the lockdown strategy designed in the second one are switched: imposing at first a 60 iterations lockdown and then, after 30 iterations, a new shorter one of 30 iterations (Fig. 7(d)). The reported trends clearly highlight how the length and scheduling of public interventions deeply affect the persistence of the simulated epidemic process - even while maintaining fixed the model describing it. In the first and second scenarios, after a long closure, the epidemic completely dies out; conversely, in the third and fourth scenarios, the repeated lockdown is not enough to stop the diffusion. It is worth noticing that due to the stochasticity introduced by heterogeneous mixing patterns (and random infection seeds) the overall scale of the reported trends might vary from an execution to another: however, such variations in volume do not deeply affect the observed trends shape, producing only minor point-wise fluctuations.

5 Conclusion and future works

This paper introduced a framework, namely UTLDR, to allow an incremental description of compartmental epidemic models incorporating diffusion mitigation strategies. UTLDR segments the compartments it provides in five macro classes (Undetected, Tested, Lockdown, Recovered, and Dead), each one identifying a set of interventions/outcomes. After discussing the compartments, transition rules among them, and controlling parameters, we provided a few examples of models that UTLDR allows to build - ranging from simple Testing and Hospitalization to Lockdown and Social Distancing. Moreover, we also showed how additional compartments could be easily added to UTLDR models to simulate vaccination strategies and inefficient corpse disposal.

We formulated UTLDR in a conventional mean-field scenario (as reported in Appendix A): however, to account for heterogeneous mixing-patterns, we also discussed its extension to complex network topologies. We modeled such a scenario with an activity-driven network approach, allowing as inputs both explicit and implicit social tissues that dynamically update during the model simulation. Moreover, we designed UTLDR to allow stratified parameter settings on top of population characteristics (e.g., age, gender…) and, at the same time, to incorporate aggregate human mobility information (as origin-destination matrices) to better account for geographic contacts limitations. Finally, we provided case studies to qualitatively discuss a subset of the models built on top of UTLDR, focusing on the framework explicit and implicit network extension. Conversely from recent works focusing on SARS-CoV-19 pandemic (Estrada 2020; COVID et al. 2020; Naik et al. 2020; Sarkar et al. 2020; Bastos and Cajueiro 2020; Karnakov et al. 2020; Prem et al. 2020; Perra 2021), UTLDR is not intended to be a epidemic-specific model. The proposed framework has been conceived as a tool enabling the definition of custom compartmental models tailored to integrate, and qualitatively estimate, the expected effects of non-pharmaceutical interventions.

As future work, we plan to extend the Tuscany case study analysis to other Italian regions and define a model focused on SARS-CoV-2 scenario generation. Moreover, we plan to release an online dashboard to support a visual setup of UTLDR models simulation and visual inspection of their results.