Create Decision Flow
create_decision_flowCreates SAS Intelligent Decisioning flows from ordered steps—rule sets, models, assignments, conditions, and branches—and stores the decision in a SAS Content folder.
Instructions
Create a SAS Intelligent Decisioning flow: rule sets, segmentation trees, code files, models, sub-decisions, assignments, conditions and branches.
Give the flow as steps (every step kind, wired by name) or, as
before, rule_set_steps (rule sets only, wired by hand). A flow that
sets defaults, scores a model, branches on its score and checks the
result::
steps = [
{"type": "assignment", "name": "Defaults",
"assignments": {"offer": "NONE", "credit_limit": 0}},
{"type": "model", "id": "<model repository id>"},
{"type": "branch", "branch_type": "range", "variable": "P_BAD1", "cases": [
{"label": "Low risk", "max": 0.1999, "steps": [
{"type": "assignment", "assignments": {"offer": "GOLD", "credit_limit": 10000}}]},
{"label": "Medium risk", "min": 0.2, "max": 0.4999, "steps": [
{"type": "rule_set", "id": "<rule set id>"}]}],
"default": [{"type": "assignment", "assignments": {"offer": "DECLINE"}}]},
{"type": "condition", "expression": "offer = 'GOLD'",
"on_true": [{"type": "code_file", "id": "<code file id>"}], "on_false": []},
]Steps nest: a branch case, a branch default and either side of a condition hold steps of any kind, branches and conditions included.
Assignment —
assignmentsmaps a decision variable to a constant, written plainly ("GOLD",10000): the service quotes strings itself and evaluates nothing, so"a + b"is stored as that text. Compute values in a rule set or code file. The variable must be insignature;namelabels the step.Model —
idof a model in the model repository (list_registered_models, Tier 6). Its inputs map to same-named decision variables; its outputs (e.g.P_BAD1,I_BAD) are added as decision variables unlesssignaturehas them, a class label as a string.mappingsrenames:{"model variable": "decision variable"}.Branch —
variable(on the branch, or per case) andcases, checked in order; the first match runs, elsedefault.rangecases takeminand/ormax(leave one out for an open end) and compare inclusively,>= minand<= max; cases must not share a value, so end the lower case just below the next (max 0.1999next tomin 0.2).equalscases take onevalue;likecases apatternwith%and_wildcards.Condition — a DS2
expressionover decision variables, e.g.score >= 630 and band = 'A'; check it with validate_decision_expression first.Rule set, segmentation tree, code file, sub-decision —
id, optionalrevisionandmappings. Segmentation trees, code files, value lists and custom functions are created with the Tier 10 (Decisioning Advanced) tools; list_decisioning_assets finds existing ones.
The decision is always stored in a SAS Content folder. Without
folder it goes to the deployment's default folder; when there is
none, the call is refused and you should ask the user which folder to
use. The result's folder says where it was stored.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Decision name (max 60 chars). | |
| steps | No | The flow, in order — any step kind (see above): ``rule_set``, ``segmentation_tree``, ``code_file``, ``decision`` (a sub-decision), ``model``, ``assignment``, ``condition`` or ``branch``. ``revision`` defaults to the newest locked revision (one is locked if there is none); "working" uses the editable one. Mappings default to same-named decision variables; ``{"step term": "decision variable"}`` renames. The result's ``steps_report`` lists the revisions used, the variables added and any step input nothing maps to. | |
| folder | No | Where to store the decision: a folder path such as ``/Public/Content/Decisions``, ``My Folder`` (or a folder below it, ``My Folder/Risk``), a folder ID, or a folder URI (``/folders/folders/<id>``). Omit to use the default folder. | |
| signature | Yes | Flow-level input/output variables, each ``{"name", "direction", "dataType"}`` — direction input or output; dataType string, decimal, integer, date, datetime, boolean. | |
| description | No | Optional description. | |
| rule_set_steps | No | Ordered list of rule set steps to execute in sequence, each ``{"ruleSetId", "versionId", "mappings"}`` — versionId is a locked rule set revision (see ``lock_business_ruleset_revision``); mappings is a list of ``{"stepTermName", "direction", "targetDecisionTermName"}`` connecting the rule set's terms to this decision's signature. A term produced as output by an earlier step can be consumed as input by a later step via a shared signature entry. | |
| add_missing_variables | No | With ``steps``, add a decision variable for every step term none matches (default true): Intelligent Decisioning validates a step only when all its terms are mapped. The result's ``steps_report.variables_added`` lists them. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||