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

# Conditional Logic

> How enrollment flags and demographics determine which records and fields are required

CoBHRM uses enrollment flags and demographic data on the Admission and Client records to determine which child records and fields are required. This page documents every conditional trigger in the model.

## Survey Trigger Rules

The Admission record contains enrollment flag fields. When set to `1` (true), they trigger the requirement for additional survey records.

| Flag Field | When Set to `1` | Required Record |
| - | - | - |
| `SPECIAL_CONNECTIONS_ENROLLMENT` | Pregnant or postpartum and enrolled in Special Connections | Pregnancy Risk Screening (PRS) |
| `ACT_ENROLLMENT` | Client is in Assertive Community Treatment | ACT Survey (ACT) |
| `ASCENT_ENROLLMENT` | Client is in First Episode Psychosis program | Ascent Survey (ASA/ASQ/ASD) |

> [!NOTE]
>
> Baby Data (BAB) is required when a birth occurs during a Special Connections enrollment. There is no separate flag -- it is submitted per birth event.

### Records Required for All Admissions

Regardless of enrollment flags, **every admission** requires:

| Record | When | Description |
| - | - | - |
| Diagnosis at Admission (DXA) | At admission | At least one MH diagnosis and/or one SUD diagnosis |
| Diagnosis at Discharge (DXD) | At discharge | Same structure, reflecting status at discharge |
| Discharge (DIS) | At episode end | Treatment episode closure. Providers do not need to wait for discharge before submitting other CoBHRM records |

### Records Required for SUD and Co-Occurring Admissions

The following are required only when the Service Identifier indicates a Substance Use or co-occurring admission. They are **not allowed** for mental health-only records.

| Record | When | Description |
| - | - | - |
| SUD Survey at Admission (SIA) | At admission | Substance use details |
| SUD Survey at Discharge (SID) | At discharge | Updated substance use details |

> [!WARNING]
>
> Primary, secondary, and tertiary substance types at discharge must match those at admission. If they differ, the admission SUD Survey record must be updated before proceeding with discharge.

## Special Connections Decision Tree

The Special Connections program enrollment follows a specific decision tree based on demographic data.

**1. Check Sex at Birth**

Is `SEX_AT_BIRTH` = Female (`01`)?

* **No**: Set `PREGNANCY_STATUS = 0`, `WITHIN_1_YEAR_POSTPARTUM_STATUS = 0`, `SPECIAL_CONNECTIONS_ENROLLMENT = 0`. No further checks needed.
* **Yes**: Continue to next step.

**2. Check Age Range**

For `PREGNANCY_STATUS`: Is the client between 12 and 55 years old (based on DOB)?
For `WITHIN_1_YEAR_POSTPARTUM_STATUS`: Is the client 12 or older (no upper age limit)?

* **No to both**: Set `PREGNANCY_STATUS = 0`, `WITHIN_1_YEAR_POSTPARTUM_STATUS = 0`, `SPECIAL_CONNECTIONS_ENROLLMENT = 0`. No further checks needed.
* **Yes**: Continue to next step.

**3. Determine Pregnancy or Postpartum Status**

Is the client currently pregnant?

* **Yes**: Set `PREGNANCY_STATUS = 1`. Proceed to SC enrollment check.
* **No**: Is the client within 1 year postpartum? If yes, set `WITHIN_1_YEAR_POSTPARTUM_STATUS = 1`. Proceed to SC enrollment check. If no, set both to `0`.

**4. Set Special Connections Enrollment**

If `PREGNANCY_STATUS = 1` or `WITHIN_1_YEAR_POSTPARTUM_STATUS = 1`, the client **must** be enrolled in Special Connections:

* Set `SPECIAL_CONNECTIONS_ENROLLMENT = 1`
* **Pregnancy Risk Screening (PRS) record is required**

## Conditional Fields by Record Type

### Client Record

| Field | Condition | Rule |
| - | - | - |
| `VERATO_IDENTIFIER` | Existing client with BHA-supplied ID | Required for existing clients; blank for new clients |
| `ZIPCODE_RESIDENCE` | County is not `77` or `99` | Required if county is a Colorado county |
| `TRAILS_IDENTIFIER` | `CHILD_WELFARE_INVOLVEMENT = 1` | Required if child welfare is involved |
| `RAE_REGION` | Any part of treatment paid by Medicaid | Required |

### Admission Record

| Field | Condition | Rule |
| - | - | - |
| `INVOLUNTARY_REASON` | Legal Status in (`04`, `05`, `06`, `07`, `09`) | Required for involuntary commitment types |
| `COMMUNICATION_ACCOMMODATIONS` | Disability includes Deaf/Hearing Loss or Blind/Vision Loss, or Household Language is not English | Required if client cannot speak English, is deaf, or is blind |

### Discharge Record

