{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Data origin schema",
  "type": "object",
  "properties": {
    "scope": {
      "type": "array",
      "enum": [
        "runtime",
        "data build"
      ],
      "description": "The scope/use case the data is used for, e.g. data is part of the infrastructure needed on runtime to execute scripts (bowtie indices) or an input/import product to build other data products (M5NR)"
    },
    "name": {
      "type": "string",
      "description": "original (file)name of the data downloaded from (data)source"
    },
    "version": {
      "type": "object",
      "properties": {
        "external": {
          "type": "string",
          "description": "external version number assigned by data source, e.g. Refseq version 54"
        },
        "internal": {
          "type": "string",
          "pattern": "^\\d+(\\.\\d+(\\.\\d+)?)?$",
          "description": "internal/local version number"
        }
      }
    },
    "download_date": {
      "type": "string",
      "description": "This is the date the file was downloaded from the external source"
    },
    "creation_date": {
      "type": "string",
      "description": "Creation data of the data at external source"
    },
    "origin_url": {
      "type": "string",
      "description": "This is the url of the location from which the data was downloaded"
    },
    "format": {
      "type": "string",
      "enum": [
        "FASTA",
        "FASTQ",
        "GENBBANK",
        "BIOM",
        "TEXT",
        "BOWTIE INDEX",
        "UNIPROT",
        "TAB"
      ],
      "description": "Controlled vocabulary for the file format of the data, e.g. fasta, BIOM, text, bowtie index"
    },
    "type": {
      "type": "string",
      "enum": [
        "PROTEIN",
        "NUCLEOTIDE",
        "RNA",
        "EXPRESSION"
      ],
      "description": "Controlled CV describing the scope/semantic of the data, e.g. data describes protein sequences, expression data"
    },
    "content": {
      "type": "array",
      "enum": [
        "ORGANISM",
        "HUMAN",
        ""
      ],
      "description": "Controlled CV describing the specific semantic of the data, e.g. data from/for Ecoli"
    },
    "source": {
      "type": "object",
      "$ref": "#/definitions/source",
      "definition": "Main data source/repository data is retrieved from, e.g. Uniprot"
    },
    "description": {
      "type": "string",
      "description": "Long description of the data"
    },
    "citation": {
      "type": "string",
      "description": "This is a citation or doi"
    }
  },
  "required": [
    "runtime_data",
    "source",
    "type",
    "name",
    "version"
  ],
  "definitions": {
    "source": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "enum": [
            "UniProt"
          ],
          "description": "Controlled identifier provided by the external source, e.g. PATRIC, UniProt"
        },
        "url": {
          "type": "string",
          "description": "Primary URL for the source, e.g. uniprot.org"
        },
        "description": {
          "type": "string",
          "description": "Short description describing the source"
        },
        "citation": {
          "type": "object",
          "$ref": "#/definitions/citation"
        }
      },
      "required": [
        "name"
      ]
    },
    "citation": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "DOI",
            "Pubmed",
            "URL"
          ],
          "description": "CV for citation type"
        },
        "id": {
          "type": "string",
          "anyOf": [
            {
              "type": "string",
              "pattern": "^DOI*$"
            },
            {
              "type": "string"
            },
            {
              "type": "string",
              "pattern": "^PUBMED:\\{d}"
            }
          ]
        }
      }
    }
  }
}