Skip to contents

Reads YAML or JSON, validates against the M3.1 schema, and returns a typed FrameworkSpec S3 object. The schema requires:

  • framework$name – non-empty character

  • framework$constructs – non-empty list, each with id (unique), name, description, optional example_indicators

  • framework$epistemic_stance – one of "constructionist", "positivist", "mixed"

  • framework$anomaly_handling – one of "extend", "revise", "bracket"

Optional fields: citations, code_definitions.

Usage

load_framework_spec(path)

Arguments

path

Path to a YAML or JSON file (extension determines parser). Special values: when path is one of the built-in framework names (e.g., "tpb", "comb", "tdf"), loads from inst/extdata/frameworks/.

Value

A FrameworkSpec S3 object.

Details

Construct id values must be unique within a framework (the coding pipeline keys constructs by id). Validation errors point at the specific construct that failed so users with a malformed spec get an actionable message.

See also

list_builtin_frameworks; archive_framework_spec (writes a verbatim copy + sha256 to a Mode 3 run dir); framework_prompt_block (formats the spec for AI system prompts).

Examples

# Load a built-in framework by alias
tpb <- load_framework_spec("tpb")
print(tpb)
#> FrameworkSpec: Theory of Planned Behavior
#>   Epistemic stance: positivist
#>   Anomaly policy:   bracket
#>   Constructs:       5
#>     - attitude (Attitude toward the behavior): The degree to which a person has a favorable or unfavorable evaluation of the...
#>     - subjective_norm (Subjective norm): The perceived social pressure to perform or not perform the behavior. Capture...
#>     - perceived_behavioral_control (Perceived behavioral control): The perceived ease or difficulty of performing the behavior. Reflects past ex...
#>     - intention (Behavioral intention): The motivational factors that influence behavior; an indication of how hard p...
#>     - behavior (Behavior): The observable response in a given situation. Speech act describing what the ...
#>   Citations:        2
#>     Ajzen, I. (1991). The theory of planned behavior. Organizational Behavior and Human Decision Processes, 50(2), 179-211. doi:10.1016/0749-5978(91)90020-T
#>     Ajzen, I. (2020). The theory of planned behavior: Frequently asked questions. Human Behavior and Emerging Technologies, 2(4), 314-324.
#>   Source:           /home/runner/work/_temp/Library/pakhom/extdata/frameworks/tpb.yaml

list_builtin_frameworks()
#> [1] "tpb"  "comb" "tdf" 
# [1] "tpb"  "comb" "tdf"

if (FALSE) { # \dontrun{
# Load a custom spec from disk (YAML or JSON)
my_framework <- load_framework_spec("path/to/my_framework.yaml")
} # }