FabCovid19: Automated FACS simulation

To automate the execution and analysis of FACS, we use a FabSim3-based FabCovid19 plugin (https://github.com/djgroen/FabCovid19). It provides an environment for researchers and organisations to construct and modify simulations, instantiate and execute multiple runs for different policy decisions, as well as to validate and visualise the obtained results against the existing data.

Installing the FabSim3 automation toolkit

To install FabSim3, you need to clone the FabSim3 repository:

git clone https://github.com/djgroen/FabSim3.git

To configure FabSim3 and install required dependencies, go to https://fabsim3.readthedocs.io/en/latest/installation.html that provides detailed instructions.

Installing the FabCovid19 plugin

Once you have installed FabSim3, you can install FabCovid19 by typing:

fabsim localhost install_plugin:FabCovid19

The FabCovid19 plugin will appear in <FabSim3_dir>/plugins/FabCovid19.

Configuration

There are a few small configuration steps to follow:

  1. Go to <FabSim3_dir>/plugins/FabCovid19.

  2. copy machines_FabCovid19_user_example.yml as machines_FabCovid19_user.yml.

  3. open machines_FabCovid19_user.yml.

  4. Under the section localhost, and set facs_location value with the actual path of FACS in your local PC.

    localhost:
            # location of FACS in your local PC
            facs_location: "<PATH to you local FACS installation>"
    

Automated FACS execution using FabCovid19

Run a single job

To run a single job, simply type:

fabsim <localhost/remote machine> covid19:<location_scenario>,<TS=transition scenario>,<TM=transition mode>,[outdir=output directory]
where

Example:

fabsim localhost covid19:configs=harrow,measures=measures

Run an ensemble job

To an an ensemble simulation of FACS,

fab <localhost/remote machine> covid19_ensemble:configs='<area_name>;<area2_name>'[,measures=<list of measures files>]

Note

By default, the measures.yml file will be used in simulations.

Examples:

fabsim localhost covid19_ensemble:configs='test',cores=1,replicas=1,measures=measures,starting_infections=10,job_wall_time=0:15:00

fabsim localhost covid19_ensemble:configs='harrow'

fabsim localhost covid19_ensemble:configs='brent;harrow;hillingdon'

To run an ensemble of parallel runs, using 4 cores per run, you can use a comment like the following examples:

fabsim localhost covid19_ensemble:configs='brent',cores=4,replicas=1,simulation_period=500,measures=measures,starting_infections=460,job_wall_time=1:00:00,solver=pfacs

fabsim localhost covid19_ensemble:configs='test',cores=4,replicas=1,starting_infections=460,measures=measures,solver=pfacs

If you ran an ensemble jobs, you may need to do averaging across runs on the output csv files before plotting, in that case you can type:

fabsim <localhost/remote machine> cal_avg_csv:<location_scenario>,<measures=measure_yml_file>

Examples:

  • submit an ensemble job, containing 25 identically configured simulations:

    fabsim localhost covid19_ensemble:configs='brent',measures='measures;measures_nolockdown',replicas=25
    
  • submit an ensemble job using QCG-PilotJob:

    fabsim localhost covid19_ensemble:configs='brent',measures=measures,replicas=25,PilotJob=true
    
  • fetch results:

    fabsim localhost fetch_results
    
  • Calculate averages across runs (not recently tested):

    fabsim localhost cal_avg_csv:brent,measures='lockdown_uk'
    fabsim localhost cal_avg_csv:brent,measures='lockdown_uk'
    

Run a validation job

To run a validation simulation, simply type:

fabsim localhost facs_validation

Post-processing the output results

Post-processing commands
Task Command Syntax Examples Description
No. of infected people and ICU admissions over time fabsim localhost facs_postprocess:<results_dir_name> fabsim localhost facs_postprocess:brent_localhost_1 Plots the mean of all the runs present in the specified results directory. Corresponding confidence intervals are also provided.
No. of infections in specific location types over time fabsim localhost facs_locationplot:<results_dir_name> fabsim localhost facs_locationplot:brent_localhost_1 Creates a vertical stack of plots showing the number of infections that occured over time in each location type.
Map of the region fabsim localhost facs_locationmap:<region_name> fabsim localhost facs_locationmap:brent Creates a map of the location showing all the locations (shopping schools hospitals etc.) on a map.

Basic post-processing (No. of infectios people and ICU admissions)

To perform the post-processing on the output results from a single results directory, simple type:

fabsim localhost facs_postprocess:<results_dir_name>

Here results dir is the name of the subdirectory only (e.g. brent_localhost_1), not the full path. Once you have run this, if everything has been configured correctly, you should get a web page that shows a plot like this:

_images/validateplot.png

Comparing the infection-spread by location type

Similarly, you can now perform a comparison on infectious spread by location type. To do so, type:

fabsim localhost facs_locationplot:<results_dir_name>

Once you have run this, if everything has been configured correctly, you should get a web page that shows a plot like this:

_images/locationplot.png

Note

Before you execute facs_postprocess or facs_locationplot, you should fetch the results using fab <machine_name> fetch_results.