SpaDES workflows and projects

Author

Eliot McIntire

Published

December 3, 2024

One of the advantages of SpaDES is that we can make simple “linear” workflows, but we can also make complex workflows emerge from the combinations of modules (and of their events) being put together by a user. SpaDES modules provide their own needed schedules, and the metadata tells SpaDES how different modules fit together. Then when executed, events within and across modules go in the correct order. If the group of modules changes later on, the workflow steps may also change.

In this section, we will start with the simplest case of two code chunks in sequence, and we will advance to chain together many modules and rich project workflows using SpaDES.project. We assume that readers are already familiar with SpaDES, namely creating and using SpaDES modules. If not, we encourage going through the chapters in Section SpaDES 101.

From 14  Forest Landscape Modelling with LandR and setupProject onwards, we show project flows with SpaDES modules that have been developed and used in ecological modelling and forecasting, to answer both research or applied questions. We encourage readers to learn more about these models (and modules) from the documentation sources noted in the chapters.

Some of the SpaDES-verse

We can see many of the known modules in the SpaDES-verse and how they interact through their shared inputs and outputs in this interactive figure:

Show the code
Require::Install(c("igraph", "visNetwork"))

modPath <- "~/SpaDES_book/listModules/"
accountsListLong <- c("PredictiveEcology", "ianmseddy", "achubaty",
                       "FOR-CAST", "eliotmcintire", "tati-micheletti", "CeresBarros")
grepListLong <- c("Biomass", "WBI", "LandR", "fireSense", "CBM",
                  "LandMine", "LandWeb", "NRV", #"scfm",
                  "priority", "fire",
                  "dataPrep", "DataPrep", "RoF", "Ontario", "ROF")
modsLong <- SpaDES.project::listModules(grepListLong, accounts = accountsListLong,
                                        excludeStale = FALSE)
modsLong <- paste0(modsLong, "@HEAD")

# downloads lots of modules
mods <- SpaDES.project::getModule(modsLong, modulePath = modPath)

DT <- SpaDES.project::moduleDependencies(modsLong, modulePath = modPath)
graph <- SpaDES.project::moduleDependenciesToGraph(DT)
(vn <- SpaDES.project::PlotModuleGraph(graph))

We also sometimes represent these as hexes, following the R-package convention:

The idea with setupProject is that we can start weaving different groups of modules together. This is what we will do in the next sections.