Assign observational units to one or more contexts using declared filesystem boundaries.
Usage
derive_record_set(
x,
contextual_groups,
observed_unit_var = "observed_unit",
include_subfolders = TRUE
)Arguments
- x
A data frame containing observational units, typically created with
observe_universe().- contextual_groups
A data frame defining contextual boundaries.
Must contain:
- context
Context identifier.
- root
Filesystem root used to derive membership.
- observed_unit_var
Name of the column containing observational units. Defaults to "observed_unit".
- include_subfolders
Logical. Currently retained for future compatibility. Membership is derived recursively.
Value
A tibble containing observational units assigned to one or more contexts.
Additional variables include:
- context
Context identifier.
- context_root
Root used for membership derivation.
- construction_method
Membership derivation method.
- derived_by
Function that created the assignment.
- derived_at
Timestamp of derivation.
Details
derive_record_set() creates a contextual membership layer over an observational universe. Membership is derived by matching observational units against one or more declared context roots.
The function is intended as an intermediate step between filesystem observation and Record Set construction.
In a software repository, contexts may correspond to projects, packages, or reporting workflows. In archival environments, contexts may correspond to collections, fonds, or other documentary aggregations.
Membership is currently derived using recursive path-prefix matching.
Examples
toy_universe <- tibble::tibble(
observed_unit = c(
"D:/projects/eviota",
"D:/projects/eviota/tests",
"D:/other"
),
inst_id = c("a", "b", "c")
)
contextual_groups <- tibble::tibble(
context = "eviota",
root = "D:/projects/eviota"
)
derive_record_set(
toy_universe,
contextual_groups
)
#> # A tibble: 2 × 7
#> observed_unit inst_id context context_root construction_method derived_by
#> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 D:/projects/eviota a eviota D:/projects… path_prefix derive_re…
#> 2 D:/projects/eviot… b eviota D:/projects… path_prefix derive_re…
#> # ℹ 1 more variable: derived_at <dttm>
