Skip to contents

Creates a new R script in the pre-pipeline builder directories (inputs/cohorts/R/ or inputs/conceptSets/R/) for loading, building, and maintaining manifests before executing the study pipeline. Unlike task files, builder scripts execute in sequence as part of manifest setup.

Usage

makeInputBuilderScript(
  type,
  category = c("cohorts", "conceptSets"),
  projectPath = here::here(),
  open = TRUE
)

Arguments

type

Character. Type of builder script. For cohorts: "importAtlas", "importCapr", "importSql", or "buildDependentCohorts" For concept sets: "importAtlas" or "importCapr"

category

Character. Category of manifest to build. Options: "cohorts" or "conceptSets"

projectPath

Character. Path to the project root (defaults to current project)

open

Logical. Whether to open the file after creating it (default TRUE)

Value

Invisibly returns the template content as a character string

Details

Builder scripts are organized in two main pre-pipeline directories:

  • inputs/cohorts/R/: Scripts for loading and building cohorts

  • inputs/conceptSets/R/: Scripts for loading and building concept sets

Available script types:

  • importAtlas: Import definitions from ATLAS using manifest API

  • importCapr: Build definitions programmatically using Capr

  • importSql: Load custom SQL-based definitions

  • buildDependentCohorts: Build derived cohorts (cohorts only)

All scripts are sourced in sequence by main.R before the production pipeline executes. Users can delete unused scripts (e.g., if they only need ATLAS imports).

Examples

if (FALSE) {
# Create a script for importing ATLAS cohorts
makeInputBuilderScript(type = "importAtlas", category = "cohorts")

# Create a script for building Capr-based cohorts
makeInputBuilderScript(type = "importCapr", category = "cohorts")

# Create a script for importing ATLAS concept sets
makeInputBuilderScript(type = "importAtlas", category = "conceptSets")
}