Skip to content

Commit

Permalink
Adding ckanext-scheming to add a suggested citation field. RE:#32
Browse files Browse the repository at this point in the history
  • Loading branch information
phargogh committed Mar 6, 2024
1 parent 6fd1938 commit 133b006
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .env-localdev
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Per https://github.com/okfn/ckanext-envvars?tab=readme-ov-file#ckanext-envvars,
# any keys that don't normally begin with `ckan`, prefix with `CKAN___` (3 underscores)

# Container names
NGINX_CONTAINER_NAME=nginx
REDIS_CONTAINER_NAME=redis
Expand Down Expand Up @@ -81,7 +84,9 @@ NGINX_PORT=80
NGINX_SSLPORT=443

# Extensions
CKAN__PLUGINS="envvars image_view text_view recline_view datastore datapusher natcap spatial_metadata spatial_query stats activity"
#
# IMPORTANT: envvars MUST be the last item on the list.
CKAN__PLUGINS="image_view text_view recline_view datastore datapusher natcap spatial_metadata spatial_query stats activity scheming_datasets envvars"
CKAN__HARVEST__MQ__TYPE=redis
CKAN__HARVEST__MQ__HOSTNAME=redis
CKAN__HARVEST__MQ__PORT=6379
Expand All @@ -104,4 +109,7 @@ CKAN__TRACKING_ENABLED=true
CKAN__AUTH__CREATE_USER_VIA_WEB=false

# Anon users cannot view user details
CKAN__AUTH__PUBLIC_USER_DETAILS=false
CKAN__AUTH__PUBLIC_USER_DETAILS=false

# Add ckanext.scheming schemas here
CKAN___SCHEMING__DATASET_SCHEMAS="ckanext.natcap:natcap_dataset_schema.yml"
1 change: 1 addition & 0 deletions ckan/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ ENV CKANEXT_SPATIAL_GIT_REVISION=938308469892e4bcf7389cb4adee5ccdd5a0ccca
RUN apk add --no-cache geos geos-dev proj proj-dev proj-util
RUN pip3 install -e git+https://github.com/ckan/ckanext-spatial.git@$CKANEXT_SPATIAL_GIT_REVISION#egg=ckanext-spatial && \
pip3 install -r https://raw.githubusercontent.com/ckan/ckanext-spatial/$CKANEXT_SPATIAL_GIT_REVISION/requirements.txt
RUN pip3 install -e 'git+https://github.com/ckan/ckanext-scheming.git@master#egg=ckanext-scheming'

# Enable SQLAlchemy support by installing it
RUN pip3 install Flask-SQLAlchemy "flask<2.4" "Werkzeug<=2.1.2"
Expand Down
96 changes: 96 additions & 0 deletions src/ckanext-natcap/ckanext/natcap/natcap_dataset_schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
scheming_version: 2
dataset_type: dataset
about: A reimplementation of the default CKAN dataset schema for NatCap
about_url: http://github.com/natcap/data.naturalcapitalproject.stanford.edu


dataset_fields:

- field_name: title
label: Title
preset: title
form_placeholder: eg. A descriptive title for the Dataset

- field_name: name
label: URL
preset: dataset_slug
form_placeholder: eg. my-dataset

- field_name: notes
label: Description
form_snippet: markdown.html
form_placeholder: eg. Some useful notes about the data

- field_name: tag_string
label: Tags
preset: tag_string_autocomplete
form_placeholder: eg. economy, mental health, government

- field_name: license_id
label: License
form_snippet: license.html
help_text: License definitions and additional information can be found at http://opendefinition.org/

- field_name: owner_org
label: Organization
preset: dataset_organization

- field_name: url
label: Source
form_placeholder: http://example.com/dataset.json
display_property: foaf:homepage
display_snippet: link.html

- field_name: version
label: Version
validators: ignore_missing unicode_safe package_version_validator
form_placeholder: '1.0'

- field_name: author
label: Author
form_placeholder: Joe Bloggs
display_property: dc:creator

- field_name: author_email
label: Author Email
form_placeholder: [email protected]
display_property: dc:creator
display_snippet: email.html
display_email_name_field: author

- field_name: maintainer
label: Maintainer
form_placeholder: Joe Bloggs
display_property: dc:contributor

- field_name: maintainer_email
label: Maintainer Email
form_placeholder: [email protected]
display_property: dc:contributor
display_snippet: email.html
display_email_name_field: maintainer

- field_name: suggested_citation
label: Suggested Citation
form_placeholder: Natural Capital Project, 2024. InVEST 3.14.1. Stanford University, University of Minnesota, Chinese Academy of Sciences, The Nature Conservancy, World Wildlife Fund, Stockholm Resilience Centre and the Royal Swedish Academy of Sciences. https://naturalcapitalproject.stanford.edu/software/invest
help_text: Provide a citation in plain text
output_validators: ignore_missing

resource_fields:

- field_name: url
label: URL
preset: resource_url_upload

- field_name: name
label: Name
form_placeholder: eg. January 2011 Gold Prices

- field_name: description
label: Description
form_snippet: markdown.html
form_placeholder: Some useful notes about the data

- field_name: format
label: Format
preset: resource_format_autocomplete

0 comments on commit 133b006

Please sign in to comment.