knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(rSimpleModel) library(rDataPipeline) library(here) library(magick) library(pdftools) i_am(path = "vignettes/SEIRS.Rmd") knitr::opts_knit$set(root.dir = here())
The user should write a config.yaml file containing information pertaining to the data products used in the code run. The example config.yaml file below describes a code run with inputs:
disease/sars_cov2/SEIRS_model/parameters/static_params
These inputs are listed in the register
block, meaning that they should be
downloaded to the local data store from an external source, with associated
metadata stored in the local registry. These inputs are automatically converted
into a read
block by fair run
(when data products are already present in
the data registry, inputs should be listed in the read
block).
A code run usually also has outputs, which are listed in the write
block. In
the example below, our outputs are:
SEIRSconfig.yaml:
cat(readLines(file.path(here(), 'inst/extdata/SEIRSconfig.yaml')), sep = '\n')
The submission script should call initialise()
to set up the code run,
then perhaps read in some data using one of the read_*()
functions (for
internal file formats) or link_read()
(for external file formats such as
csvs). The data might now be processed in some way, or a model / analysis might
bw carried out, after which the results should be saved in the local data store
via one of the write_*()
functions or link_write()
. When the code run is
complete, finalise()
should be called to register the all metadata with the
local registry.
fair pull
Using the CLI tool, fair pull
identifies any data products listed in the
register
field of the config.yaml. These data products are downloaded to
the local data store whilst associated metadata is registered in the local
registry.
fair init --ci fair pull inst/extdata/SEIRSconfig.yaml
The local registry should now contain three data products:
disease/sars_cov2/SEIRS_model/parameters/static_params
,disease/sars_cov2/SEIRS_model/parameters/rts
, and disease/sars_cov2/SEIRS_model/parameters/efoi
.fair run
Again using the CLI tool, fair run
performs the code run, as written in the.
submission script. In preparation for this, it translates the user-written
config.yaml file for use by the Data Pipeline API. Any variables / wildcards
specified by the user in the config file are cross referenced with the registry,
and any data products registered by fair pull
are made available to read by
the current code run.
fair run inst/extdata/SEIRSconfig.yaml
path <- get_dataproduct(data_product = "SEIRS_model/results/figure/R", version = "0.0.1", namespace = "testing") image_read_pdf(path)
get_provenance(data_product = "SEIRS_model/results/model_output/R", version = "0.0.1", namespace = "testing")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.