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

# QA Testing Guide

Use this guide to test your Document Validation integration in our QA environment.
By setting a specially formatted **member number** on a patient plan, you control the validation results Silna returns for the documents you upload to a prior authorization: every rule passes, every rule fails, a realistic mix, or no results.

> [!NOTE]
>
> Test scenarios only run in our QA environment (`api-qa.silnahealth.com`). They are never triggered in production.

## How It Works

The workflow is the same as production (see [Document Validation Overview](https://docs.silnahealth.com/api-reference/v1documentvalidationresource/overview.md)):

1. Create a patient plan with a member number that contains a scenario code (see [Member Number Format](#member-number-format))
2. [Create a prior authorization](https://docs.silnahealth.com/api-reference/v1priorauthorizationresource/create-prior-authorization.md) for that patient plan
3. [Update the prior authorization](https://docs.silnahealth.com/api-reference/v1priorauthorizationresource/update-prior-authorization.md) with documents attached to the document types you want validated
4. Poll [Get Prior Authorization](https://docs.silnahealth.com/api-reference/v1priorauthorizationresource/get-prior-authorization.md) with `with_requirements=true` until the status is `DATA_REQUESTED` or `ALL_REQUIRED_DATA_RECEIVED`
5. Read `required_data.documents[].document_validation_batch` and fetch the rule results with [Get Document Validation Batch](https://docs.silnahealth.com/api-reference/v1documentvalidationbatchresource/get-document-validation-batch.md)

When a scenario code is present, Silna does not read the uploaded files. It returns the scenario's results for the same validation rules that a real validation would run. You can upload any PDF.

The rules come from the payor and provider rule sets for that document type, the same as in production. Document types with no validation rules are not validated.

### What stays the same as production

* The rules that run, their names, and the `reason` text for each rule result
* The prior authorization status after validation: `ALL_REQUIRED_DATA_RECEIVED` when every rule passes, otherwise `DATA_REQUESTED` with `requirement_satisfied: false`
* [Overriding validations](https://docs.silnahealth.com/api-reference/v1documentvalidationresource/overview.md#overriding-validations) with `document_validation.enabled: false` or `skip_document_intelligence: true`

## Member Number Format

Add `DV` followed by a two-digit scenario code anywhere in the member number:

```
A_DV[SCENARIO_CODE]_11
```

This format works with the other QA testing guides too. In `A_PA01_DV02_11`:

* The [Benefits Check QA Testing Guide](https://docs.silnahealth.com/api-reference/v1benefitscheckresource/qa-testing-guide.md) reads the leading `A` and the trailing insurance code (`11`)
* The [Prior Authorization QA Testing Guide](https://docs.silnahealth.com/api-reference/v1priorauthorizationresource/qa-testing-guide.md) reads `PA01`
* Document Validation reads `DV02`

So one test patient plan can drive a benefits check test, document validation results, and a prior authorization outcome.

| Member Number | Scenario |
| - | - |
| `A_DV01_11` | Every rule passes |
| `A_DV02_11` | Every rule fails |
| `A_DV03_11` | Some rules fail |
| `A_PA01_DV01_11` | Every rule passes, then the prior authorization is approved after you complete it |

Member numbers without a `DV` code, or with an unknown code, run a normal document validation.

## Scenarios

| Code | Scenario | `document_validation_batch.result` | Prior Authorization Status |
| - | - | - | - |
| `01` | Every rule passes | `PASSED` | `ALL_REQUIRED_DATA_RECEIVED` |
| `02` | Every rule fails | `FAILED` | `DATA_REQUESTED` |
| `03` | Some rules fail, depending on the document type (see [Mixed results](#mixed-results-03)) | `FAILED` | `DATA_REQUESTED` |
| `04` | Validation produces no rule results | `PASSED`, with empty `passed_rules` and `failed_rules` | `ALL_REQUIRED_DATA_RECEIVED` |

### Mixed results (`03`)

The failing rules depend on the document type, so you see a realistic partial failure:

| Document Type | Failing Rules | All other rules |
| - | - | - |
| `REFERRAL` | `VALID_CLINICIAN_SIGNATURE`, `DOCUMENT_EXPIRED` | Pass |
| `DIAGNOSIS_REPORT` | `DIAGNOSTIC_TOOLS`, `PATIENT_AGE` | Pass |
| Any other document type | The first rule of each validation | Pass |

For example, a `REFERRAL` validated with clinician, time frame, and diagnosis rules returns:

```json theme={null}
{
  "document_type": "REFERRAL",
  "result": "FAILED",
  "document_validations": [
    {
      "result": "FAILED",
      "passed_rules": [],
      "failed_rules": [
        { "rule": "DOCUMENT_EXPIRED", "result": "FAILED", "reason": "The document has expired" }
      ]
    },
    {
      "result": "FAILED",
      "passed_rules": [
        { "rule": "DIAGNOSIS_CODES", "result": "PASSED", "reason": "The diagnosis codes have at least one of F84.0 (ICD_10)" },
        { "rule": "DIAGNOSIS_DATE", "result": "PASSED", "reason": "The diagnosis date is present on the document" }
      ],
      "failed_rules": [
        { "rule": "VALID_CLINICIAN_SIGNATURE", "result": "FAILED", "reason": "The clinician signature is missing from the document" }
      ]
    }
  ]
}
```

### No results (`04`)

Use this scenario to test how your integration handles a validation that produces no rule results. The batch `result` is `PASSED`, each document validation has empty `passed_rules`, `failed_rules`, and `rule_results`, and the prior authorization moves to `ALL_REQUIRED_DATA_RECEIVED`.


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