| Field | Condition | Rule |
| - | - | - |
| `END_OF_TREATMENT_REASON` | `DISCHARGE_STATUS = 03` (Treatment Not Completed At This Facility) | Required if treatment not completed at this facility |

### SUD Survey

| Field | Condition | Rule |
| - | - | - |
| `ASAM_LEVEL_OF_CARE` | Non-DUI SUD service | Required |
| `PRIMARY_LAST_USED_30_DAYS` | Primary Substance is not `00` (None) | Required |
| `PRIMARY_ROUTE_OF_USE` | Primary Substance is not `00` and Record Type = `SIA` | Required at admission only |
| `PRIMARY_START_AGE` | Primary Substance is not `00` and Record Type = `SIA` | Required at admission only |

> [!NOTE]
>
> The same conditional pattern applies to Secondary and Tertiary substance fields. If a substance is reported (not `00`), the number of days used in the last 30 days is required at both admission and discharge, and the associated route of use and start age fields are required at admission.

### Ascent Survey

| Field | Condition | Rule |
| - | - | - |
| `REFERRAL_SOURCE` | Record Type = `ASA` (admission) | Required at admission only |
| `PRIOR_SUICIDE_ATTEMPTS` | Record Type = `ASA` | Required at admission only |
| `DISCHARGE_DATE` | Record Type = `ASD` (discharge) | Required at discharge only |
| `DISCHARGE_OUTCOME` | Record Type = `ASD` | Required at discharge only |

### ACT Survey

| Field | Condition | Rule |
| - | - | - |
| `ACT_DISCHARGE_OUTCOME` | `ACT_DISCHARGE_DATE` is not null | Required when discharge date is present |

### Pregnancy Risk Screening

| Field | Condition | Rule |
| - | - | - |
| `CHILDREN_AGES_LIVING_WITH_CLIENT` | `CHILDREN_LIVING_WITH_CLIENT = 1` | Required if children live at home |

### Baby Data

| Field | Condition | Rule |
| - | - | - |
| `DOB`, `WEIGHT_LBS`, `WEIGHT_OZ`, `LAST_NAME`, `FIRST_NAME`, `SEX_AT_BIRTH` | `LIVE_BIRTH = 1` | All required if live birth |

## Cross-Record Validation Rules

In addition to field-level conditions, CoBHRM enforces rules that span multiple record types.

### Identifier Linking

* Every Admission must reference a valid `BHASO_CLIENT_IDENTIFIER` that exists in the Client table
* Every child record must reference a valid `BHASO_ADMISSION_IDENTIFIER` that exists in the Admission table

### Diagnosis Pairing

* Every completed admission requires both a `DXA` (admission) and `DXD` (discharge) diagnosis record
* Both reference the same `BHASO_ADMISSION_IDENTIFIER`

### SUD Survey Pairing

* Every SUD or co-occurring admission requires both an `SIA` (admission) and `SID` (discharge) substance use record
* SIA/SID are not allowed for mental health-only admissions
* Both reference the same `BHASO_ADMISSION_IDENTIFIER`

### Pregnancy / Postpartum Logic Chain

This logic chain spans Client, Admission, Pregnancy Risk Screening, and Baby Data:

**1. Client: Sex at Birth**

`SEX_AT_BIRTH` on the Client record determines eligibility

**2. Admission: Pregnancy Status**

If Female (`01`) and age 12-55, `PREGNANCY_STATUS` is collected on the Admission

**3. Admission: Postpartum Status**

If not pregnant, `WITHIN_1_YEAR_POSTPARTUM_STATUS` may be collected

**4. Admission: SC Enrollment**

If pregnant or postpartum, `SPECIAL_CONNECTIONS_ENROLLMENT` should be `1`

**5. PRS Record Required**

If SC enrolled, a Pregnancy Risk Screening (PRS) record is required

**6. Baby Data on Birth**

If a birth occurs during SC enrollment, a Baby Data (BAB) record is required

### Legal Status / Service Identifier Cross-Validation

> [!WARNING]
>
> **Pending update:** Both the Legal Status codes and Service Identifier codes have been renumbered. The matrix below references the previous numbering and is expected to be replaced before April 1, 2026 once the new mapping is finalized.

At Discharge, the Legal Status must be compatible with the Admission's Service Identifier:

| Legal Status | Allowed Service Identifiers | Service Category |
| - | - | - |
| `13` (Emergency Commitment) | `01`, `02`, `12` | Withdrawal Management |
| `08` (Involuntary Alcohol/Drug Commitment) | `03`-`11` | SUD Services |
| `02`-`07`, `09`-`12` | `17`-`22` | Mental Health Services |
| `01` (Voluntary) | Any | No restriction |

See [Cross-Tab Dependencies](https://coloradobehavioralhealthadministration.mintlify.site/reference/cross-tab-dependencies.md) for the full referential integrity rules.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.