Skip to main content

CKAN extension to generate /data.json

Project description

ckanext-datajson

Github Actions PyPI version

A CKAN extension containing plugins datajson. First is used by http://catalog.data.gov/ to harvest data sources from a remote /data.json file according to the U.S. Project Open Data metadata specification (https://resources.data.gov/schemas/dcat-us/v1.1/).

Plugin datajson provides a harvester to import datasets from other remote /data.json files. See below for setup instructions.

And the plugin also provides a new view to validate /data.json files at http://ckanhostname/dcat-us/validator.

Features

  • [:heavy_check_mark:] datajson provides data.json export and DCAT-US metadata UI integration
  • [:heavy_check_mark:] datajson_harvest extends ckanext-harvest to collect metadata fromremote data.json sources
  • [:warning:] cmsdatanav_harvest extends ckanext-harvest to collect metadata from for the CMS Data Navigator catalog
  • [:heavy_check_mark:] datajson_validator provides a web form to validate dcat-us metadata data.json compliance.

Usage

Requirements

All requirements are tracked setup.py when possible. Some CKAN extensions are not on PyPI, so they (and their dependencies) must be tracked in requirements.txt.

CKAN version Compatibility
<=2.7 :x:
2.8 :warning:
2.9.5 :heavy_check_mark:
2.9.6 :heavy_check_mark:

Installation

To install, activate your CKAN virtualenv, install dependencies, and install the module in develop mode, which just puts the directory in your Python path.

. path/to/pyenv/bin/activate
pip install -r requirements.txt
python setup.py develop

Then in your CKAN .ini file, add datajson to your ckan.plugins line:

ckan.plugins = (other plugins here...) datajson

That's the plugin for /data.json output. To make the harvester available, also add:

ckan.plugins = (other plugins here...) harvest datajson_harvest

To make the datajson validator route and web form available, also add:

ckan.plugins = (other plugins here...) datajson_validator

[ Optional ] Set the resource count limit allowed in one record so that fetch-consumer does not run out of memory during harvesting. Default is unlimited. Once set, records with higher resource count will see import errors. ckanext.datajson.max_resource_count = 1000

Development

Setup

Build the docker containers.

$ make build

Start the docker containers.

$ make up

CKAN will start at localhost:5000.

Clean up any containers and volumes.

$ make clean

Open a shell to run commands in the container.

$ docker-compose exec app /bin/bash

If you're unfamiliar with docker-compose, see our cheatsheet and the official docs.

For additional make targets, see the help.

$ make help

Testing

They follow the guidelines for testing CKAN extensions.

To run the extension tests, start the containers with make up, then:

$ make test

Lint the code.

$ make lint

Matrix builds

The test development environment drops as many dependencies as possible. It is not meant to have feature parity with GSA/catalog.data.gov. Tests should mock external dependencies where possible.

In order to support multiple versions of CKAN, or even upgrade to new versions of CKAN, we support development and testing through the CKAN_VERSION environment variable.

$ make CKAN_VERSION=2.9.5 test
$ make CKAN_VERSION=2.9 test

Note: When testing patch versions of CKAN, the services may not have patch releases. So, take note of the SERVICES_VERSION variable which tracks the minor release to pull for the db and solr images.

Credit / Copying

Original work written by the HealthData.gov team. It has been modified in support of Data.gov.

As a work of the United States Government, this package is in the public domain within the United States. Additionally, we waive copyright and related rights in the work worldwide through the CC0 1.0 Universal public domain dedication (which can be found at http://creativecommons.org/publicdomain/zero/1.0/).

Ways to Contribute

We're so glad you're thinking about contributing to ckanext-datajson!

Before contributing to ckanext-datajson we encourage you to read our CONTRIBUTING guide, our LICENSE, and our README (you are here), all of which should be in this repository. If you have any questions, you can email the Data.gov team at datagov@gsa.gov.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ckanext-datajson-0.1.28.tar.gz (72.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ckanext_datajson-0.1.28-py3-none-any.whl (90.5 kB view details)

Uploaded Python 3

File details

Details for the file ckanext-datajson-0.1.28.tar.gz.

File metadata

  • Download URL: ckanext-datajson-0.1.28.tar.gz
  • Upload date:
  • Size: 72.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ckanext-datajson-0.1.28.tar.gz
Algorithm Hash digest
SHA256 1fa64bd6079537a8b55fbb6d14082e9df54c23bac055317e583ed17d5b4fb7ac
MD5 85c3b32aa1590cd949d3893e39bbb188
BLAKE2b-256 4034252413c9ffee7be700be168a315e86ae94f300eed437ab6df68d6853c021

See more details on using hashes here.

File details

Details for the file ckanext_datajson-0.1.28-py3-none-any.whl.

File metadata

File hashes

Hashes for ckanext_datajson-0.1.28-py3-none-any.whl
Algorithm Hash digest
SHA256 a93c5b9f3a71615bbad3cb626e5fe03896019b86a5f33d3c46102034574f615c
MD5 c82e4b518dd89b46965fe709088ddfbf
BLAKE2b-256 fb4ce0e90d78c993dcbb184adf2a2c92fd563f9e3936522c5da5f38eceea3580

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page