# integrations.ccflow.ValidationModel

Run a composed validation as a ccflow model.

Usage

[Source](https://github.com/posit-dev/pointblank/blob/main/pointblank/integrations/ccflow.py#L34-L131)

``` python
integrations.ccflow.ValidationModel()
```

[ccflow](https://github.com/Point72/ccflow) is a framework for configuring and running workflows, in which each unit of work is a model that's called with a context and returns a result. A [ValidationModel](../reference/integrations.ccflow.ValidationModel.md#pointblank.integrations.ccflow.ValidationModel) is such a model for a Pointblank validation: calling it composes a YAML configuration with [`hydra_interrogate()`](../reference/hydra_interrogate.md#pointblank.hydra_interrogate) and returns the interrogated validation. It can be put in a ccflow model registry and run with the rest of a flow.

## Parameters

`config`  
The path to a YAML file to compose. Without a file, the configuration is made up of the config group options selected in `overrides=`.

`overrides`  
Hydra overrides, such as `"pointblank/thresholds=strict"` to select a config group option or `"thresholds.warning=0.2"` to set a value.

`config_dir`  
A directory of config groups to add to the search path.

`allow_python`  
Whether to run the Python code in the configuration: the code of `python:` blocks (see [`yaml_interrogate()`](../reference/yaml_interrogate.md#pointblank.yaml_interrogate)), and the mappings with a `_target_` key, which are made into the Python objects they describe. Only set it for configurations that you trust.

## Returns

`ValidationModel`  
A model that returns a [`ValidationResult`](../reference/integrations.ccflow.ValidationResult.md#pointblank.integrations.ccflow.ValidationResult) when it's called with a `ccflow.NullContext`.

## Examples

Let's write a configuration that selects the `small_table` dataset and the `strict` thresholds (both come with Pointblank), and make a model for it.

``` python
import tempfile
from pathlib import Path

from ccflow import NullContext
from pointblank.integrations.ccflow import ValidationModel

config = Path(tempfile.mkdtemp()) / "small_table.yaml"
config.write_text('''
defaults:
- override /pointblank/tbl: small_table
- override /pointblank/thresholds: strict
- _self_

steps:
- rows_distinct
- col_vals_gt:
    columns: d
    value: 100
''')

model = ValidationModel(config=config)
result = model(NullContext())

result.all_passed
```

    False

The result has the interrogated validation:

``` python
result.validation
```

[TABLE]

The `rows_distinct` step fails for the duplicate rows of `small_table`, which is why `all_passed` is `False`.
