Skip to content

Combining options from different configuration levels

kspurgin edited this page Apr 1, 2017 · 3 revisions

There are several different types of options, each following a different pattern.

How an option used in multiple config levels interacts depends on what type of option it is.

Option pattern: simple booleans

Below, use id affix is an example of a simple boolean option.

---
institution:
  main id: '001'
  merge id: '019a'
  use id affix: false

A boolean option’s values can only be: true or false.

Tip
Also, notice that these terms are not in quotes.

A boolean option set in a more specific config will override the same boolean option set in a higher level config.

institution:
  use id affix: false
workflows:
  My first workflow:
    use id affix: true

A boolean option set in a workflow config will override the same option set in the institution config.

A boolean option in a collection config will override the same option set in the institution config or the workflow config it is being used with.

Option pattern: Simple values

Simple value options look a lot like boolean options, BUT:

  • their value can be anything, not just true or false

  • their values need to be in quotes (single or double)

main id and merge id are simple value options.

With one important exception (discussed in the following section), simple options combine like boolean options: the simple option value from a more specific config will be used.

---
institution:
  main id: '001'
  merge id: '019a'
workflows:
  New recs only:
    merge id: '035z'
  New + changed journal recs:
    merge id: '019a'
collections:
  these ebooks:
    merge id: '019a'
  those journals:
    #merge id: '022a'
Note
Yes this example is nonsense. I can’t imagine anyone needing these settings in real life, ever.
Table 1. Specification combination: simple value: example: merge id
workflow spec Collection spec Result Note/explanation

New recs only

these ebooks

019a

Collection overrides workflow overrides institution

New recs only

those journals

035z

Collection option is commented out! Workflow overrides institution

New + changed journal

these ebooks

019a

Collection overrides workflow overrides institution, and they’re all the same anyway

New + changed journal

those journals

019a

Collection overrides workflow overrides institution, but collection’s merge id option is commented out

The important simple value exception: id affix value

As mentioned above, there is ONE simple value option that behaves differently. It is: id affix value

id affix value combines as follows: each more specific config’s id affix value is appended to the value set by the broader config(s).

---
institution:
  main id: '001'
workflows:
  WCM full set:
    id affix value: 'wcm'
  SPR new recs:
    #id affix value: ''
collections:
  springerlink:
    id affix value: 'spr'
  rsc:
    id affix value: 'rsc'
Table 2. Specification combination: id affix value (simple value exception)
workflow spec Collection spec Result Note/explanation

WCM full set

springerlink

wcmspr

Collection value appended to workflow value

SPR new recs

springerlink

spr

Collection value only because workflow value is commented out and there is no institution value

WCM full set

rsc

wcmrsc

Collection value appended to workflow value

What if we added the following to our institution config?

  id affix value: 'unc'
Table 3. Specification combination: id affix value (simple value exception)
workflow spec Collection spec Result Note/explanation

WCM full set

springerlink

uncwcmspr

institution + collection + workflow

SPR new recs

springerlink

uncspr

institution + collection — workflow value is commented out

Option pattern: Lists

Lists start after a colon(:) and each item in a list is on a new line starting with a hyphen(-).

---
institution:
  cat lang:
    - 'eng'
  warning flag spec:
    - tag: '999'
      i1: '6'
      i2: '6'
      subfields:
        - delimiter: 'a'
          value: 'WARNING'
        - delimter: 'b'
          value: '[WARNINGTEXT]'

In the institution config above, cat lang and warning flag spec are list options. Each of them is a list of one item.

  • cat lang's single list item is the value 'eng'

  • warning flag spec's single list item is the specification of an entire MARC field: tag, indicators, and subfields (and their values)

Note
subfields, nested underneath warning flag spec, is a list of two items, where each list item has two key/value pairs: 'delimiter' and 'value'.

When a given list option is specified at multiple specification levels, the list item(s) from the more specific config is added to the list from the broader config.

institution:
  cat lang:
    - 'eng'
workflows:
  Quebec project:
    use id affix: true
    cat lang:
      - 'fre'
collections:
  German cataloging collection:
    cat lang:
      - 'ger'
Table 4. Specification combination: list: cat lang, example 1
workflow spec Collection spec Result Note/explanation

Quebec project

German cataloging collections

eng, fre, ger

institution + collection + workflow

List options are deduplicated after they are combined, so if for some reason we had specified a cat lang of 'eng' in our institution, workflow, and collection configs, the script will only check for English language of cataloging:

institution:
  cat lang:
    - 'eng'
workflows:
  Quebec project:
    cat lang:
      - 'eng'
collections:
  German cataloging collection:
    cat lang:
      - 'eng'
Table 5. Specification combination: list: cat lang, example 2
workflow spec Collection spec Result Note/explanation

Quebec project

German cataloging collections

eng

institution + collection + workflow, deduplicated

Option pattern: Map, or set of key-value pairs

A map option is a set of key-value pairs, where:

  • each key-value pair is on a new line

  • there are no hyphens, which is different from a list option

  • each key is separated from its value by a colon(:)

  • each key in the map is a unique value---no duplicate keys in a map

elvl AC map below is an example of a map option.

---
institution:
  elvl AC map:
    '2': 'noAC'
    '3': 'noAC'
    '4': 'noAC'
    '5': 'noAC'
    '7': 'noAC'
    '8': 'noAC'
    'K': 'noAC'
    'L': 'noAC'
    'M': 'noAC'
    'J': 'noAC'
    ' ': 'AC'
    '1': 'AC'
    'I': 'AC'

How a given map option defined in multiple configuration levels is combined depends on whether map keys being specified at the lower-level spec are defined in the higher-level spec.

If key is already defined in higher-level spec

The value in the lower-level spec will override the higher-level spec.

If we have the following spec and use the not under AC workflow, the script will identify records with blank, 1, or I encoding level as not being under authority control.

---
institution:
  elvl AC map:
    '2': 'noAC'
    '3': 'noAC'
    '4': 'noAC'
    '5': 'noAC'
    '7': 'noAC'
    '8': 'noAC'
    'K': 'noAC'
    'L': 'noAC'
    'M': 'noAC'
    'J': 'noAC'
    ' ': 'AC'
    '1': 'AC'
    'I': 'AC'
workflows:
  not under AC:
    ' ': 'noAC'
    '1': 'noAC'
    'I': 'noAC'

If a new key is defined in lower-level spec

The new key-value pair from the lower-level spec is added to the key-value pairs specified for that option in the higher-level spec.

If we have the following spec and use the weird vendor specific elvl collection, the script will identify records with P encoding level as being under authority control.

---
institution:
  elvl AC map:
    '2': 'noAC'
    '3': 'noAC'
    '4': 'noAC'
    '5': 'noAC'
    '7': 'noAC'
    '8': 'noAC'
    'K': 'noAC'
    'L': 'noAC'
    'M': 'noAC'
    'J': 'noAC'
    ' ': 'AC'
    '1': 'AC'
    'I': 'AC'
collections:
  weird vendor specific elvl:
    'P': 'AC'