# EPIGRASS -.epg file Definition

The .epg file defines the epidemic model and the parameters to be used by EPIGRASS. It can be edited by the user directly, by means of a text editor, or using the .epg editor.

## Basic structure of a .epg file:

The .epg is divided into seven sections:

1. THE WORLD
2. EPIDEMIOLOGICAL MODEL
3. MODEL PARAMETERS
4. INITIAL CONDITIONS
5. EPIDEMIC EVENTS
6. TRANSPORTATION MODEL
7. SIMULATION AND OUTPUT

WARNING: Sections cannot be removed or created.
Each section has a set of variables that specifies your model.
NOTE: No variable can be removed, even if not used by your model. If a variable is not used by your model, just leave it there that will do no harm.

THE WORLD

Here you define the files that describe your virtual world.

- shapefile -> is the map layer that will be used as a background for the graph display. It is defined as a list, containing a file name and the name of two variables: the first is the locality names, and the other is a sequence of unique integers to be used as geocodes. If no shapefile is available, leave this variable empty.
  Example:['riozonas_LatLong.shp','nome_zonas','zona_trafe']

- sites -> text file with list of sites (see Documentation).
  Example:sites.csv

- edges -> text file with list of edges (see Documentation). Example:edges.csv

- encoding -> encoding variable can be set to a string stating the encoding of your sites and edges files. If left empty iso-8859-1 (latin-1) is assumed (see Documentation for acceptable encoding strings).
  Example: encoding=

EPIDEMIOLOGICAL MODEL

Epigrass has a set of built-in models (SIS, SIS_s ,SIR, SIR_s, SEIS, SEIS_s, SEIR, SEIR_s,SIpRpS, SIpRpS_s,SIpR,SIpR_s,Influenza). Besides these, the user may define his/her own model and access by the protect word Custom. The epidemic model is defined by the variable:

- modtype -> Here, the epidemic model is defined.
  Example: modtype='SIR'
  modtype='Custom'

MODEL PARAMETERS

They can be specified as constants or as functions of global or site-specific variables. These site-specific variables, are provided in the sites file.

In this section, there is a set of variables that cannot be removed from the .epg file (if your model does not require them, just ignore them). These are:

- beta -> transmission coefficient (contact rate * transmissibility).
  Examples:
  beta = 10
  beta = 0.01 + 0.01 * sin(2*pi*t)
  beta = 0.01 * 3
  beta = 0.01 * values[0] (where values[0] is a variable defined in the edges file)

- alpha -> clumping parameter. Control for departures form random mixing.
  Example: alpha = 1 (no clumping effect, that is, assume random mixing)

- e -> inverse of incubation period.
  Example: e = 0.5 (incubation period of 2 days)

- r -> inverse of infectious period
  Example: r = 0.2 (infectious period of 5 days)

- delta -> probability of acquiring full immunity after infection [0,1]. Only useful for models with partial immunity.
  Examples: delta = 0 (no disease induced immunity; after infection, individuals return directly to the susceptible class)
  delta = 1 (disease induce complete immunity; after infection, individuals move to the removed class)
  delta = 0.5 (after infection, 50% of the individuals return to the susceptible class)

- w -> rate of of immunity wane per time step [0,1]. In other words, it is the inverse of the average duration of immunity. This variable is only useful in models with immunity wane
  Examples:
  w = 0 (no immunity wane. Recovered individuals never return to the susceptible class)
  w = 0.01 (1% of recovered individuals move to the susceptible class, per time step)

- B -> susceptible renewal rate, per time step.
  Example: B = 0 (no renewal (default))
  B = 3 (3 new susceptibles enter the population each time step)
  B = values[3] (renewal rate is site specific and given in the third extra column of the site definition file.)

- p -> level of suscpetibility of individuals in the recovered class [0,1]. This variable is useful in models where individuals in the recovered class are not fully protected against infection.
  Examples:
  p = 0.3 (individuals in the recovered class has 0.3 relative risk of getting infected when compared to the fully susceptible)
  p = 0 (full protection)
  p =1 (no protection)

Besides these required parameters, the user may add any number of extra parameters to the epg file. To do this, just click the button NEW VARIABLE and choose section MODEL PARAMETERS. A new line will be added to the editor, allowing you to set the value for this variable and add comments.

INITIAL CONDITIONS

Here, the number of individuals in each epidemiological state is specified. They can be specified in absolute or relative numbers (adding to 1).

