Developer documentation · schema 3.1.8GitHub
Fair3RFDF schema

Writing the schema

Practical changes

Change a label or placeholder

Edit the field directly:

{
  "id": "gene_search",
  "label": "Gene (symbol, name or ID)",
  "placeholder": "E.g. Apoe, MGI:88057"
}

Add a new section

Add an object to the sections array:

{
  "id": "funding",
  "title": "Funding Information",
  "icon": "$",
  "open_default": false,
  "fields": [
    {
      "id": "funder_name",
      "label": "Funder Name",
      "type": "text",
      "output": {
        "path": "fundingReferences",
        "mode": "append",
        "tpl": { "funderName": "$value" }
      }
    }
  ],
  "display_mapping": {
    "source": "fundingReferences",
    "display_type": "list"
  }
}

Add a linked DOI field

{
  "id": "linked_doi",
  "label": "Linked DOI",
  "type": "text",
  "placeholder": "10.1234/example.doi",
  "output": {
    "path": "relatedIdentifiers",
    "mode": "append",
    "tpl": {
      "relatedIdentifier": "$value",
      "relatedIdentifierType": "DOI",
      "relationType": "IsSupplementTo"
    }
  }
}

Make a section conditional

{
  "id": "sequencing",
  "condition": {
    "type": "checkbox_includes",
    "field_id": "intervention_types",
    "value": "SEQ"
  }
}

Change the API per taxon

{
  "id": "allele_search",
  "type": "api_search",
  "api": "ensembl_allele",
  "api_by_taxon": {
    "10090": "alliance_allele_search_mouse",
    "10116": "alliance_allele_search_rat"
  }
}

Add an auto-filled but editable field

Pair an api_search field with a text field the user can still type into when the API doesn't have the data — see Auto-filled but editable field for the full explanation:

{
  "id": "allele_search",
  "type": "api_search",
  "api": "my_allele_api",
  "update_display_field": "mutation_type"
},
{
  "id": "mutation_type",
  "label": "Mutation Type",
  "type": "text",
  "allow_manual": true,
  "dependent_on_field": "allele_search",
  "bind_to": "geneMutationType",
  "help": "Auto-filled when the API provides it; enter manually otherwise."
}

Make sure the API's mapper.extra actually sets the key referenced by bind_to (here geneMutationType) — otherwise the field will just stay empty and rely entirely on manual entry.


Edit this page on GitHub