A simple CKAN extension to validate tabular data powered by frictionless data.
Compatibility with core CKAN versions:
| CKAN version | Compatible? |
|---|---|
| 2.10 | not tested |
| 2.11 | yes |
To install ckanext-validate:
-
Activate your CKAN virtual environment, for example:
. /usr/lib/ckan/default/bin/activate
-
Clone the source and install it on the virtualenv
git clone https://github.com/okfn/ckanext-validate.git cd ckanext-validate pip install -e . pip install -r requirements.txt
-
Add
validateto theckan.pluginssetting in your CKAN config file (by default the config file is located at/etc/ckan/default/ckan.ini). -
Run the database migration to create the
resource_validationtable:ckan db upgrade -p validate
-
Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:
sudo service apache2 reload
Only CSV resources can be validated. Each validation run is stored as a new row in resource_validation — previous results are not overwritten, so a full history is kept. In addition to the dedicated table, the resource extras (validation_status, validation_error_count, validation_errors) are also updated for backwards compatibility.
Validates a CSV resource using Frictionless and persists the result.
Permissions: requires resource_update on the resource.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
id |
string | yes | The resource id |
Example:
curl -X POST \
-H "Authorization: <your-api-token>" \
-H "Content-Type: application/json" \
-d '{"id": "<resource-id>"}' \
"http://localhost:5000/api/3/action/resource_validate"Response: the updated resource dict with validation_status and validation_error_count fields.
Returns the latest validation result for a given resource.
Permissions: public for any user who can view the resource.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
id |
string | yes | The resource id |
Example:
curl -X POST \
-H "Authorization: <your-api-token>" \
-H "Content-Type: application/json" \
-d '{"id": "<resource-id>"}' \
"http://localhost:5000/api/3/action/resource_validation_show"Response:
{
"success": true,
"result": {
"id": 1,
"resource_id": "<resource-id>",
"status": "failure",
"error_count": 2,
"errors": [
{
"row": 5,
"field": "date",
"message": "Type error in the cell \"abc\" in row \"5\" and field \"date\""
}
],
"created": "2026-03-19T14:50:32.364757"
}
}Raises ObjectNotFound (HTTP 404) if no validation has been run for the resource yet.
| Field | Type | Description |
|---|---|---|
id |
integer | Auto-incremented primary key |
resource_id |
string | CKAN resource UUID |
status |
string | "success" or "failure" |
error_count |
integer | Number of validation errors found |
errors |
list | List of error objects with row, field, message |
created |
string | ISO 8601 UTC timestamp of when the run occurred |
None at present
TODO: Document any optional config settings here. For example:
# The minimum number of hours to wait before re-checking a resource
# (optional, default: 24).
ckanext.validate.some_setting = some_default_value
To install ckanext-validate for development, activate your CKAN virtualenv and do:
git clone https://github.com/okfn/ckanext-validate.git
cd ckanext-validate
pip install -e .
pip install -r dev-requirements.txt
To run the tests, do:
pytest --ckan-ini=test.ini