ckanext-data-qld
A custom CKAN extension for Data.Qld
Local environment setup
- Make sure that you have latest versions of all required software installed:
- Make sure that all local web development services are shut down (Apache/Nginx, Mysql, MAMP etc).
- Checkout project repository (in one of the supported Docker directories).
pygmy up./build.sh- You may need to use sudo on linux
Building on Ubuntu (optional: behind proxy)
- composer from compose
- sudo pip install docker-compose
- sudo apt-get install composer
- ensure /etc/gemrc has the following
http_proxy: http://localhost:3128 https_proxy: http://localhost:3128 - if squid proxy is in use on your machine ensure that
acl localnet src 172.17.0.0/16# allows your public ip for loopback - https://docs.docker.com/network/proxy/
~/.docker/config.json
{ "proxies": { "default": { "httpProxy": "http://hostexternalip:3128", "httpsProxy": "http://hostexternalip:3128", "noProxy": "" } } }- https://docs.docker.com/config/daemon/systemd/
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo vi /etc/systemd/system/docker.service.d/http-proxy.conf
[Service] Environment="HTTP_PROXY=http://localhost:3128/"sudo vi /etc/systemd/system/docker.service.d/https-proxy.conf[Service] Environment="HTTPS_PROXY=http://localhost:3128/"sudo systemctl daemon-reload sudo systemctl restart docker
- https://docs.docker.com/config/daemon/systemd/
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo vi /etc/systemd/system/docker.service.d/http-proxy.conf
Use admin/password to login to CKAN.
Available build commands
Run each command as ./build.sh <command>.
build Build or rebuild project.
clean Remove containers and all build files.
cli Start a shell inside CLI container or run a command.
configure_docker Generate configuration files for Docker containers.
create_test_data Add sample data to support scenario tests.
doctor Find problems with current project setup.
down Stop Docker containers and remove container, images, volumes and networks.
flush_redis Flush Redis cache.
info Print information about this project.
lint Lint code.
logs Show Docker logs.
pull Pull latest docker images.
reset Reset environment: remove containers, all build, manually created and Drupal-Dev files.
restart Restart all stopped and running Docker containers.
run_bdd_tests Run BDD tests without creating test data (typically for re-runs).
start Start existing Docker containers.
stop Stop running Docker containers.
test_bdd Create test data and run BDD tests.
test_unit Run unit tests.
up Build and start Docker containers.
Coding standards
Python code linting uses flake8 with configuration captured in .flake8 file.
Set ALLOW_LINT_FAIL=1 in .env to allow lint failures.
Nose tests
./build.sh test_unit
Set ALLOW_UNIT_FAIL=1 in .env to allow unit test failures.
Behavioral tests
./build.sh test_bdd
Set ALLOW_BDD_FAIL=1 in .env to allow BDD test failures.
How it works
We are using Behave BDD framework with additional step definitions provided by Behaving library.
Custom steps described in test/features/steps/steps.py.
Test scenarios located in test/features/*.feature files.
Test environment configuration is located in test/features/environment.py and is setup to connect to a remote Chrome
instance running in a separate Docker container.
During the test, Behaving passes connection information to Splinter which instantiates WebDriver object and establishes connection with Chrome instance. All further communications with Chrome are handled through this driver, but in a developer-friendly way.
For a list of supported step-definitions, see https://github.com/ggozad/behaving#behavingweb-supported-matcherssteps.
Automated builds (Continuous Integration)
In software engineering, continuous integration (CI) is the practice of merging all developer working copies to a shared mainline several times a day. Before feature changes can be merged into a shared mainline, a complete build must run and pass all tests on CI server.
This project uses GitHub Actions as a CI server: it imports production backups into fully built codebase and runs code linting and tests. When tests pass, a deployment process is triggered for nominated branches (usually, master and develop).
Installation
-
Clone this repository
-
Activate python virtualenv and install extension:
. /usr/lib/ckan/default/bin/activate cd /usr/lib/ckan/default/src/ckanext-data-qld pip install -e . -
Add the extension to the relevant CKAN
.inifilepluginsdefinition:ckan.plugins = ... data_qld
data_qld_google_analytics
A custom CKAN extension for Data.Qld for sending API requests to Google Analytics
Setup
-
Add the extension to the relevant CKAN
.inifilepluginsdefinition:ckan.plugins = ... data_qld_google_analytics -
Add the config settings to relevant CKAN
.inifile# ckanext-data_qld_googleanalytics ckan.data_qld_googleanalytics.id = UA-1010101-1 # Relevant Google analytics ID ckan.data_qld_googleanalytics.collection_url = http://www.google-analytics.com/collect # change when reporting starts from, default is 2022-11-01 ckanext.data_qld.reporting.de_identified_no_schema.count_from = 2045-01-01 -
The file capture_api_actions.json is a dictionary of api actions to capture to send to google analytics
a. The dictionary key is the name of the api_action from https://docs.ckan.org/en/2.8/api/index.html#action-api-reference b. The dictionary value is the event_label sent to google analytics with the {0} replaced with the query parameter value eg. package_id, resource_id, query values, sql query
-
Restart web server(s), e.g.
sudo service apache reload sudo service nginx reload
Migrating Legacy Extra Fields
Note: The following assumes that a dump of production data has been imported into the CKAN database and any necessary database schema updates have been performed (ref.: https://docs.ckan.org/en/2.8/maintaining/database-management.html#upgrading).
Previously, the "Security classification" and "Used in data-driven application" fields had been added as free extras to datasets, e.g.
These fields are now part of the dataset schema via the scheming extension (ref.: https://github.com/qld-gov-au/ckanext-data-qld/blob/develop/ckanext/data_qld/ckan_dataset.json)
The legacy field values need to be migrated to their schema counterparts.
The ckanext-data-qld extension contains a Click command for doing this (ref.: https://github.com/qld-gov-au/ckanext-data-qld/blob/develop/ckanext/data_qld/commands.py)
Note: This command was designed to be run once for initial migration of legacy extra fields, so isn't idempotent. If migration command is run multiple times there should not be any issues, but it is not recommended to be used again once the site is live
To run the command:
-
Enable the python virtual environment:
. /usr/lib/ckan/default/bin/activate -
Run the following command:
ckan -c /path/to/ini_file.ini data_qld migrate_extras -
Rebuild the Solr index:
ckan -c /PATH/TO/YOUR_INI_FILE.ini search-index rebuild
This will iterate through each of the datasets in CKAN and copy the "Security classification" and "Used in data-driven application" extra field values to the dataset schema fields security_classification and data_driven_application respectively.
Demoting Publishers to Editor role
Note: The following assumes that a dump of production data has been imported into the CKAN database and any necessary database schema updates have been performed (ref.: https://docs.ckan.org/en/2.8/maintaining/database-management.html#upgrading).
There is a Click command to set the role for any users with names starting with publisher- from admin to editor where necessary.
Note: This command was designed to be run once. If run multiple times there should not be any issues, as it will not re-assign users who are already assigned the editor role - but it is not designed to be idempotent
To run the command:
-
Enable the python virtual environment:
. /usr/lib/ckan/default/bin/activate -
Run the following command:
ckan -c /etc/ckan/default/development.ini data_qld demote_publishers
Data.Qld Engagement Reporting Plugin
Configuration
-
Add the extension to the relevant CKAN
.inifilepluginsdefinition:ckan.plugins = ... data_qld_reporting -
Add the following optional config settings to relevant CKAN
.inifile, if desired:# ckanext-data_qld_reporting ckan.reporting.datarequest_open_max_days = 60 # Defaults to 60 ckan.reporting.comment_no_reply_max_days = 10 # Defaults to 10 ckan.reporting.engagement_json_config = PATH_TO_FILE # Defaults to os.path.dirname(os.path.realpath(__file__)) + '/../engagement_report_csv.json' ckan.reporting.admin_json_config = PATH_TO_FILE # Defaults to os.path.dirname(os.path.realpath(__file__)) + '/../admin_report_csv.json'
Metadata
Release files for ckanext-data-qld 9.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ckanext_data_qld-9.1.0.tar.gz | 177.4 kB | With provenance | Details for ckanext_data_qld-9.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ckanext_data_qld-9.1.0-py3-none-any.whl | Python 3 | none | any | Details for ckanext_data_qld-9.1.0-py3-none-any.whl |
Total release size: 405.1 kB
Release files / ckanext_data_qld-9.1.0.tar.gz
| Download URL | ckanext_data_qld-9.1.0.tar.gz |
|---|---|
| Size | 177.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f4a98e55850e8e3c1df5420d63fc895ed273ca95093ca22bd094e294a61a0f89
|
|
BLAKE2b-256 checksum How to use checksums |
57f81318d4a3b583240bbaf4f147b024dbad51b426d3dd293e0834d6ac7d895d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logRelease files / ckanext_data_qld-9.1.0-py3-none-any.whl
| Download URL | ckanext_data_qld-9.1.0-py3-none-any.whl |
|---|---|
| Size | 227.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bfb6e4063c0acfbf1924eb3c6603e32f5a6d2a01a0e651ea6a07b036a5732507
|
|
BLAKE2b-256 checksum How to use checksums |
3d2e60bd9402d6b1d016fbbf4d292dbf06372684b2d048930cf18d312fe5dfb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logSecurity for ckanext-data-qld 9.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ckanext_data_qld-9.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.