# items

## Definition

In a config modifier schema, use `items` to:

- modify an array size
- omit existing information
- add new information

> **Exclusive keywords**
>
> If `properties`, `if`, `concat`,  `switch`, `pipe`, `merge`, `prefer`, or `items` are present at the same nesting level, only the first keyword listed will run. We recommend not listing these keywords together at the same nesting level. 

## Order of execution

This keyword executes in the following order: 

1. `omit`
2. `constant`
3. `references`
4. `use`
5. `get`
6. Mutually exclusive keywords at this level:
   - `properties` 
   - `if` 
   - `concat` 
   - `switch` 
   - `pipe` 
   - `merge` 
   - `prefer` 
   - **`items`**
7. `default`
8. `plugin`

## Example

Let’s say you want to modify the `Observations` array in a Flowsheet based on the `Code`. More specifically, you can remove an observation if it matches one of the specified `Code`s. 

If you need to modify the contents of existing items in an array _and_ change the array size, it’s best to do so with one config modifier rather than separate config modifiers (i.e., don’t create `$.Observation[*].Value`; add the change in the config modifier below).

**Example: Items input from initial payload**

```json
{
  "Observations": [
  {
    "AbnormalFlag": null,
    "Code": "GAD2T",
    "Codeset": "NFOBS",
    "DateTime": "2026-02-23T23:51:16.601239",
    "Description": "Generalized Anxiety Disorder - 2 (Screener)",
    "Notes": [
    ],
    "Observer": {
      "FirstName": null,
      "ID": null,
      "IDType": null,
      "LastName": null
    },
    "ReferenceRange": {
      "High": null,
      "Low": null,
      "Text": null
    },
    "Status": null,
    "Units": null,
    "Value": "GAD-2 (Screener)",
    "ValueType": "String"
  },
  {
    "AbnormalFlag": null,
    "Code": "GAD2T-Score",
    "Codeset": "NFOBS",
    "DateTime": "2026-02-23T23:51:16.601239",
    "Description": "Total Score (GAD-2)",
    "Notes": [
    ],
    "Observer": {
      "FirstName": null,
      "ID": null,
      "IDType": null,
      "LastName": null
    },
    "ReferenceRange": {
      "High": null,
      "Low": null,
      "Text": null
    },
    "Status": null,
    "Units": null,
    "Value": "1",
    "ValueType": "Numeric"
  },
  {
    "AbnormalFlag": null,
    "Code": "69725-0",
    "Codeset": "LOINC",
    "DateTime": "2026-02-23T23:51:16.601239",
    "Description": "Feeling nervous, anxious, or on edge",
    "Extensions": {
      "value-codedentry": {
        "coding": {
          "code": "LA6569-3",
          "display": "Several days",
          "system": "http://loinc.org"
        },
        "url": "https://api.redoxengine.com/extensions/value-codedentry"
      }
    },
    "Notes": [
      "LA6569-3"
    ],
    "Observer": {
      "FirstName": null,
      "ID": null,
      "IDType": null,
      "LastName": null
    },
    "ReferenceRange": {
      "High": null,
      "Low": null,
      "Text": null
    },
    "Status": null,
    "Units": null,
    "Value": "1",
    "ValueType": "Numeric"
  },
  {
    "AbnormalFlag": null,
    "Code": "68509-9",
    "Codeset": "LOINC",
    "DateTime": "2026-02-23T23:51:16.601239",
    "Description": "Not being able to stop or control worrying",
    "Extensions": {
      "value-codedentry": {
        "coding": {
          "code": "LA6568-5",
          "display": "Not at all",
          "system": "http://loinc.org"
        },
        "url": "https://api.redoxengine.com/extensions/value-codedentry"
      }
    },
    "Notes": [
      "LA6568-5"
    ],
    "Observer": {
      "FirstName": null,
      "ID": null,
      "IDType": null,
      "LastName": null
    },
    "ReferenceRange": {
      "High": null,
      "Low": null,
      "Text": null
    },
    "Status": null,
    "Units": null,
    "Value": "0",
    "ValueType": "Numeric"
  }
]
}
```

**Example: Items selector**

```json
$.Observations
```

**Example: Config modifier with items keyword**

```yaml
items:
  if:
    operator: includes
    terms:
      - concat:
          - constant: 69737-5
          - constant: 70274-6
          - constant: 71354-5
          - constant: 99046-5
          - constant: 44249-1
          - constant: 55757-9
          - constant: 44261-6
          - constant: 55758-7
          - constant: GAD2T-SCORE
          - constant: GAD2T-Score
          - constant: GAD2T
          - constant: 93373-9
          - constant: 93374-7
          - constant: 72110-0
          - constant: 75624-7
          - constant: 82666-9
          - constant: 82667-7
          - constant: 99549-8
          - constant: 101698-9
          - constant: 101697-1
          - constant: 102010-6
          - constant: 102017-1
          - constant: 106418-7
          - constant: 106421-1
          - constant: 72110-0
          - constant: 72109-2
          - constant: 75626-2
      - get: Code
    then:
      omit: true
    else: {}
```

Based on this example config modifier schema, this is the output.

**Example: Items output in processed payload**

```json
{
  "Observations": [
  {
    "AbnormalFlag": null,
    "Code": "69725-0",
    "Codeset": "LOINC",
    "DateTime": "2026-02-23T23:51:16.601239",
    "Description": "Feeling nervous, anxious, or on edge",
    "Extensions": {
      "value-codedentry": {
        "coding": {
          "code": "LA6569-3",
          "display": "Several days",
          "system": "http://loinc.org"
        },
        "url": "https://api.redoxengine.com/extensions/value-codedentry"
      }
    },
    "Notes": [
      "LA6569-3"
    ],
    "Observer": {
      "FirstName": null,
      "ID": null,
      "IDType": null,
      "LastName": null
    },
    "ReferenceRange": {
      "High": null,
      "Low": null,
      "Text": null
    },
    "Status": null,
    "Units": null,
    "Value": "1",
    "ValueType": "Numeric"
  },
  {
    "AbnormalFlag": null,
    "Code": "68509-9",
    "Codeset": "LOINC",
    "DateTime": "2026-02-23T23:51:16.601239",
    "Description": "Not being able to stop or control worrying",
    "Extensions": {
      "value-codedentry": {
        "coding": {
          "code": "LA6568-5",
          "display": "Not at all",
          "system": "http://loinc.org"
        },
        "url": "https://api.redoxengine.com/extensions/value-codedentry"
      }
    },
    "Notes": [
      "LA6568-5"
    ],
    "Observer": {
      "FirstName": null,
      "ID": null,
      "IDType": null,
      "LastName": null
    },
    "ReferenceRange": {
      "High": null,
      "Low": null,
      "Text": null
    },
    "Status": null,
    "Units": null,
    "Value": "0",
    "ValueType": "Numeric"
  }
]
}
```
