ckan / ckan/ckanext-validation

Support foreign keys property

Open
#84 9 comments 3 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
30
Forks
33
PR merge metrics
No merged PRs in 30d

Description

Context:
- We have multiple CKAN datasets that are composed of a set of resources.
- In each of these datasets, one of these resources is a list of geographical regions.
- All other resources in these datasets include a column for geographical region.
- We want to use the `foreignKeys` prop (https://specs.frictionlessdata.io/table-schema/#foreign-keys) in frictionless to ensure that the choices in said column are present, and only present, in the geographical regions resource.

Good news:
- This is supported upstream by frictionless :tada:

Less good news:
- It requires treating two tables and two schemas as one Data Package

Idea No. 1:
- One way to implement this is that the ckanext-validation could check schemas for `foreignKeys` and, if found, bundle both tables and both Table Schemas and send it all to frictionless's `validate` with `type=package`, e.g. we could have a `_validate_data_package` to match https://github.com/frictionlessdata/ckanext-validation/blob/9c23581d34289536139cc81f7b7ddb756dab64f6/ckanext/validation/jobs.py#L139

Idea No. 2:
- An alternative is to have an entirely parallel set of package actions, e.g. https://github.com/frictionlessdata/ckanext-validation/blob/9c23581d34289536139cc81f7b7ddb756dab64f6/ckanext/validation/logic.py#L68 becomes `package_validation_run` and in these actions we treat the whole CKAN dataset (plus schemas) as a frictionless Data Package

We have a small amount of time to dedicate to this and would like to make a change that can be merged here (rather than maintaining our own fork) and so we'd really appreciate thoughts and ideas from existing maintainers and contributors.

All thoughts welcome :smile:

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.