Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Instruments

An instrument is a questionnaire, a demographics form, or the set of features a pipeline extracts from one kind of recording. Each one is described once, in its own file in instruments/, and can be used in any number of datasets. This page uses the example’s mood questionnaire, instruments/example_mood.yaml.

id: example_mood
name: Example Mood Scale
abbreviation: EMS
construct_name: Mood and negative affect
description: It asks how often in the past two weeks the child felt sad, worried or tired, and how often they enjoyed things.
instructions: Think about the past two weeks. How often did you feel this way?
response_sets:
  - id: frequency
    options:
      - {value: 0, label: Never}
      - {value: 1, label: Sometimes}
      - {value: 2, label: Often}
      - {value: 3, label: Always}
default_response_set: frequency
items:
  - {id: ems_1, text: I felt happy., reverse: true}
  - {id: ems_2, text: I felt sad.}
  # ...
scores:
  - {id: ems_total, label: Total score, method: sum, items: [ems_1, ems_2, ems_3, ems_4, ems_5, ems_6, ems_7, ems_8, ems_9], missing_rule: prorate, min_valid: 7}
  - {id: ems_sadness, label: Sadness, method: sum, items: [ems_2, ems_6, ems_7]}
references:
  - {key: example2019, pdf: example_mood.pdf}
license: Free for research use (fictional)

modality says how it was collected: questionnaire (the default) or another modality, such as eeg. demographics: true marks a form about the people, such as age and gender, rather than a scale. construct_name and description feed the Measures paragraph on the Methods page. A description is one or two sentences that a person has written or checked.

Items

Every item has an id, unique within the instrument, and its text. Item IDs name the question, not the column: the same item is ems_1 in every wave even if the column is ems_1_w1 in one file and ems_1_w2 in the next. The column map makes that link.

An item’s type is one of:

For a pipeline’s features, every item is a number and its text says what it is:

items:
  - {id: frontal_alpha_asymmetry, label: Frontal alpha asymmetry, text: "Frontal alpha asymmetry: log alpha power at F4 minus F3", type: number, min: -3, max: 3}
  - {id: epochs_kept, label: Clean epochs, text: "Clean two-second epochs kept, out of 60", type: number, min: 0, max: 60}

Number items can be used directly in correlations, regressions and multilevel models, without a score. A label gives an item a short name for those tables and the text written from them; without one, the item’s full text is used.

Response sets

A response set is a named list of options, each with the value stored in the data and the label the respondent saw. Items use default_response_set unless they name another with response_set. A value in the data that is neither an option nor a missing code is reported as a problem.

Scores

A score combines items:

KeyMeaning
id, labelThe score’s ID and its name, such as Total or Anxiety.
methodsum, mean, or script (below).
itemsThe item IDs in the score.
missing_ruleWhat to do when items are missing (below).
min_validThe fewest answered items that still give a score: needed with prorate, 1 with zero when not given.

The missing rules:

Items marked reverse: true are reversed before scoring, using their response options: on a 0 to 3 scale, 0 becomes 3 and 3 becomes 0. If the data already hold the reversed values, set reversed_in_data: true on the administration (see Column Maps and Overrides).

labcatalog computes every summed or averaged score itself from the items. If your data also contain a score your lab computed, map that column to score:<id> and labcatalog reports every row where the two disagree. The two agree when they differ by at most half a unit in the last decimal place the column writes, so a score rounded half up or half to even agrees.

A score that is not a sum or a mean, such as one looked up in a norm table or weighted, is computed by a script you write, or have a language model write: give it method: script. The script, usually a prepare step, reads the dataset’s data and writes a CSV with the ID column and one column per score, named by the score’s ID; name that file in the dataset’s scores in labcatalog.yaml, under the instrument’s ID, so two instruments can each have a score called total. The instrument’s page sets this up: its Scoring step starts a script from a template, or takes yours, and registers the step and the file. labcatalog then reads the score from there, matched by ID, and shows and analyses it like any other; an ID the file gives twice takes no score, and Problems lists it. A column of that file for a summed or averaged score is checked against labcatalog’s own, as above.

References and license

references lists the instrument’s references by their key in references.bib, each with an optional pdf, a path inside the references folder. license says how the instrument may be used. Both are shown on the instrument’s page, and the Instruments list flags instruments that have neither.

Custom fields and tags

A lab often wants its own fields, such as a domain for each instrument or topics for each score. Declare them in labcatalog.yaml:

custom_fields:
  - {name: domain, label: Domain, applies_to: instrument, type: choice, choices: [emotion, family, health, media]}
  - {name: topics, label: Topics, applies_to: score, type: tags, choices: [negative affect, positive affect, sleep]}

and fill them in under custom:

custom:
  domain: emotion
scores:
  - {id: ems_sadness, label: Sadness, method: sum, items: [ems_2, ems_6, ems_7], custom: {topics: [negative affect]}}

A field can apply to an instrument, a score, an item, an administration, a dataset or a study, and be text, number, date, choice or tags. An item’s values go under its own custom in the instrument file, and a study’s under studies.<study>.custom in labcatalog.yaml. Choice and tags fields can be added to the filters on the Instruments page with browse.facets. A filter on a score or item field finds the instruments with such a score or item, and one on a study field finds the instruments given in that study. A field can also take its choices from a vocabulary that comes with labcatalog; Tag Scores with RDoC uses the RDoC domains and constructs.