# Rule-Based Task Router

> Perform Rule-Based Task Router through NikoHealth.

Source: [https://genhealth.ai/docs/workflows/integrations/nikohealth/nikohealth_rule_based_task_router](https://genhealth.ai/docs/workflows/integrations/nikohealth/nikohealth_rule_based_task_router)

Integration: [NikoHealth](https://genhealth.ai/docs/workflows/integrations/nikohealth.md)

- Handler: `nikohealth_rule_based_task_router`

- Connection type: `nikohealth`

## Inputs

- `document_id` — Document Id (expression, required)
  Required literal value or workflow expression.
- `patient_id` — Patient Id (expression)
  Optional literal value or workflow expression.
- `has_patient_data` — Has Patient Data (expression)
  Optional literal value or workflow expression.
- `has_order_data` — Has Order Data (expression)
  Optional literal value or workflow expression.
- `is_new_patient` — Is New Patient (expression)
  Optional literal value or workflow expression.
- `document_type` — Document Type (expression)
  Optional literal value or workflow expression.
- `is_carecentrix` — Is Carecentrix (expression)
  Optional literal value or workflow expression.
- `has_resupply` — Has Resupply (expression)
  Optional literal value or workflow expression.
- `has_pending_authorization` — Has Pending Authorization (expression)
  Optional literal value or workflow expression.
- `referring_provider_name` — Referring Provider Name (expression)
  Optional literal value or workflow expression.
- `ocr_text` — Ocr Text (expression)
  Optional literal value or workflow expression.
- `document_url` — Document Url (expression)
  Optional literal value or workflow expression.
- `enable_strategy_title_triage` — Enable Strategy Title Triage (boolean)
  Optional true-or-false value.
  Default: `false`
- `routing_rules` — Routing Rules (repeatable_group)
  Optional list of structured items.
  - `enabled` — Enabled (boolean)
    Optional true-or-false value.
    Default: `true`
  - `priority` — Priority (text)
    Optional text value.
    Default: `"100"`
  - `name` — Name (text, required)
    Required text value.
  - `condition_flags` — Condition Flags (multi_select)
    Optional list of selected values.
    Options: Has patient data ("has_patient_data"), No patient data ("no_patient_data"), Has order data ("has_order_data"), No order data ("no_order_data"), Supports order tasking ("supports_order_tasking"), Does not support order tasking ("not_supports_order_tasking"), New patient ("is_new_patient"), Existing patient ("is_existing_patient"), Has resupply ("has_resupply"), No resupply ("no_resupply"), Has pending authorization ("has_pending_authorization"), No pending authorization ("no_pending_authorization"), Referral signal ("has_referral_signal"), No referral signal ("no_referral_signal"), WellSky referral ("is_wellsky_referral"), Not WellSky referral ("not_wellsky_referral")
  - `document_types` — Document Types (multi_select)
    Optional list of selected values.
  - `ocr_contains_any` — Ocr Contains Any (multi_select)
    Optional list of selected values.
  - `ocr_contains_all` — Ocr Contains All (multi_select)
    Optional list of selected values.
  - `provider_contains_any` — Provider Contains Any (multi_select)
    Optional list of selected values.
  - `provider_resolution_mode` — Provider Resolution Mode (select)
    Optional selected identifier or value.
    Default: `"configured_terms"`
    Options: Configured provider terms ("configured_terms"), Strategy provider resolver ("strategy_provider_resolver")
  - `custom_context_flags` — Custom Context Flags (multi_select)
    Optional list of selected values.
  - `outcome_action` — Outcome Action (select)
    Optional selected identifier or value.
    Default: `"create_task"`
    Options: Create task ("create_task"), Complete without task ("complete_without_task"), Skip ("skip"), Fail tasking ("fail")
  - `tasking_outcome` — Tasking Outcome (text)
    Optional text value.
  - `task_category_id` — Task Category Id (select, dynamic options)
    Optional selected identifier or value. Retrieve allowed values from the dynamic options endpoint.
  - `task_priority` — Task Priority (select)
    Optional selected identifier or value.
    Default: `"Normal"`
    Options: Normal ("Normal"), Low ("Low"), High ("High")
  - `assignee_ids` — Assignee Ids (multi_select, dynamic options)
    Optional list of selected values. Retrieve allowed values from the dynamic options endpoint.
  - `assignee_ids_manual` — Assignee Ids Manual (expression)
    Optional literal value or workflow expression.
  - `pick_random_assignee` — Pick Random Assignee (boolean)
    Optional true-or-false value.
    Default: `false`
  - `assignee_type` — Assignee Type (select)
    Optional selected identifier or value.
    Default: `"user"`
    Options: User ("user"), Team ("team")
  - `assignee_resolution_mode` — Assignee Resolution Mode (select)
    Optional selected identifier or value.
    Default: `"static"`
    Options: Static assignees ("static"), Latest open task, fallback to assignees ("latest_open_task"), Latest authorization task, fallback to assignees ("latest_authorization_task")
  - `title_template` — Title Template (text)
    Optional text value.
  - `description_template` — Description Template (textarea)
    Optional text value.
  - `attach_patient` — Attach Patient (boolean)
    Optional true-or-false value.
    Default: `true`
  - `attach_legacy_document` — Attach Legacy Document (boolean)
    Optional true-or-false value.
    Default: `true`

## Outputs

- `success` — Success
- `tasking_outcome` — Tasking Outcome
- `task_id` — Task Id
- `idempotent` — Idempotent
- `matched_rule` — Matched Rule
- `matched_rule_source` — Matched Rule Source
- `document_id` — Document Id
- `document_type` — Document Type
- `is_new_patient` — Is New Patient
- `supports_order_tasking` — Supports Order Tasking
- `custom_context_flags` — Custom Context Flags
- `has_resupply` — Has Resupply
- `has_pending_authorization` — Has Pending Authorization
- `display_name` — Display Name
- `skipped` — Skipped
- `message` — Message
- `error_code` — Error Code
- `error_type` — Error Type
- `error` — Error

Output schema completeness: `best_effort_declared`

## Safety

- External effect: `write`
- Confirmation recommended: no
- Retry safe: no
- Dry run supported: no

## Schemas

These schemas are first-pass authoring guidance. Runtime validation remains authoritative.

### Input schema

```json
{
  "type": "object",
  "required": [
    "document_id"
  ],
  "properties": {
    "ocr_text": {
      "description": "Optional literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "patient_id": {
      "description": "Optional literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "document_id": {
      "description": "Required literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "document_url": {
      "description": "Optional literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "has_resupply": {
      "description": "Optional literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "document_type": {
      "description": "Optional literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "routing_rules": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Required text value.",
            "x-workflow-field-type": "text"
          },
          "enabled": {
            "type": "boolean",
            "default": true,
            "description": "Optional true-or-false value.",
            "x-workflow-field-type": "boolean"
          },
          "priority": {
            "type": "string",
            "default": "100",
            "description": "Optional text value.",
            "x-workflow-field-type": "text"
          },
          "assignee_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Optional list of selected values. Retrieve allowed values from the dynamic options endpoint.",
            "x-dynamic-options": true,
            "x-workflow-field-type": "multi_select"
          },
          "assignee_type": {
            "enum": [
              "user",
              "team"
            ],
            "type": "string",
            "default": "user",
            "description": "Optional selected identifier or value.",
            "x-workflow-field-type": "select"
          },
          "task_priority": {
            "enum": [
              "Normal",
              "Low",
              "High"
            ],
            "type": "string",
            "default": "Normal",
            "description": "Optional selected identifier or value.",
            "x-workflow-field-type": "select"
          },
          "attach_patient": {
            "type": "boolean",
            "default": true,
            "description": "Optional true-or-false value.",
            "x-workflow-field-type": "boolean"
          },
          "document_types": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Optional list of selected values.",
            "x-workflow-field-type": "multi_select"
          },
          "outcome_action": {
            "enum": [
              "create_task",
              "complete_without_task",
              "skip",
              "fail"
            ],
            "type": "string",
            "default": "create_task",
            "description": "Optional selected identifier or value.",
            "x-workflow-field-type": "select"
          },
          "title_template": {
            "type": "string",
            "description": "Optional text value.",
            "x-workflow-field-type": "text"
          },
          "condition_flags": {
            "type": "array",
            "items": {
              "enum": [
                "has_patient_data",
                "no_patient_data",
                "has_order_data",
                "no_order_data",
                "supports_order_tasking",
                "not_supports_order_tasking",
                "is_new_patient",
                "is_existing_patient",
                "has_resupply",
                "no_resupply",
                "has_pending_authorization",
                "no_pending_authorization",
                "has_referral_signal",
                "no_referral_signal",
                "is_wellsky_referral",
                "not_wellsky_referral"
              ],
              "type": "string"
            },
            "description": "Optional list of selected values.",
            "x-workflow-field-type": "multi_select"
          },
          "tasking_outcome": {
            "type": "string",
            "description": "Optional text value.",
            "x-workflow-field-type": "text"
          },
          "ocr_contains_all": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Optional list of selected values.",
            "x-workflow-field-type": "multi_select"
          },
          "ocr_contains_any": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Optional list of selected values.",
            "x-workflow-field-type": "multi_select"
          },
          "task_category_id": {
            "type": "string",
            "description": "Optional selected identifier or value. Retrieve allowed values from the dynamic options endpoint.",
            "x-dynamic-options": true,
            "x-workflow-field-type": "select"
          },
          "assignee_ids_manual": {
            "description": "Optional literal value or workflow expression.",
            "x-workflow-field-type": "expression"
          },
          "custom_context_flags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Optional list of selected values.",
            "x-workflow-field-type": "multi_select"
          },
          "description_template": {
            "type": "string",
            "description": "Optional text value.",
            "x-workflow-field-type": "textarea"
          },
          "pick_random_assignee": {
            "type": "boolean",
            "default": false,
            "description": "Optional true-or-false value.",
            "x-workflow-field-type": "boolean"
          },
          "provider_contains_any": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Optional list of selected values.",
            "x-workflow-field-type": "multi_select"
          },
          "attach_legacy_document": {
            "type": "boolean",
            "default": true,
            "description": "Optional true-or-false value.",
            "x-workflow-field-type": "boolean"
          },
          "assignee_resolution_mode": {
            "enum": [
              "static",
              "latest_open_task",
              "latest_authorization_task"
            ],
            "type": "string",
            "default": "static",
            "description": "Optional selected identifier or value.",
            "x-workflow-field-type": "select"
          },
          "provider_resolution_mode": {
            "enum": [
              "configured_terms",
              "strategy_provider_resolver"
            ],
            "type": "string",
            "default": "configured_terms",
            "description": "Optional selected identifier or value.",
            "x-workflow-field-type": "select"
          }
        },
        "additionalProperties": false
      },
      "description": "Optional list of structured items.",
      "x-workflow-field-type": "repeatable_group"
    },
    "has_order_data": {
      "description": "Optional literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "is_carecentrix": {
      "description": "Optional literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "is_new_patient": {
      "description": "Optional literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "has_patient_data": {
      "description": "Optional literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "referring_provider_name": {
      "description": "Optional literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "has_pending_authorization": {
      "description": "Optional literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "enable_strategy_title_triage": {
      "type": "boolean",
      "default": false,
      "description": "Optional true-or-false value.",
      "x-workflow-field-type": "boolean"
    }
  },
  "additionalProperties": false
}
```

### Output schema

```json
{
  "type": "object",
  "properties": {
    "error": {},
    "message": {},
    "skipped": {},
    "success": {},
    "task_id": {},
    "error_code": {},
    "error_type": {},
    "idempotent": {},
    "document_id": {},
    "display_name": {},
    "has_resupply": {},
    "matched_rule": {},
    "document_type": {},
    "is_new_patient": {},
    "tasking_outcome": {},
    "matched_rule_source": {},
    "custom_context_flags": {},
    "supports_order_tasking": {},
    "has_pending_authorization": {}
  },
  "additionalProperties": true
}
```
