Extension Dataset Versions


Extension Basics

Title
Dataset Versions
Name
ckanext-datasetversions
Type
Public extension
Description
CKAN extension that adds support for storing and displaying different versions of a dataset, useful for time-series data like humanitarian situation reports.
CKAN versions
Download-Url (zip)
Last commit
3 years ago (2022-12-30 14:46:43)
Url to repo
Category
Data Management & Quality


Background Infos

Description (long)
Show details

ckanext-datasetversions

This CKAN extension adds support for different versions of a dataset. Sometimes it is desirable to store and display together different versions of a dataset, for example a daily situation report-style map during a humanitarian crisis.

How It Works

The plugin models dataset versions internally by creating a parent dataset with minimal metadata and no resources. A child dataset is created for each version.

Actions

The plugin provides an action dataset_version_create:

toolkit.get_action('dataset_version_create')(
    context, {
        'id': dataset['id'],
        'base_name': base_name,
        'owner_org': owner_org
    }
)

dataset_version_create will create a parent-child relationship between the dataset specified by base_name and that specified by id. If the dataset specified by base_name does not exist, it will be created.

Package Show Override

Note that this plugin overrides CKAN’s package_show action. The original package_show is made available as ckan_package_show.

For datasets with different versions, the overridden package_show will return:

  • The latest, public, active version of the dataset if the parent name or id is specified
  • A specific version of the dataset if the child name or id is specified

The version ordering is determined by the integer value of version in the dataset metadata.

In addition, package_show will return a list of the names and URLs of all active versions as _versions in the dictionary.

Templates

The plugin provides templates to list versions of a dataset alongside that currently viewed and to warn the user if they are looking at an old version of a dataset.

Requirements

This plugin will not work ‘out of the box’. You will need to write code to call the dataset_version_create action. A site-specific example is available at https://github.com/aptivate/ckanext-mapactionimporter

This is known to work with CKAN 2.5.2, though note there are problems when purging datasets with relationships.

Installation

  1. Activate your CKAN virtual environment:
. /usr/lib/ckan/default/bin/activate
  1. Install the ckanext-datasetversions Python package:
pip install ckanext-datasetversions
  1. Add datasetversions to the ckan.plugins setting in your CKAN config file.

  2. Restart CKAN.

Config Settings

None

About

Copyright (c) 2016 MapAction. Developed by Aptivate.

Development of v1 of this plugin was funded by ECHO (European Commission Humanitarian Aid).

License

This extension is licensed under the AGPL-3.0 license.

Version
1.0.0
Version release date
2016-07-11
Contact name
Aptivate
Contakt email
(not set)
Contact Url
(not set)


Installation Guide

Configuration hints

Requires custom integration code to call dataset_version_create action. Supports private dataset versions. Available on PyPI.

Plugins to configure (ckan.ini)
datasetversions
CKAN Settings (ckan.ini)
DB migration to be executed
(not set)
<< back to Extensions