Extension Dataset Preview Charts


Extension Basics

Title
Dataset Preview Charts
Name
ckanext-datasetpreview
Type
Public extension
Description
CKAN extension that automatically adds charts for all datasets in the dataset list, using messytables to discover field types from CSV resources.
CKAN versions
Download-Url (zip)
Last commit
4 years ago (2021-08-25 00:19:03)
Url to repo
Category
Visualization & Analytics


Background Infos

Description (long)
Show details

CKAN dataset preview

Note: Still in development status.

Adds automatically charts for all datasets in the dataset list. Uses messytables to discover field types.

Installation

pip install ckanext-datasetpreview

Or install from source:

git clone https://github.com/unckan/ckanext-datasetpreview.git
cd ckanext-datasetpreview
python setup.py develop

Add datasetpreview to your CKAN config file’s ckan.plugins setting.

Configuration

Available config options:

# Define if the extension should draw chart for:
# - 'ALL'    All datasets with a CSV resource
# - 'EXTRA' Just datasets with the 'dataset_preview' extra dictionary defined
# - 'NO'     No datasets will show any preview
ckanext.datasetpreview.draw = 'ALL'  # default draw all
ckanext.datasetpreview.chart_height = 300  # pixels

Per-Dataset Configuration

Each dataset can add an extra value with the key dataset_preview:

extras["dataset_preview"] = {
    # Field to use in the chart. Could be:
    # - A list of field names (valid in the CSV resource)
    # - Default will be [0, 1] (the first two columns in the CSV)
    # - You can use numbers instead of field names
    "fields": ["Field1", "Field2"],
    "chart_type": "Bar",  # Allows 'Pie', 'Bar', 'Column'
    # URL could be:
    # - An external URL
    # - Don't use this value: will be "csv_resource" which picks the first CSV resource
    # - Name of the resource in the dataset (must be a CSV)
    "url": "csv_resource",
    "height": 450,  # pixels
    "chart_color": "#AA5521"
}

If you don’t set up each dataset, it will show the first CSV resource in the dataset (using the first two columns).

License

MIT license

Version
0.2.31
Version release date
2020-08-30
Contact name
unckan
Contakt email
(not set)
Contact Url
(not set)


Installation Guide

Configuration hints

Available on PyPI. Requires messytables for field type discovery. Still in development.

Plugins to configure (ckan.ini)
datasetpreview
CKAN Settings (ckan.ini)
# ckanext.datasetpreview.draw = 'ALL'
# ckanext.datasetpreview.chart_height = 300
DB migration to be executed
(not set)
<< back to Extensions