Skip to content

DataShades/ckanext-transmute

Repository files navigation

Tests

ckanext-transmute

Pipeline for data validation and conversion using schemas.

Read the documentation for a full user guide.

Quickstart

Install the extension

pip install ckanext-transmute

Add transmute to the list of enabled plugins in the CKAN config file.

Transform data using inline schema

ckanapi action tsm_transmute root=example \
    data:'{"greeting": "hello"}' \
    schema:'{
  "root": "example",
  "types": {
    "example": {
      "fields": {
        "message": {
          "validate_missing": true,
          "validators": [
            [
              "tsm_concat",
              "$greeting",
              ", ",
              "$name",
              "!"
            ]
          ],
          "weight": 2
        },
        "name": {
          "default": "transmute"
        },
        "greeting": {
          "default": "Hi"
        }
      },
      "post-fields": {
        "greeting": {
          "remove": true
        },
        "name": {
          "remove": true
        }
      }
    }
  }
}'

Developer installation

Install the extension

git clone https://github.com/DataShades/ckanext-transmute.git
cd ckanext-transmute
pip install -e '.[dev]'

Run tests

pytest

License

AGPL