A fast and simple dataset series implementation for CKAN
Project description
ckanext-dataset-series
[!WARNING] This is extension is a work in progress and may change at any point. Use with caution.
A fast and simple implementation of Dataset Series.
Dataset Series are loosely defined as collections of datasets that share some common characteristics. These can be related to the nature of the data, scope, publishing process, etc. For instance:
- Budget data release monthly or yearly
- Data split by country / region
- Data big in size split into smaller chunks
- Geospatial data distributed in grids
Dataset Series can be ordered or unordered.
How does it work?
This extension uses a custom dataset type (dataset_series) to define the parent series entities. These are
just datasets and can have any of the standard dataset fields defined.
If the series is ordered, the only mandatory fields they need are the following (shown in the ckanext-scheming schema file definition):
scheming_version: 2
dataset_type: dataset_series
dataset_fields:
# [...]
# Series fields
- field_name: series_order_field
preset: dataset_series_order
- field_name: series_order_type
preset: dataset_series_order_type
At the dataset level, the series membership is defined with the in_series field. Datasets can belong to multiple series:
scheming_version: 2
dataset_type: dataset
dataset_fields:
# [...]
# Series fields
- field_name: in_series
preset: dataset_series_in_series
Once these are in place, datasets can be assigned to a series by setting the in_series field via the API or the UI form.
[!NOTE] Only users that can update the Dataset Series dataset can add dataset members to it
API
If a dataset belongs to a series, a new series_navigation key is added to the response of the package_show action, showing details of the series it belongs to:
{
"name": "test-dataset-in-series",
"type": "dataset",
"series_navigation": [
{
"id": "20f41df2-0b50-4b6b-9a75-44eb39411dca",
"name": "test-dataset-series",
"title": "Test Dataset series",
}
]
}
If that series is ordered, it will include links to the previous and next dataset on the series (or None if they don't exist):
{
"name": "test-series-member-2",
"type": "dataset",
"series_navigation": [
{
"id": "20f41df2-0b50-4b6b-9a75-44eb39411dca",
"name": "test-dataset-series",
"title": "Test Dataset series",
"next": {
"id": "ce8fb09a-f285-4ba8-952e-46dbde08c509",
"name": "test-series-member-3",
"title": "Test series member 3"
"type": "dataset"
},
"previous": {
"id": "826bd499-40e5-4d92-bfa1-f777775f0d76",
"name": "test-series-member-1",
"title": "Test series member 1",
"type": "dataset"
}
}
]
}
Querying the series dataset will also return a series_navigation link if ordered, in this case linking to the first and last members:
{
"name": "test-dataset-series",
"type": "dataset_series",
"series_navigation": {
"count": 4,
"first": {
"id": "826bd499-40e5-4d92-bfa1-f777775f0d76",
"name": "test-series-member-1",
"title": "Test series member 1",
"type": "dataset"
},
"last": {
"id": "ce8fb09a-f285-4ba8-952e-46dbde08c509",
"name": "test-series-member-3",
"title": "Test series member 3",
"type": "dataset"
}
}
}
UI
The extension includes a series_navigation.html snippet that adds a series navigation to the dataset page, with links to the previous and next datasets in the series. The snippet is left deliberately unstyled so sites can tweak it to fit their own design.
For example, you can adjust your package/read.html template to include the snippet in the following way:
{% ckan_extends %}
{% block package_description %}
{% snippet "package/snippets/series_navigation.html", package=pkg %}
{{ super() }}
{% endblock %}
[!NOTE] The snippet only works with the first series a dataset belongs to. You can adjust it to show the navigation for other series if needed
[!NOTE] TODO
- Series page showing a navigation of the member datasets
Requirements
If your extension works across different versions you can add the following table:
Compatibility with core CKAN versions:
| CKAN version | Compatible? |
|---|---|
| 2.9 | not tested |
| 2.10 | yes |
| 2.11 | yes |
Installation
To install ckanext-dataset-series:
-
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/ckan/ckanext-dataset-series.git cd ckanext-dataset-series pip install -e . pip install -r requirements.txt
-
Add
dataset_seriesto theckan.pluginssetting in your CKAN config file (by default the config file is located at/etc/ckan/default/ckan.ini). -
Restart CKAN.
Developer installation
To install ckanext-dataset-series for development, activate your CKAN virtualenv and do:
git clone https://github.com//ckanext-dataset-series.git
cd ckanext-dataset-series
pip install -e .
pip install -r dev-requirements.txt
Tests
To run the tests, do:
pytest --ckan-ini=test.ini
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ckanext_dataset_series-0.1.0.tar.gz.
File metadata
- Download URL: ckanext_dataset_series-0.1.0.tar.gz
- Upload date:
- Size: 27.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f21d8e0cb186c856c07e7a509055495e8a70a2014e1a0a3667d22bef54c5ef21
|
|
| MD5 |
5b15216866070a04889589ea1d762dd6
|
|
| BLAKE2b-256 |
dedd4174c7ec315bf386932b1139608dbeb27b0b1aa00427cc7981f7151abd46
|
Provenance
The following attestation bundles were made for ckanext_dataset_series-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on ckan/ckanext-dataset-series
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ckanext_dataset_series-0.1.0.tar.gz -
Subject digest:
f21d8e0cb186c856c07e7a509055495e8a70a2014e1a0a3667d22bef54c5ef21 - Sigstore transparency entry: 215697414
- Sigstore integration time:
-
Permalink:
ckan/ckanext-dataset-series@5d52f005154fe1ceb158f73e067bcbfdaa12f52d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ckan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@5d52f005154fe1ceb158f73e067bcbfdaa12f52d -
Trigger Event:
push
-
Statement type:
File details
Details for the file ckanext_dataset_series-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ckanext_dataset_series-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be71290f3c383ba0f873637d2617ad71d8c68d3b7e4938d05cea470ecae40087
|
|
| MD5 |
91c600420f11085586f82e34e1c15feb
|
|
| BLAKE2b-256 |
b43f6dd88d7c63e68cbe4521dfe88c0ca1e3ebe656f7ee2fa3c2bda5ca306018
|
Provenance
The following attestation bundles were made for ckanext_dataset_series-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on ckan/ckanext-dataset-series
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ckanext_dataset_series-0.1.0-py3-none-any.whl -
Subject digest:
be71290f3c383ba0f873637d2617ad71d8c68d3b7e4938d05cea470ecae40087 - Sigstore transparency entry: 215697416
- Sigstore integration time:
-
Permalink:
ckan/ckanext-dataset-series@5d52f005154fe1ceb158f73e067bcbfdaa12f52d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ckan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@5d52f005154fe1ceb158f73e067bcbfdaa12f52d -
Trigger Event:
push
-
Statement type: