> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Decision Tables

> Browse, create, and edit decision tables with a rule grid, test panel, and version history for rule-based workflow logic.

The Decision Tables screen lists all decision tables for the organization with search and filter capabilities and is available at `/fw/decision-tables`.

## Overview

This screen renders a list/table of decision tables loaded via `useDecisionTables`, scoped to the current user's organization. Filters include a text search and a status dropdown (`draft`, `published`, `archived`). Each row shows the table name, hit policy (from `HIT_POLICY_LABELS`), status badge, and a link to the editor. A **New Decision Table** button (gated by `fw.decision_tables.manage` via `PermissionGate`) navigates to `/fw/decision-tables/new`.

## Who it's for

No explicit route-level permission gate. The **New Decision Table** button is gated by `fw.decision_tables.manage` (`FW_PERMISSIONS.DECISION_TABLES_MANAGE`).

* To view decision tables, navigate to `/fw/decision-tables`.
* To create or edit tables, hold `fw.decision_tables.manage`.

## Finding a decision table

1. Navigate to `/fw/decision-tables`.
2. Use the search input and status dropdown to locate a specific table.
3. Click a table name to navigate to `/fw/decision-tables/:id/edit`.
4. Click **New Decision Table** (requires `fw.decision_tables.manage`) to navigate to `/fw/decision-tables/new`.

* **Hit policy** — determines how matching rules are evaluated (e.g., first match vs. all matches); labels sourced from `HIT_POLICY_LABELS`.
* **Decision table status** — `draft`, `published`, or `archived`.

## Creating a decision table

The New Decision Table page opens the Decision Table Editor in creation mode at `/fw/decision-tables/new`. It uses the same `DecisionTableEditorPage` component as the edit route; when no `id` query parameter is present the editor creates a new form on save. Requires `fw.decision_tables.manage`.

Before you start: choose a descriptive name and select the hit policy that matches your rule evaluation strategy before adding rows, as it affects how multiple matching rules are handled.

1. Navigate to `/fw/decision-tables` and select **New Table**, or navigate directly to `/fw/decision-tables/new`.
2. Enter a **Name** (required) and optional **Description** and **Tags** in the Configuration card.
3. Select a **Hit Policy** from the dropdown.
4. Add input and output columns to the rule grid using the `DecisionTableGrid` controls.
5. Define rule rows by filling in condition values for each input column and result values for each output column.
6. Select **Save**. On success the browser redirects to `/fw/decision-tables/:id/edit` and the table status is `draft`.
7. To make the table available for use, select **Publish** and optionally add a change summary in the confirmation dialog.

* **Draft vs. published** — a table starts in `draft` status. Only published tables are available for reference by automations and workflows.
* **Version** — each publish action increments the version number displayed in the editor header.

## Editing a decision table

The Edit Decision Table screen (`/fw/decision-tables/:id/edit`) provides a full editor for a decision table's metadata, rule grid, test panel, and version history. This screen also serves the create flow (when `id === 'new'`, routing from `/fw/decision-tables/new`).

Table metadata (name, description, hit policy) is editable inline. The rule grid (`DecisionTableGrid`) displays input and output columns with editable cells. Four tabs organize the editor: rule grid, test panel (`DecisionTableTestPanel`), version history (`DecisionTableVersionHistory`), and a rule evaluations audit log (`RuleEvaluationsAuditLog`). Actions include save draft, publish (`DecisionTablePublishDialog`), archive, and delete. Edit actions are gated by `fw.decision_tables.manage` (`canManage`).

Requires `fw.decision_tables.manage` to perform edits. Viewing is gated by `fw.decision_tables.view`.

Before you start: hold `fw.decision_tables.manage` to create or edit tables. Access from the Decision Tables list or navigate directly with a valid `id`.

1. Navigate to `/fw/decision-tables/:id/edit` or click a table in the list.
2. Update the table name, description, and hit policy in the header form.
3. Use the rule grid tab to add, edit, or remove input/output columns and rule rows.
4. Switch to the **Test** tab to run test inputs against the current rule set.
5. Click **Save** to store as draft, or **Publish** to make the table active in automations.
6. Switch to the **Version History** tab to view past versions and the audit log.

* **Input columns / Output columns** — structured condition and result definitions for each rule row.
* **Publish** — moves the table from `draft` to `published` status, making it available to automations.

## Related

<Columns cols={2}>
  <Card title="Forms & Workflow" icon="diagram-project" href="/fw/overview">
    Forms & Workflow core overview.
  </Card>

  <Card title="Governance & parity" icon="scale-balanced" href="/governance/index">
    Documentation coverage and governance.
  </Card>
</Columns>

<Note>
  This page documents shipped product behavior. It is not medical, legal, or
  billing advice. Verify against your organization's policies and applicable
  regulations before using it for clinical, compliance, or billing decisions.
  Protected health information (PHI) shown in the product is governed by your
  tenant's access controls and is never exposed in this documentation.
</Note>

<Accordion title="Documentation sources">
  * src/routes/fw\.tsx
  * src/cores/fw/pages/DecisionTableListPage.tsx
  * src/cores/fw/pages/DecisionTableEditorPage.tsx
  * src/cores/fw/hooks/useDecisionTable.ts
  * src/cores/fw/hooks/useDecisionTableMutation.ts
  * src/cores/fw/types/decision-tables.ts
  * src/platform/permissions/constants.ts
</Accordion>
