# `Cite.Policy`
[🔗](https://github.com/mdepolli/cite/blob/v0.2.0/lib/cite/policy.ex#L1)

A policy: what the source is judged against, declared once in a module.

    defmodule MyApp.Riddles do
      use Cite.Policy

      concern :riddle do
        detect do
          question "Does {passage} pose a riddle?"
          yes "A question asked to be puzzled over."
          no "A plain question, a statement, or a remark."
        end
      end
    end

Declarations: `filter`, `concern` (with `category`, `detect`, `confirm`,
`role`, `check`), `factor`, `score`, `choice`. Every mistake is a compile
error. [Writing policies](writing-policies.html) explains the language.
The reference below, generated from the DSL, lists every declaration's
arguments, options, and defaults, with required ones starred.

## policy
What the source is judged against.

### Nested DSLs
 * [filter](#module-policy-filter)
   * yes
   * no
 * [concern](#module-policy-concern)
   * detect
     * yes
     * no
   * confirm
     * yes
     * no
   * role
   * check
     * yes
     * no
 * [factor](#module-policy-factor)
   * yes
   * no
 * [score](#module-policy-score)
 * [choice](#module-policy-choice)
   * option

### policy.filter
```elixir
filter name
```

A yes/no question every evidence passage must pass.

### Nested DSLs
 * [yes](#module-policy-filter-yes)
 * [no](#module-policy-filter-no)

### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`name`](#policy-filter-name){: #policy-filter-name .spark-required} | `atom` |  | The name. |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`question`](#policy-filter-question){: #policy-filter-question .spark-required} | `String.t` |  | The question, naming what it reads by placeholder. |
| [`focus`](#policy-filter-focus){: #policy-filter-focus } | `String.t` |  | One line on what to attend to. |

### policy.filter.yes
```elixir
yes what \\ nil
```

What makes the answer yes: a string, or a block with `what`, `not_for`, `examples`.

### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`what`](#policy-filter-yes-what){: #policy-filter-yes-what .spark-required} | `String.t` |  | What qualifies for this side. |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`not_for`](#policy-filter-yes-not_for){: #policy-filter-yes-not_for } | `String.t` |  | What a reading of `what` might wrongly include. |
| [`examples`](#policy-filter-yes-examples){: #policy-filter-yes-examples } | `list(String.t)` |  | Short phrasings that qualify. |

### policy.filter.no
```elixir
no what \\ nil
```

What makes the answer no: a string, or a block with `what`, `not_for`, `examples`.

### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`what`](#policy-filter-no-what){: #policy-filter-no-what .spark-required} | `String.t` |  | What qualifies for this side. |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`not_for`](#policy-filter-no-not_for){: #policy-filter-no-not_for } | `String.t` |  | What a reading of `what` might wrongly include. |
| [`examples`](#policy-filter-no-examples){: #policy-filter-no-examples } | `list(String.t)` |  | Short phrasings that qualify. |

### policy.concern
```elixir
concern name
```

One kind of thing you want found: screened directly, or built from factors.

### Nested DSLs
 * [detect](#module-policy-concern-detect)
   * yes
   * no
 * [confirm](#module-policy-concern-confirm)
   * yes
   * no
 * [role](#module-policy-concern-role)
 * [check](#module-policy-concern-check)
   * yes
   * no

### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`name`](#policy-concern-name){: #policy-concern-name .spark-required} | `atom` |  | The name. |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`category`](#policy-concern-category){: #policy-concern-category } | `atom` |  | What the finding is reported as. |

### policy.concern.detect

The concern's round-1 question, asked of every passage.

### Nested DSLs
 * [yes](#module-policy-concern-detect-yes)
 * [no](#module-policy-concern-detect-no)

### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`question`](#policy-concern-detect-question){: #policy-concern-detect-question .spark-required} | `String.t` |  | The question, naming what it reads by placeholder. |
| [`focus`](#policy-concern-detect-focus){: #policy-concern-detect-focus } | `String.t` |  | One line on what to attend to. |

### policy.concern.detect.yes
```elixir
yes what \\ nil
```

What makes the answer yes: a string, or a block with `what`, `not_for`, `examples`.

### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`what`](#policy-concern-detect-yes-what){: #policy-concern-detect-yes-what .spark-required} | `String.t` |  | What qualifies for this side. |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`not_for`](#policy-concern-detect-yes-not_for){: #policy-concern-detect-yes-not_for } | `String.t` |  | What a reading of `what` might wrongly include. |
| [`examples`](#policy-concern-detect-yes-examples){: #policy-concern-detect-yes-examples } | `list(String.t)` |  | Short phrasings that qualify. |

### policy.concern.detect.no
```elixir
no what \\ nil
```

What makes the answer no: a string, or a block with `what`, `not_for`, `examples`.

### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`what`](#policy-concern-detect-no-what){: #policy-concern-detect-no-what .spark-required} | `String.t` |  | What qualifies for this side. |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`not_for`](#policy-concern-detect-no-not_for){: #policy-concern-detect-no-not_for } | `String.t` |  | What a reading of `what` might wrongly include. |
| [`examples`](#policy-concern-detect-no-examples){: #policy-concern-detect-no-examples } | `list(String.t)` |  | Short phrasings that qualify. |

### policy.concern.confirm

The concern's round-2 question, deciding which matched passages are cited.

### Nested DSLs
 * [yes](#module-policy-concern-confirm-yes)
 * [no](#module-policy-concern-confirm-no)

### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`question`](#policy-concern-confirm-question){: #policy-concern-confirm-question .spark-required} | `String.t` |  | The question, naming what it reads by placeholder. |
| [`focus`](#policy-concern-confirm-focus){: #policy-concern-confirm-focus } | `String.t` |  | One line on what to attend to. |

### policy.concern.confirm.yes
```elixir
yes what \\ nil
```

What makes the answer yes: a string, or a block with `what`, `not_for`, `examples`.

### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`what`](#policy-concern-confirm-yes-what){: #policy-concern-confirm-yes-what .spark-required} | `String.t` |  | What qualifies for this side. |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`not_for`](#policy-concern-confirm-yes-not_for){: #policy-concern-confirm-yes-not_for } | `String.t` |  | What a reading of `what` might wrongly include. |
| [`examples`](#policy-concern-confirm-yes-examples){: #policy-concern-confirm-yes-examples } | `list(String.t)` |  | Short phrasings that qualify. |

### policy.concern.confirm.no
```elixir
no what \\ nil
```

What makes the answer no: a string, or a block with `what`, `not_for`, `examples`.

### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`what`](#policy-concern-confirm-no-what){: #policy-concern-confirm-no-what .spark-required} | `String.t` |  | What qualifies for this side. |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`not_for`](#policy-concern-confirm-no-not_for){: #policy-concern-confirm-no-not_for } | `String.t` |  | What a reading of `what` might wrongly include. |
| [`examples`](#policy-concern-confirm-no-examples){: #policy-concern-confirm-no-examples } | `list(String.t)` |  | Short phrasings that qualify. |

### policy.concern.role
```elixir
role name
```

A role in a concern built from factors, filled by a factor's strongest match.

### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`name`](#policy-concern-role-name){: #policy-concern-role-name .spark-required} | `atom` |  | The name. |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`factor`](#policy-concern-role-factor){: #policy-concern-role-factor .spark-required} | `atom` |  | The factor that fills the role. |
| [`optional`](#policy-concern-role-optional){: #policy-concern-role-optional } | `boolean` | `false` | The finding may stand without it. |
| [`distinct`](#policy-concern-role-distinct){: #policy-concern-role-distinct } | `boolean` | `false` | It must be a passage no other role holds. |

### policy.concern.check
```elixir
check name
```

A yes/no question across a concern's roles that decides whether it holds.

### Nested DSLs
 * [yes](#module-policy-concern-check-yes)
 * [no](#module-policy-concern-check-no)

### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`name`](#policy-concern-check-name){: #policy-concern-check-name .spark-required} | `atom` |  | The name. |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`question`](#policy-concern-check-question){: #policy-concern-check-question .spark-required} | `String.t` |  | The question, naming what it reads by placeholder. |
| [`focus`](#policy-concern-check-focus){: #policy-concern-check-focus } | `String.t` |  | One line on what to attend to. |
| [`distinct`](#policy-concern-check-distinct){: #policy-concern-check-distinct } | `boolean` | `false` | Ask only when the named roles are different passages. |

### policy.concern.check.yes
```elixir
yes what \\ nil
```

What makes the answer yes: a string, or a block with `what`, `not_for`, `examples`.

### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`what`](#policy-concern-check-yes-what){: #policy-concern-check-yes-what .spark-required} | `String.t` |  | What qualifies for this side. |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`not_for`](#policy-concern-check-yes-not_for){: #policy-concern-check-yes-not_for } | `String.t` |  | What a reading of `what` might wrongly include. |
| [`examples`](#policy-concern-check-yes-examples){: #policy-concern-check-yes-examples } | `list(String.t)` |  | Short phrasings that qualify. |

### policy.concern.check.no
```elixir
no what \\ nil
```

What makes the answer no: a string, or a block with `what`, `not_for`, `examples`.

### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`what`](#policy-concern-check-no-what){: #policy-concern-check-no-what .spark-required} | `String.t` |  | What qualifies for this side. |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`not_for`](#policy-concern-check-no-not_for){: #policy-concern-check-no-not_for } | `String.t` |  | What a reading of `what` might wrongly include. |
| [`examples`](#policy-concern-check-no-examples){: #policy-concern-check-no-examples } | `list(String.t)` |  | Short phrasings that qualify. |

### policy.factor
```elixir
factor name
```

A yes/no question that fills a role in a concern built from factors.

### Nested DSLs
 * [yes](#module-policy-factor-yes)
 * [no](#module-policy-factor-no)

### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`name`](#policy-factor-name){: #policy-factor-name .spark-required} | `atom` |  | The name. |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`question`](#policy-factor-question){: #policy-factor-question .spark-required} | `String.t` |  | The question, naming what it reads by placeholder. |
| [`focus`](#policy-factor-focus){: #policy-factor-focus } | `String.t` |  | One line on what to attend to. |

### policy.factor.yes
```elixir
yes what \\ nil
```

What makes the answer yes: a string, or a block with `what`, `not_for`, `examples`.

### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`what`](#policy-factor-yes-what){: #policy-factor-yes-what .spark-required} | `String.t` |  | What qualifies for this side. |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`not_for`](#policy-factor-yes-not_for){: #policy-factor-yes-not_for } | `String.t` |  | What a reading of `what` might wrongly include. |
| [`examples`](#policy-factor-yes-examples){: #policy-factor-yes-examples } | `list(String.t)` |  | Short phrasings that qualify. |

### policy.factor.no
```elixir
no what \\ nil
```

What makes the answer no: a string, or a block with `what`, `not_for`, `examples`.

### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`what`](#policy-factor-no-what){: #policy-factor-no-what .spark-required} | `String.t` |  | What qualifies for this side. |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`not_for`](#policy-factor-no-not_for){: #policy-factor-no-not_for } | `String.t` |  | What a reading of `what` might wrongly include. |
| [`examples`](#policy-factor-no-examples){: #policy-factor-no-examples } | `list(String.t)` |  | Short phrasings that qualify. |

### policy.score
```elixir
score name
```

A descriptor that places each finding on ordered levels.

### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`name`](#policy-score-name){: #policy-score-name .spark-required} | `atom` |  | The name. |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`question`](#policy-score-question){: #policy-score-question .spark-required} | `String.t` |  | The question, naming what it reads by placeholder. |
| [`levels`](#policy-score-levels){: #policy-score-levels .spark-required} | `list(String.t)` |  | The levels, lowest first. |
| [`focus`](#policy-score-focus){: #policy-score-focus } | `String.t` |  | One line on what to attend to. |

### policy.choice
```elixir
choice name
```

A descriptor that picks one option for each finding.

### Nested DSLs
 * [option](#module-policy-choice-option)

### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`name`](#policy-choice-name){: #policy-choice-name .spark-required} | `atom` |  | The name. |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`question`](#policy-choice-question){: #policy-choice-question .spark-required} | `String.t` |  | The question, naming what it reads by placeholder. |
| [`focus`](#policy-choice-focus){: #policy-choice-focus } | `String.t` |  | One line on what to attend to. |

### policy.choice.option
```elixir
option key, description
```

One option of a Choice.

### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`key`](#policy-choice-option-key){: #policy-choice-option-key .spark-required} | `atom` |  | The option's key. |
| [`description`](#policy-choice-option-description){: #policy-choice-option-description .spark-required} | `String.t` |  | What the option means. |

### Options

* `:extensions` (list of module that adopts `Spark.Dsl.Extension`) - A list of DSL extensions to add to the `Spark.Dsl`

* `:otp_app` (`t:atom/0`) - The otp_app to use for any application configurable options

* `:fragments` (list of `t:module/0`) - Fragments to include in the `Spark.Dsl`. See the fragments guide for more.

---

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