A custom CKAN extension built specifically for the Scottish and Southern Electricity Distribution Data Portal (SSEN). This extension enhances CKAN’s core functionality by introducing custom actions, validators, permission labels, and view blueprints to better support data management and user experience for SSEN.
-
Custom Package Controller Enhancements:
Automatically generates and updates dataset URLs based on organizational context, ensuring consistency across the portal. -
Advanced Permission Labeling:
Dynamically assigns permission labels to datasets and users, based on dataset status, groups, organizations, and collaboration roles. -
Custom Validators:
Provides a suite of validators including:coverage_json_object
schema_json_object
resource_type_validator
schema_output_string_json
ib1_trust_framework_validator
ib1_sensitivity_class_validator
ib1_dataset_assurance_validator
-
Metadata Schema for the UK's Energy Sector:
Defines a comprehensive metadata schema based on DCAT and Dublin Core standards, tailored specifically for the UK's energy sector. -
Extended Actions:
Overrides standard CKAN actions with custom implementations for:- Package creation, update, display, and search.
- Daily activity reports via
daily_report_activity
. - Extended search capabilities through
search_package_list
.
-
Blueprint Integration:
Supplies custom blueprints for dataset views, providing additional routes and UI components tailored for the distribution data portal. -
Resource Controller Logic:
Automatically flags geospatial resources by detecting the GeoJSON format and updating resource metadata accordingly. -
Signal Subscriptions:
Integrates with CKAN’s signal system to extend or modify behavior at key events during the dataset lifecycle.
- CKAN v2.10.x
Note: This extension has been tested exclusively with CKAN v2.10.x. - Python 3.6+.
pip install ckanext-sse
Clone the repository and install the extension in editable mode:
git clone https://github.com/datopian/ckanext-sse.git
cd ckanext-sse
pip install -e .
-
Enable the Plugin:
Addsse
to theckan.plugins
line in yourckan.ini
configuration file:ckan.plugins = sse ... # include other plugins as needed
-
Template and Asset Directories:
The extension automatically adds its custom templates and static assets. Ensure your CKAN configuration points to the correct directories if you have custom overrides. -
DCAT Base URI:
The extension uses theckanext.dcat.base_uri
configuration setting to construct dataset URLs. Set this parameter in yourckan.ini
if required:ckanext.dcat.base_uri = http://your-ckan-instance-url
Once installed and configured, the extension integrates seamlessly with CKAN. Key behaviors include:
-
Dataset Creation & Editing:
During creation or editing, the extension generates a consistent URL for datasets based on whether they belong to an organization or are user-created. -
Permission Labels:
Datasets and users are assigned labels such aspublic
,member-{org_id}
,creator-{user_id}
, and collaborator-specific labels, facilitating fine-grained access control. -
Custom Actions:
Enhanced actions likepackage_create
,package_update
, andpackage_search
are available for extended dataset management and reporting. -
Geospatial Data Flagging:
On resource creation, if a resource’s format is GeoJSON, it is automatically flagged as geospatial—enabling better discovery and filtering within the portal.
Tests ensure the extension’s functionality remains robust. To run the tests, execute:
pytest
Contributions are welcome! Please follow these steps when contributing:
- Fork the repository.
- Create a feature branch.
- Write tests and ensure they pass.
- Submit a pull request with a detailed description of your changes.
See CONTRIBUTING.md for more details on our guidelines and code of conduct.
If you encounter any issues or have questions, please open an issue on GitHub or reach out to the maintainers.