Developer documentation · schema 3.1.8GitHub
Fair3RFDF schema

Writing the schema

API configuration

Define external sources in the apis block:

{
  "my_api": {
    "label": "MyGene.info",
    "url": "https://mygene.info/v3/query",
    "query_param": "q",
    "extra_params": {
      "fields": "symbol,name,taxid"
    },
    "extra_params_from_context": {
      "species": "organism_taxon_id"
    },
    "result_path": "hits",
    "result_limit": 8,
    "mapper": {
      "strategy": "flat_object",
      "label": "{{symbol}}",
      "sublabel": "{{name}}",
      "id": "https://identifiers.org/ncbigene:{{_id}}",
      "scheme": "geneAccessionId"
    }
  }
}

Key fields:

Field Description
url API endpoint
query_param Search parameter name
extra_params Fixed query parameters
extra_params_from_context Dynamic params from form fields
path_params_from_context URL path variables from form fields
result_path JSON path to results array
result_limit Max results shown
depends_on Parent field that must be filled first
api_by_taxon Switch API based on selected organism
mapper Transform API response → FDF item

Mapper strategies

extra_params.ontology can list more than one OLS4 ontology at once ("ontology": "so,ncit"): OLS4 returns results from either, ranked together by relevance. Each result's real ontology (item.ontology_prefix, e.g. "SO" or "NCIT") is what the per-result source badge and output.tpl.subjectScheme: "$scheme" resolve to — not the field's single static mapper.scheme, which only matters as a fallback (e.g. for a manually typed value with no selected result). See sections.genes.mutationType_so for a worked example.

Mapper extras & cross-references

Beyond label / sublabel / id / scheme, a mapper can attach extra per-item data and describe how to link out to related records:

