Developer documentation · schema 3.1.8GitHub
Fair3RFDF schema

Writing the schema

Field types reference

text — short free-text field

{
  "id": "my_text",
  "label": "Title",
  "type": "text",
  "required": true,
  "output": { "path": "title", "mode": "set" }
}

textarea — long structured text

{
  "id": "abstract",
  "label": "Abstract",
  "type": "textarea",
  "rows": 6,
  "output": {
    "path": "descriptions",
    "mode": "append",
    "tpl": { "description": "$value", "descriptionType": "Abstract" }
  }
}

number — numeric with bounds

{
  "id": "publication_year",
  "label": "Publication Year",
  "type": "number",
  "min": 2000,
  "max": 2030,
  "output": { "path": "publicationYear", "mode": "set_int" }
}

select — single choice from fixed options

{
  "id": "resource_type",
  "label": "Resource Type",
  "type": "select",
  "options": [
    { "value": "Dataset", "label": "Dataset" },
    { "value": "Image", "label": "Image" }
  ],
  "output": {
    "path": "types",
    "mode": "append",
    "tpl": { "resourceType": "$value" }
  }
}

Without a default, the browser still shows the first <option> as selected — the field only has no real value once the user explicitly picks a different one or an empty option. For an optional field (required: false, no default) where that would be misleading, add { "value": "", "label": "— Not specified —" } as the first option: mode: "append_if" already skips the empty string, so nothing gets submitted until the user actually chooses. See sections.disease.disease_source.

checkbox_group — boolean toggles that open sections

{
  "id": "intervention_types",
  "label": "Select interventions",
  "type": "checkbox_group",
  "options": [
    {
      "value": "GENE",
      "label": "Genetic Modification",
      "opens_section": "genes"
    }
  ]
}

multi_select — multiple selection from a vocabulary

{
  "id": "contributor_roles",
  "label": "CRediT Roles",
  "type": "multi_select",
  "vocabulary": "credit_roles",
  "output": {
    "path": "contributors",
    "mode": "append_from_array"
  }
}

api_search — remote search with manual fallback

{
  "id": "gene_search",
  "label": "Gene Symbol",
  "type": "api_search",
  "api": "mygene",
  "allow_manual": true,
  "show_xrefs": true,
  "xref_concept": "Gene",
  "placeholder": "E.g. Apoe...",
  "output": {
    "path": "subjects",
    "mode": "append",
    "tpl": {
      "subject": "$label",
      "subjectScheme": "$scheme",
      "valueURI": "$id"
    }
  }
}

preset_or_search — quick presets + API fallback

{
  "id": "organism_choice",
  "label": "Model Organism",
  "type": "preset_or_search",
  "vocabulary": "organism_presets",
  "search_api": "ols_ncbitaxon",
  "output": {
    "path": "subjects",
    "mode": "append",
    "tpl": {
      "subject": "$label",
      "subjectScheme": "NCBITaxon",
      "valueURI": "$id"
    }
  }
}

Auto-filled but editable field (bind_to)

A plain field can be wired to copy a value out of a related api_search field's selected result, while staying editable — use this when auto-fill from the API isn't always reliable. sections.genes.mutationType_display is a real example: it's filled from whichever allele the user picked, but the user can type over it when the API had nothing useful:

{
  "id": "allele_search",
  "type": "api_search",
  "api": "ensembl_allele",
  "update_display_field": "mutationType_display"
},
{
  "id": "mutationType_display",
  "label": "Mutation Type",
  "type": "text",
  "allow_manual": true,
  "dependent_on_field": "allele_search",
  "bind_to": "consequenceType || geneMutationType",
  "help": "Auto-filled from the allele search when the API provides it. If it stays empty or looks wrong, enter it manually."
}

Edit this page on GitHub