# Search Patients or Episodes

> Perform Search Patients or Episodes through CareWebQI.

Source: [https://genhealth.ai/docs/workflows/integrations/care-web-qi/carewebqi_search](https://genhealth.ai/docs/workflows/integrations/care-web-qi/carewebqi_search)

Integration: [CareWebQI](https://genhealth.ai/docs/workflows/integrations/care-web-qi.md)

- Handler: `carewebqi_search`

- Connection type: `carewebqi`

## Inputs

- `search_by` — Search By (select, required)
  Required selected identifier or value.
  Default: `"episode"`
  Options: Patient ("patient"), Episode ("episode")
- `search_text` — Search Text (expression, required)
  Required literal value or workflow expression.
- `include_discharged` — Include Discharged (boolean)
  Optional true-or-false value.
  Default: `false`

## Outputs

- `success` — Success
- `search_by` — Search By
- `search_text` — Search Text
- `found` — Found
- `match_count` — Match Count
- `single_match` — Single Match
- `ambiguous` — Ambiguous
- `patients` — Patients
- `episodes` — Episodes
- `episode_id` — Episode Id
- `patient_id` — Patient Id
- `patient_id_truncated` — Patient Id Truncated
- `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": [
    "search_by",
    "search_text"
  ],
  "properties": {
    "search_by": {
      "enum": [
        "patient",
        "episode"
      ],
      "type": "string",
      "default": "episode",
      "description": "Required selected identifier or value.",
      "x-workflow-field-type": "select"
    },
    "search_text": {
      "description": "Required literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "include_discharged": {
      "type": "boolean",
      "default": false,
      "description": "Optional true-or-false value.",
      "x-workflow-field-type": "boolean"
    }
  },
  "additionalProperties": false
}
```

### Output schema

```json
{
  "type": "object",
  "properties": {
    "error": {},
    "found": {},
    "success": {},
    "episodes": {},
    "patients": {},
    "ambiguous": {},
    "search_by": {},
    "episode_id": {},
    "patient_id": {},
    "match_count": {},
    "search_text": {},
    "single_match": {},
    "patient_id_truncated": {}
  },
  "additionalProperties": true
}
```
