Target release0.0.2
Source (e.g. Github)https://github.com/EnviDat/ckanext-composite
Main featuresAllows to store structured dataset metadata, single or multiple fields. Only one level of subfields is possible. The subfields can be basic text, date type o choice dropboxes. Do not use dashes or numbers in the labels or values of fields.
Prerequisite / Dependencies

Supports currently CKAN 2.9. There is a legacy branch for CKAN 2.8 (https://github.com/EnviDat/ckanext-composite/tree/ckan-2.8). Requires the extensions ckanext-scheming and ckanext-repeating (using version from repository eawag-rdm).

LicenseAGPL
Installed by
Document status

COMPLETED

Background and strategic fit

Add the composite plugin to your ckan.plugins configuration settings and use ckanext-scheming or a custom form plugin to use the provided validators to provide subfields for the metadata fields.

This for example is required for the fields that each contains more sub-attributes such as author with subfields such as name, email address, etc..

Installations and Requirements

To install ckanext-composite on a production site:

  1. Activate your CKAN virtual environment, for example:

    ENV /usr/lib/ckan/default/bin/activate
  2. Install the ckanext-composie Python package into your virtual environment:

    pip install ckanext-composite
    
    // or
    
    pip install -e git+https://github.com/EnviDat/ckanext-composite#egg=ckanext-composite
  3. Add the relevant plugins to the ckan.plugins setting in your CKAN config file.

  4. Add ckanext.composite:presets.json to your scheming. presets configuration settings:

    scheming.presets = ckanext.scheming:presets.json
                       ckanext.repeating:presets.json
                       ckanext.composite:presets.json
  5. Restart CKAN. For example, if you've deployed CKAN with Apache on Ubuntu:

    sudo service apache2 reload

User interaction and design

Add this to your schema.json file:

# Composite Field
{
 "field_name": "maintainer",
 "label": "Maintainer",
 "preset": "composite",
 "subfields":[
     {
       "field_name": "name",
       "label": "Name",
       "form_placeholder": "Joe Bloggs"
     },
     {
       "field_name": "email",
       "label": "Email",
       "form_placeholder": "joe@example.com"
      },
     {
       "field_name": "date",
       "label": "Date",
       "preset": "date",
       "form_placeholder": "yyyy-mm-mm"
      },
      {
       "field_name": "identifier_scheme",
       "label": "Scheme",
       "preset": "select",
       "choices": [
         {
           "value": "orcid",
           "label": "ORCID"
         },
         {
           "value": "isni",
           "label": "ISNI"
         }
      ]
    }
 ]
}
# Composite Repeating Field
{
 "field_name": "author",
 "label": "Authors",
 "preset": "composite_repeating",
 "form_blanks": 1,
 "subfields": [
     {
       "field_name": "name",
       "label": "Name",
       "form_placeholder":"eg. John Smith"
     },
     {
       "field_name": "type",
       "label": "Type",
       choices = [
        {
           "value": "collaborator",
           "label": "Collaborator"
         },
         {
           "value": "editor",
           "label": "Editor"
         }
       ]
     }
  ]
 }

Questions and Answers

Below is a list of Q&A from user sides:

QuestionAnswers

Further steps