This is an experimental feature that traces variable lineage through an injection of a ".uuid" attribute for each variable. Previous attempts at variable lineage were conducted using variable names and heuristics of known functions. This approach yields a more consistent lineage.

load_variable_lineage(
  directory = here::here("blueprints"),
  recurse = FALSE,
  script = here::here("_targets.R")
)

filter_variable_lineage(
  g,
  variables = NULL,
  tables = NULL,
  mode = "all",
  cutoff = -1
)

vis_variable_lineage(..., g = NULL, cluster_by_dataset = TRUE)

Arguments

directory

A folder containing blueprint scripts

recurse

Should this function recursively load blueprints?

script

Where the targets/drake project script file is located. Defaults to using targets.

g

An igraph object. This defaults to a graph loaded with load_variable_lineage. However, use this if you want to inspect subgraphs of the variable lineage.

variables

Character vector of patterns for variable names to match. Note that each pattern is assumed to be disjoint (e.g. "if variable pattern A or variable pattern B"), but if tables is not NULL, the search will be joint (e.g. "if (variable pattern A or variable pattern B) and (table pattern A or table pattern B)").

tables

Character vector of patterns for table names to match. Note that each pattern is assumed to be disjoint (e.g. "if table pattern A or table pattern B"), but if variables is not NULL, the search will be joint (e.g. "if (table pattern A or table pattern B) and (variable pattern A or variable pattern B)").

mode

Which sort of relationships to include. Defaults to "all" (includes both relations to the target node in the graph and from the target node in the graph). See igraph::all_simple_paths() for more details.

cutoff

The number of node steps to consider in the graph traversal for filtering. Defaults to -1 (no limit on steps). See igraph::all_simple_paths() for more details.

...

Arguments passed to load_variable_lineage

cluster_by_dataset

If TRUE, variable nodes will be clustered into their respective dataset

Details

To enable the variable feature, set options(blueprintr.use_variable_uuids = TRUE).

Functions

  • load_variable_lineage(): Reads blueprintrs from folder to get variable lineage. Returns an igraph of the variable lineage.

  • filter_variable_lineage(): Filter for specific variables to include in the lineage graph

  • vis_variable_lineage(): Visualizes variable lineage with visNetwork. Returns an interactive graph.