"mapper": {
  "strategy": "array",
  "label": "{{symbolText || symbol || id}}",
  "id": "{{id}}",
  "scheme": "alleleAccessionId",
  "source_tag": "Alliance",
  "uri": "https://www.alliancegenome.org/allele/{{id}}",
  "id_candidates": [
    { "tpl": "https://identifiers.org/ncbigene:{{entrezgene}}" },
    { "tpl": "https://www.ensembl.org/id/{{ensembl.gene}}" }
  ],
  "xrefs": {
    "mgi": { "condition": "{{id}}", "id": "{{id}}", "label": "MGI", "uri": "https://www.informatics.jax.org/allele/{{id}}" }
  },
  "extra": {
    "alleleSymbol": "{{symbolText}}",
    "geneMutationType": "{{molecularConsequence[0] || variantType[0]}}"
  }
}
Key Description
extra Per-item key/value data carried on the selected result; read later via bind_to on another field, or $key in this field's own output.obj
uri Direct link template to the source database's own page for the selected item
xrefs Named cross-reference links (id/label/uri, gated by condition) shown alongside the result, keyed by source (e.g. mgi, alliance)
xref_from_extra Builds one cross-reference from a single "PREFIX:ID" string in extra, looked up in xref_catalog — instead of a static xrefs block
xref_from_extra_array Same lookup, but for an extra key holding several "PREFIX:ID" accessions at once (comma-separated), e.g. an ontology term's database_cross_reference list — builds one cross-reference per accession. See ols_mondo
id_candidates Ordered fallback list of id templates, tried when the primary id template resolves empty (e.g. a gene missing entrezgene)
array_dedupe_by_taxid For a result field that can hold several entries across species (e.g. mygene's ensembl.gene), keeps only the one matching the result's own taxon: reads path/field to locate the array, taxid_field to match entries by taxon id, and falls back to prefix_by_taxid (an expected id-prefix per taxid, e.g. ENSMUSG for mouse) when the entry itself carries no usable taxid
detail_fetch After a result is selected, fetches a per-item detail endpoint and merges its data into extra (see below)

Detail fetch (secondary lookup after selection)

Sometimes the search endpoint itself can't carry the data you need — Alliance Genome's allele search tags every single allele with the same generic alterationType ("allele"), not its actual mutation description. detail_fetch lets a mapper fire a second request, scoped to the one result the user picked, and pull richer data from there:

"mapper": {
  "strategy": "array",
  "extra": {
    "geneMutationType": "{{molecularConsequence[0] || variantType[0]}}"
  },
  "detail_fetch": {
    "url": "https://www.alliancegenome.org/api/allele/{{id}}",
    "extra": {
      "geneMutationType": "{{allele.relatedNotes.[?noteType.name=mutation_description].freeText}}"
    }
  }
}

Used by alliance_allele_search_mouse / alliance_allele_search_rat to pull the free-text mutation_description note from Alliance Genome's per-allele API, since the search endpoint alone can't tell a knockout from a point mutation.

detail_fetch.extra can also feed xref_from_extra_array (above) instead of a plain field — OLS4's lightweight /api/select never includes a term's cross-references, only its per-term detail endpoint does. ols_mondo uses this to show/store DOID, OMIM, Orphanet, MeSH, NCIT, UMLS and SNOMED CT cross-references once a disease is selected:

"mapper": {
  "strategy": "obo_ontology",
  "scheme": "MONDO",
  "xref_from_extra_array": "disease_xrefs_raw",
  "extra": {
    "disease_xrefs_raw": "{{annotation.database_cross_reference}}"
  },
  "detail_fetch": {
    "url": "https://www.ebi.ac.uk/ols4/api/ontologies/mondo/terms?short_form={{short_form}}",
    "extra": {
      "disease_xrefs_raw": "{{_embedded.terms[0].annotation.database_cross_reference}}"
    }
  }
}

Note the url queries short_form as a plain parameter (MONDO_0007739, straight from the search result) rather than OLS4's "canonical" term-detail path, which takes the term's full IRI double URL-encoded — detail_fetch.url only does plain {{...}} substitution, no encoding, so a path segment like that would come out malformed. Querying by short_form/obo_id sidesteps the problem entirely and works on any OLS4 ontology, not just MONDO.

Key fields at the API level (sibling of mapper, not inside it):

Key Description
source_tag / dynamic_source_tag Labels which data source produced a result, shown as a badge; dynamic_source_tag: true lets the badge vary per result instead of being fixed to the API's own name
(none — automatic) An obo_ontology mapper's badge needs no source_tag at all: it's always the result's own ontology_prefix. Every badge (set this way or via source_tag/dynamic_source_tag) also gets a color automatically — a fixed blue for names already in xref_catalog/source_tag/allele_source_label, a stable hash-picked color from a small palette for anything else, so a new ontology or source never needs its own color configured
exclude_categories Drops result categories the API returns but this field shouldn't show (e.g. variant on an allele search)
query_prefix_with_gene Prefixes the search query with the selected gene symbol before calling the API
provides_chromosome_location Marks an API (e.g. mygene) as a source for auto-filling gene_chromosome_location
api_fallback Per-taxon list of backup APIs to try if the api_by_taxon API for that taxon fails or returns nothing

Taxon-based API routing

{
  "api": "ensembl_allele",
  "api_by_taxon": {
    "10090": "alliance_allele_search_mouse",
    "10116": "alliance_allele_search_rat",
    "8364": "alliance_variant_search"
  }
}

The API automatically switches based on the selected organism's taxon ID.

Deprecating an API

When a service or a source is replaced (for example the Disease Ontology by MONDO), keep the old entry in apis and declare the replacement on it:

"ols_doid": {
  "label": "Disease Ontology (OLS4)",
  "url": "https://www.ebi.ac.uk/ols4/api/select",
  "mapper": { "strategy": "obo_ontology", "scheme": "DOID" },
  "deprecated": {
    "since": "2026-11-10",
    "replaced_by": "ols_mondo",
    "reason": "Diseases come from MONDO only."
  }
}

Edit this page on GitHub