CKAN extension for Öppnadata.se, the Swedish data management platform.
To enable, activate your CKAN virtual environment and then:
-
Add
sweden_blog
tockan.plugins
. -
Install the blog plugin's requirements:
pip install -r ckanext/sweden/blog/requirements.txt
-
Run the paster command to initialize the blog's database tables:
paster --plugin=ckan sweden_blog_init -c /etc/ckan/default/development.ini
-
Restart CKAN.
To enable, activate your CKAN virtual environment and then:
-
Install Redis, gcc and libffi-dev:
sudo apt-get install redis-server build-essential libffi-dev
-
Install
sweden_dcat_rdf_harvester
requirementspip install -r ckanext/sweden/dcat/requirements.txt
-
Install
ckanext-harvest
:git clone https://github.com/ckan/ckanext-harvest cd ckanext-harvest git checkout stable pip install -r pip-requirements.txt python setup.py develop
-
Install
ckanext-dcat
:git clone https://github.com/ckan/ckanext-dcat cd ckanext-dcat pip install -r requirements.txt # tmp pip install lxml python setup.py develop
-
Add
dcat_rdf_harvester sweden_dcat_rdf_harvester harvest
tockan.plugins
ensuringharvest
is listed aftersweden_dcat_rdf_harvester
-
Restart CKAN.
You should see the harvest pages at /harvest
and Generic DCAT RDF Harvester
listed as a type on /harvest/new
.
The following configuration options can be used with regards to the validation of remote DCAT documents:
ckanext.sweden.harvest.use_validation
(default:True
): Whether to use validation at allckanext.sweden.harvest.validation_service
(default:http://validator.dcat-editor.com/service
): The URL of the validation service to use. The harvester will POST the contents of the remote DCAT file to this endpoint.ckanext.sweden.harvest.stop_on_validation_errors
(defaultFalse
): Whether to stop the datasets import if validation errors were found.
To enable the theme:
- Add
sweden_theme
tockan.plugins
To modify the theme of the ckanext-sweden theme you'll need to:
-
Install Node (
apt-get install node
) and Bower (npm install -g bower
) -
Install the front end dependancies: cd ./ckanext/sweden/theme/ && npm i && bower update
-
Re-compile assets:
gulp
(gulp watch
will regenerate them on the whenever a change happens.) -
Once you've made your changes make sure you commit the changes in
./ckanext/theme/resources
To enable Eurovoc categories:
-
Install ckanext-eurovoc::
pip install ckanext-eurovoc
-
Enable the Eurovoc and Sweden plugins by adding
eurovoc
andsweden
tockan.plugins
.
The sweden
plugin adds the following API endpoints:
-
dcat_organization_list
: returns a list of all organizations that have DCAT harvesting set up. Returns a list of objects, one per organization, each of them with the following keys:- `id`: CKAN organization id - `url`: Organization website (unique across organizations) - `dcat_metadata_url`: DCAT output for the organization datasets (generated by CKAN) - `original_dcat_metadata_url`: The remote DCAT datasets that were harvested into Oppnadata.se - `dcat_validation`: Boolean showing whether the DCAT validation passed or not - `dcat_validation_date`: Date and time in which the DCAT validation last took place - `dcat_validation_url`: URL to the DCAT validation results
-
dcat_validation
: returns the validation output for the last harvest job of the organization harvest source. Requires anid
parameter with the organization name or id.
The sweden_theme
extension adds a number of additional API endpoints to
retrieve data about datasets in the site.
total_datasets_by_week
: the cumulative total number of datasets by week.weekly_dataset_activity
: the number of updates to datasets per week.weekly_dataset_activity_new
: the number of new datasets per week.
e.g.:
curl http://127.0.0.1:5000/api/3/action/weekly_dataset_activity -H "Authorization:<your-api-key>"
Groups aren't used and can be hidden with the ckanext- hidegroups extension::
pip install -e 'git+git://github.com/okfn/ckanext-hidegroups.git#egg=ckanext-hidegroups'
Then add hidegroups
to ckan.plugins
.
The extension includes a standalone script to automate the creation of organizations on
the portal. For details, check the scripts
folder.
To run the tests, first install the dev requirements (and Redis, see above):
pip install -r dev-requirements.txt
Then do:
nosetests --nologcapture --ckan --with-pylons=test.ini
To run the tests with coverage, first install coverage (pip install coverage
)
then do:
nosetests --nologcapture --ckan --with-pylons=test.ini --with-coverage --cover-package=ckanext.sweden --cover-inclusive --cover-erase --cover-tests