A CKAN-based data catalog for transportation and mobility datasets, compliant with MobilityDCAT-AP (Mobility Data Catalog Application Profile) standards.
Converts MobilityDCAT-AP RDF specifications into ckanext-scheming schema file.
Key files:
dcat_schema_transpiler/transpiler.py- Main transpiler entry pointdcat_schema_transpiler/mobility_dcat_ap/dataset.py- MobilityDCAT-AP dataset modeldcat_schema_transpiler/mobility_dcat_ap_to_schema.py- Conversion logic to YAMLdcat_schema_transpiler/cache/vocabularies.py- Vocabulary caching to avoid repeated downloads
Contains all custom CKAN functionality.
Key files:
src/- Frontend source code (TypeScript, SASS)ckanext/digitraffic_core/- Main CKAN extension code- actions
- authorization
- helpers
- migrations
- profiles (used by ckanext-dcat to generate RDF serializations)
- schema (used by ckanext-scheming to generate UI forms)
- templates
- validators
- views (Flask blueprints)
e2e/- Playwright end-to-end tests
Multilingual support for datasets, resources, organizations, and groups.
Microsoft Entra ID (Azure AD) authentication integration.
OpenTelemetry integration for monitoring and tracing.
Docker-based local development environment.
Components:
- CKAN application container
- PostgreSQL database
- Apache Solr search engine
- Redis cache
- Nginx reverse proxy
- OpenTelemetry collector
- Docker and Docker Compose
- Node.js and pnpm
- Python (for transpiler development)
- Poetry (for transpiler dependencies)
cd local-env
DIGITRAFFIC_CI_PATH=/path/to/ci/project ./start-local-ckan.sh up build_imageWhat this does:
- Builds Docker images for CKAN, PostgreSQL, Solr, Nginx
- Starts all containers, including OpenTelemetry collector, Redis, and Jaeger
- Initializes the database
- Sets up test users
Configuration:
For local development, you may change CKAN settings using local-env/ckan/dev-setup.sh.
For more detailed debugging info, set the following properties:
digitraffic_opentelemetry.loggers_to_set_events = ckan ckanextdigitraffic_opentelemetry.enter_pdb_on_error = truedigitraffic_opentelemetry.instrument_ckan_alpha = true
Access the catalog: http://localhost:8080
cd local-env
./reload-ckan.shLocation of files:
- TypeScript:
ext/ckanext-digitraffic_core/src/ts/ - SASS:
ext/ckanext-digitraffic_core/src/sass/ - Templates:
ext/ckanext-digitraffic_core/ckanext/digitraffic_core/templates/
Workflow:
-
Install dependencies (first time only):
cd ext/ckanext-digitraffic_core pnpm install --ignore-scripts -
Make your changes: To TypeScript or SASS files. Or if you want to override CKAN default CSS, modify
src/sass/override_ckan/_variables.scss. Seeoverride-ckan-default-variablespackage.json script. -
Bundle the assets:
pnpm run bundle
This runs:
bundle-ts: Compiles TypeScript with Rollupbundle-sass: Compiles SASS, processes with PostCSS, minifies- Known warnings
- Running Sass will cause a lot of deprecation wargnings. We cannot really do much about it as wargnings mainly
originates from the libraries that we use. We cannot even update our own
.scssfiles to not use@importas we could not then override the variables. - Postcss will complain about a file with path ending
$%7BimagePath%7D/dashboard-followee-related.png. This is because of an incorrect variable reference in CKAN's_dashboard.scssfile.
- Running Sass will cause a lot of deprecation wargnings. We cannot really do much about it as wargnings mainly
originates from the libraries that we use. We cannot even update our own
- Known warnings
-
Reload CKAN:
cd ../../local-env ./reload-ckan.sh -
Refresh browser to see changes
The schema defines:
- What fields appear in dataset forms
- Field types, labels, help text
- Validation rules
- Required vs optional fields
- Translations
Workflow:
-
Update RDF sources (if needed): Edit transpiler files as needed
-
Install transpiler dependencies:
cd dcat_schema_transpiler poetry install -
Run transpiler:
poetry run python dcat_schema_transpiler/transpiler.py
Output:
dcat_schema_transpiler/output/schema.yaml -
Copy to CKAN extension:
cp output/schema.yaml ../ext/ckanext-digitraffic_core/ckanext/digitraffic_core/schemas/mobility_dcat.yaml
-
Reload CKAN:
cd ../local-env ./reload-ckan.sh
Location: ext/ckanext-digitraffic_core/ckanext/digitraffic_core/tests/
Run tests:
cd local-env
# Start environment first
./start-local-ckan.sh up
# Run tests
./run-digitraffic-core-tests-on-docker.shLocation: ext/ckanext-digitraffic_core/e2e/
Run tests locally:
cd ext/ckanext-digitraffic_core
pnpm e2e-ui # Opens Playwright UI
# or
pnpm e2e # Headless modeTranslations are managed in two separate places for this project: in gettext files (for the use of CKAN HTML templates) and in the schema transpiler source code (for including translations in the YAML schema used by ckanext-scheming).
Translations for the use of the ckanext-scheming plugin are managed in the schema transpiler: dcat_schema_transpiler/dcat_schema_transpiler/ckan_schema/mobility_dcat_ap_converter/i18n/translations.py
Translatable texts contained in CKAN HTML templates (marked with the {% trans %} tag) are managed via gettext (.po) files. This is the default way of managing translations in CKAN, and there are commands for automatically generating translation templates from the translatable texts of the current project (in this case this extension).
You can use a gettext editor such as https://poedit.net/ to edit the .po files.
See also the CKAN documentation on translating CKAN
The commands need to be run in the container where you are running CKAN. setup.py below is the setup.py of this extension.
python setup.py extract_messages
Updates the .pot file. This is what you need to do if you have added new translatable texts or edited previous ones in the HTML templates.
Locale fi used as an example below.
python setup.py init_catalog --locale fi
python setup.py update_catalog
This updates all locales.
python setup.py update_catalog --locale fi
Updates a specific locale.
The upcate_catalog command retains previous translations but updates msgid values from the .pot template. After you have updated the .pot template, you need to also update the translation templates for each locale using this command.
If not using an editor (such as poedit) that compiles automatically on save, you will still need to compile the .po file into an .mo file. Use this command:
python setup.py compile_catalog --locale fi
- CKAN Documentation: https://docs.ckan.org/en/latest/
- MobilityDCAT-AP Specification: https://mobilitydcat-ap.github.io/mobilityDCAT-AP/releases/
- Fintraffic Design System: https://github.com/fintraffic-design