# `Choreo.Lab.DSL.DecisionTree`
[🔗](https://github.com/code-shoily/choreo/blob/v0.14.1/lib/choreo/lab/dsl/decision_tree.ex#L1)

Experimental Livebook-friendly DSL for sketching decision trees.

This Lab DSL compiles to the stable, pipe-first `Choreo.DecisionTree` builders
and returns an ordinary `%Choreo.DecisionTree{}`. It is useful for interview
decision policies, routing rules, fallback strategies, and tradeoff walkthroughs.

## Examples

    iex> import Choreo.Lab.DSL.DecisionTree
    ...> tree = decision_tree do
    ...>   traffic = root("Traffic Source", feature: "source")
    ...>   authenticated = decision("Authenticated?", feature: "auth")
    ...>   reject = outcome("Reject", class: "403")
    ...>   route = outcome("Route Request", class: "route")
    ...>
    ...>   traffic ~> authenticated |> when_("api")
    ...>   edge authenticated ~> reject, "no"
    ...>   branch authenticated ~> route, "yes"
    ...> end
    iex> Choreo.DecisionTree.root(tree)
    :traffic
    iex> Choreo.DecisionTree.condition(tree, :authenticated, :route)
    "yes"

Branch conditions can use pipe modifiers or explicit branch forms:

    root ~> decision |> when_("api")
    decision ~> outcome |> condition("yes")
    edge decision ~> outcome, "yes"
    branch decision ~> outcome, "yes"

# `branch_decl`

```elixir
@type branch_decl() :: %{
  from: Yog.node_id(),
  to: Yog.node_id(),
  condition: String.t()
}
```

# `node_decl`

```elixir
@type node_decl() :: %{id: Yog.node_id(), builder: atom(), opts: keyword()}
```

# `branch`

# `condition`

# `decision`

# `decision_tree`
*macro* 

Builds a `%Choreo.DecisionTree{}` from a compact Lab DSL block.

# `decision_tree`
*macro* 

# `edge`

# `label`

# `leaf`

# `on`

# `outcome`

# `question`

# `result`

# `root`

# `taxonomy`

```elixir
@spec taxonomy() :: %{
  nodes: [atom()],
  edges: [atom()],
  modifiers: [atom()],
  options: [atom()]
}
```

Returns the vocabulary supported by the decision-tree DSL.

    iex> taxonomy = Choreo.Lab.DSL.DecisionTree.taxonomy()
    iex> :root in taxonomy.nodes
    true
    iex> :branch in taxonomy.edges
    true
    iex> :when_ in taxonomy.modifiers
    true

# `verbs`

```elixir
@spec verbs() :: map()
```

Compatibility alias for `taxonomy/0`.

# `when_`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
