Skip to contents

Assembles the complete dataset program: DISCLAIMER header, library calls, source-dataset placeholders, all variables in dependency-driven order via [order_variables()], and an optional finalize block (metatools/xportr spec-compliance tail). Fails when [check_admiral_compat()] reports a version conflict.

Usage

render_program(
  ir,
  backend_label = "rules",
  finalize = TRUE,
  language = "r",
  gate = NULL
)

Arguments

ir

Non-empty list of `aa_variable_ir` objects.

backend_label

Backend label recorded in the header (`"rules"` or `"llm"`).

finalize

Whether to append the commented finalize/export block.

language

Target language for the rendered program. Only `"r"` is implemented; `"sas"` and `"python"` are recognised targets that fail naming every layer in this IR that has no renderer yet.

gate

Optional approval gate (see `sign_gate()`). When supplied, the signer, moment and reason are reproduced in the program header so a reader of the code alone can see who approved it. The header states plainly that an approval is not evidence of correctness; omitting the gate leaves the rendered program byte-identical to an ungated render.

Value

A single character string of R code.

Details

Render a full analysis program from an IR

Examples

spec <- mock_spec_adsl()
ir <- classify_variables(spec, "ADSL", backend = "rules")
program <- render_program(ir)
cat(substr(program, 1, 200))
#> # ============================================================
#> # ADSL analysis dataset program
#> # Generated by admiralagent v0.1.1 (backend: rules)
#> # DISCLAIMER: DRAFT CODE - starting point only. A qua