The protected letter N is the population size of each site. It can be used when defining the population in each state. See examples.

Note that the rule defined here will be applied equally to all sites. For site-specific definitions, go to section EVENTS (below).

Here, there are three mandatory parameters: (they cannot be removed from the file. If the variable is not present in the your model, it will be ignored).

- S -> number (or density or relative frequency) of susceptibles
- E -> number (or density or relative frequency) of exposed individuals (infected but not infectious
- I -> number (or density or relative frequency) of infectious individuals

Examples:
S = 0.99*N, E = 0, I = 0.01*N (the same fraction of susceptibles is applied to all sites)
S = N, E = 0, I = 0 (all individuals are susceptibles. Arrival of index case will be set in the EVENT section)
S = N-1, E = 0, I = 1 (simulation starts with one infected individual per site)

Besides these mandatory variables, the user may add as many new variables as his/her model requires. To do this, just click on the ADD VARIABLE button and choose a name for this variable (careful not to duplicate names). Then, a new line will be created in the .epg editor. Add the parameter value and comments.

EPIDEMIC EVENTS

In this section, time-specific and/or site-specific events are defined. Localities where the events are to take place should be identified by their code (which is the column after population size in the sites datafile). All variables here are defined as Python lists (see examples).

- Seed -> Inserts infected individuals (type I) in a set of sites at start time. This command is useful if ones want to specify the location where the index case(s) are.

  Format: [('locality1's geocode',epid state, n),('locality2's geocode', epid state, n),...], where n is the number of infected individuals in the corresponding locality, at time 0.

  Examples:
  Seed = [(45,'I',1)] (1 infected person arrives in locality 45 at time 0)
  Seed = [(45,'E',1),(12,'E',5)] (1 exposed person arrives in locality 45 and 3 other arrive in locality 12 at time 0)
- Vaccinate -> At a set of time steps, remove a fraction of individuals cov from the suscpetible class to the recovered class at given localities.

  Format: [('locality1's geocode', [t1,t2,...], [cov1,cov2,...]),('locality2's geocode', [t1,t2,...], [cov1,cov2,...])]

  Examples:
  Vaccinate = [] (default: no vaccination events)
  Vaccinate = [(45, [1,2], [0.2,0.3])] (in the locality 45, vaccinate 20% of susceptibles at time 1 and 30% of susceptibles at time 2)
  Vaccinate = [(45, [1,2], [0.2,0.3]),(40, [10], [0.3])] (besides the campaign above, vaccinate 30% of the population of site 40, at day 10)
  Vaccinate = [('all', [1,2,3,4,5], [0.1,0.1,0.1,0.1,0.1])] (vaccinate all sites, from day 1 to 5, with 10% coverage per day)

- Quarantine -> not implemented yet

TRANSPORTATION MODEL

In this section, some aspects of the movement of individuals between sites are defined.

- doTransp -> Boolean variable. If set to 0, no transport occurs. If set to 1, the commutation dynamics is simulated (useful for debugging purposes)

- stochastic -> Boolean variable. If set to 1, commutation is modeled as a stochastic process (Poisson distributed). If set to 0, commutation is modeled deterministically (see Documentation for details)

- speed -> Average speed of transportation system in km per time step. Enter 0 for instantaneous travel. Distance unit must be the same specified in edges files

SIMULATION AND OUTPUT

Here, you specify extra parameters for the simulation, and what you want as output (and where).

- steps -> number of time steps. Example: steps = 50

- outdir -> Output directory. Must be a full path. If empty the output will be generated on the sub-directory of same path as the model script.

- DBout -> Database Output. Set to 0 (no database output) or 1

- report -> controls report generation. The variable report can take the following values: 0 - No report is generated; 1 - A network analysis report is generated in PDF Format; 2 - An epidemiological report is generated in PDF Format; 4 - A full report is generated in PDF Format.

- siteRep -> is a list with site codes. For each site in this list, a detailed report is appended to the main report defined above. Example: [34,54,23]

- Replicas -> if set to an integer larger than zero, the model will be run n times and the results will be consolidated before storing. Replicate mode automatically turn off report and batch options.

- RandSeed ->if RandSeed is set to 1 the seed will be randomized on each replicate

- Batch -> Batch Run list other scripts to be run in after this one. Don't forget the extension .epg. Model scripts must be in the same directory as this file or provide full path.
  Examples:
  Batch = ['model2.epg','model3.epg','/home/jose/model4.epg']
  Batch = [] (default)