{
  "$id": "https://schema.aireadi.org/v0.1.0/dataset_structure_description.json",
  "$schema": "http://json-schema.org/draft-07/schema",
  "title": "Dataset Structure Description",
  "description": "This is the schema for the dataset_structure_description.json metadata file from the Clinical Multimodal Data Structure (CMDS). Some of the elements are defined following the dataset_description.json file of the CMDS.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "schema": {
      "description": "Link to the schema to be included so that users of the resulting JSON file can find the related schema easily",
      "type": "string",
      "const": "https://schema.aireadi.org/v0.1.0/dataset_structure_description.json"
    },
    "directoryList": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/directoryItem",
        "description": "Description of the directories"
      }
    },
    "metadataFileList": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/metadataFileItem",
        "description": "Description of the directories"
      }
    }
  },
  "required": ["schema", "directoryList", "metadataFileList"],
  "definitions": {
    "directoryItem": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "directoryName": {
          "type": "string",
          "minLength": 1,
          "description": "The name of the directory"
        },
        "directoryType": {
          "type": "string",
          "oneOf": [
            {
              "const": "dataType",
              "description": "For a datatype directory"
            },
            {
              "const": "modality",
              "description": "For a modality directory"
            },
            {
              "const": "device",
              "description": "For a device directory"
            }
          ]
        },
        "directoryDescription": {
          "type": "string",
          "minLength": 1,
          "description": "A description of the content of the directory",
          "examples": ["retinal_oct"]
        },
        "relatedIdentifier": {
          "type": "array",
          "description": "Identifiers of resources related to this directory, for instance to a documentation about the content of this directory and possibly its sub-directories. These must be globally unique identifiers.",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "relatedIdentifierValue": {
                "type": "string",
                "minLength": 1,
                "description": "Identifier of the related resource. Must be globally unique."
              },
              "relatedIdentifierType": {
                "$ref": "#/definitions/identifierType",
                "description": "The type of the relatedIdentifier. Must be from the controlled list of identifierType."
              },
              "relationType": {
                "$ref": "#/definitions/relationType",
                "description": "The type of relationship between the dataset (A) and the related resource (B). Must be from the controlled list of relationType."
              },
              "resourceTypeGeneral": {
                "$ref": "#/definitions/resourceItemType",
                "description": "The general type of the related resource. Must be from the controlled list of resourceItemType."
              },
              "relatedIdentifierDescription": {
                "type": "string",
                "minLength": 1,
                "description": "Description of the related resource."
              }
            },
            "required": [
              "relatedIdentifierValue",
              "relatedIdentifierType",
              "relationType"
            ]
          },
          "uniqueItems": true
        },
        "relatedTerm": {
          "type": "array",
          "description": "Keywords related to the directory such as alternative names. Use terminology from ontologies if available (e.g., search at https://bioportal.bioontology.org/). ",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "relatedTermValue": {
                "type": "string",
                "minLength": 1,
                "description": "The keyword or key phrase that relates to the directory"
              },
              "relatedTermIdentifier": {
                "type": "array",
                "description": "If the related term is from an ontology, provide details here.",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "relatedTermClassificationCode": {
                      "type": "string",
                      "minLength": 1,
                      "description": "The classification code used for the related term"
                    },
                    "relatedTermScheme": {
                      "type": "string",
                      "minLength": 1,
                      "description": "The name of the scheme or classification code or authority if one is used (e.g., name of ontology)"
                    },
                    "relatedTermSchemeURI": {
                      "type": "string",
                      "minLength": 1,
                      "description": "The URI of the identifier scheme"
                    },
                    "relatedTermValueURI": {
                      "type": "string",
                      "minLength": 1,
                      "description": "The URI of the related term in the scheme"
                    }
                  },
                  "required": [
                    "relatedTermClassificationCode",
                    "relatedTermScheme"
                  ]
                }
              }
            },
            "required": ["relatedTermValue"]
          },
          "uniqueItems": true
        },
        "relatedStandard": {
          "type": "array",
          "description": "Standard followed in this directory to structure the data, choose file format, etc. This applies also to all sub-directories.",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "standardName": {
                "type": "string",
                "minLength": 1,
                "description": "The name of the standard"
              },
              "standardDescription": {
                "type": "string",
                "minLength": 1,
                "description": "A description of the standard",
                "examples": ["retinal_oct"]
              },
              "standardUse": {
                "type": "string",
                "minLength": 1,
                "description": "A description of how the standard is used in this directory"
              },
              "standardIdentifier": {
                "type": "array",
                "items": {
                  "type": "object",
                  "description": "Identifier(s) of the standard (e.g., identifier from https://fairsharing.org/)",
                  "additionalProperties": false,
                  "properties": {
                    "identifierValue": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Unique string that identifies the standard."
                    },
                    "identifierType": {
                      "$ref": "#/definitions/identifierType",
                      "description": "The type of identifier used to identify the standard. Must be from the controlled list of identifierType."
                    }
                  },
                  "required": ["identifierValue", "identifierType"]
                },
                "uniqueItems": true
              },
              "standardRelatedIdentifier": {
                "type": "array",
                "description": "Identifiers of resources related to the standard such as manuscript describing the standard or documentation. These must be globally unique identifiers.",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "relatedIdentifierValue": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Identifier of the related resource. Must be globally unique."
                    },
                    "relatedIdentifierType": {
                      "$ref": "#/definitions/identifierType",
                      "description": "The type of the relatedIdentifier. Must be from the controlled list of identifierType."
                    },
                    "relationType": {
                      "$ref": "#/definitions/relationType",
                      "description": "The type of relationship between the standard (A) and the related resource (B). Must be from the controlled list of relationType."
                    },
                    "resourceTypeGeneral": {
                      "$ref": "#/definitions/resourceItemType",
                      "description": "The general type of the related resource. Must be from the controlled list of resourceItemType."
                    }
                  },
                  "required": [
                    "relatedIdentifierValue",
                    "relatedIdentifierType",
                    "relationType"
                  ]
                },
                "uniqueItems": true
              }
            }
          },
          "uniqueItems": true
        },
        "directoryList": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/directoryItem",
            "description": "Description of the sub-directories within this directory"
          }
        },
        "metadataFileList": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/metadataFileItem",
            "description": "Description of the metadata files within this directory"
          }
        }
      },
      "required": ["directoryName", "directoryType"],
      "if": {
        "properties": {
          "directoryType": {
            "const": "dataType"
          }
        }
      },
      "then": {
        "required": ["directoryDescription"]
      }
    },
    "metadataFileItem": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "metadataFileName": {
          "type": "string",
          "minLength": 1,
          "description": "The name of the directory"
        },
        "metadataFileDescription": {
          "type": "string",
          "minLength": 1,
          "description": "A description of the content of the directory",
          "examples": ["retinal_oct"]
        },
        "relatedIdentifier": {
          "type": "array",
          "description": "Identifiers of resources related to the metadata file, for instance to a documentation about the metadata file. These must be globally unique identifiers.",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "relatedIdentifierValue": {
                "type": "string",
                "minLength": 1,
                "description": "Identifier of the related resource. Must be globally unique."
              },
              "relatedIdentifierType": {
                "$ref": "#/definitions/identifierType",
                "description": "The type of the relatedIdentifier. Must be from the controlled list of identifierType."
              },
              "relationType": {
                "$ref": "#/definitions/relationType",
                "description": "The type of relationship between the metadata file (A) and the related resource (B). Must be from the controlled list of relationType."
              },
              "resourceTypeGeneral": {
                "$ref": "#/definitions/resourceItemType",
                "description": "The general type of the related resource. Must be from the controlled list of resourceItemType."
              }
            },
            "required": [
              "relatedIdentifierValue",
              "relatedIdentifierType",
              "relationType"
            ]
          },
          "uniqueItems": true
        },
        "relatedStandard": {
          "type": "array",
          "description": "Standard followed to structure the metadata, choose file format, etc.",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "standardName": {
                "type": "string",
                "minLength": 1,
                "description": "The name of the standard"
              },
              "standardDescription": {
                "type": "string",
                "minLength": 1,
                "description": "A description of the standard",
                "examples": ["retinal_oct"]
              },
              "standardUse": {
                "type": "string",
                "minLength": 1,
                "description": "A description of how the standard is used for this metadata file"
              },
              "standardIdentifier": {
                "type": "array",
                "items": {
                  "type": "object",
                  "description": "Identifier(s) of the standard (e.g., identifier from https://fairsharing.org/)",
                  "additionalProperties": false,
                  "properties": {
                    "identifierValue": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Unique string that identifies the standard."
                    },
                    "identifierType": {
                      "$ref": "#/definitions/identifierType",
                      "description": "The type of identifier used to identify the standard. Must be from the controlled list of identifierType."
                    }
                  },
                  "required": ["identifierValue", "identifierType"]
                },
                "uniqueItems": true
              },
              "standardRelatedIdentifier": {
                "type": "array",
                "description": "Identifiers of resources related to the standard such as manuscript describing the standard or documentation. These must be globally unique identifiers.",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "relatedIdentifierValue": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Identifier of the related resource. Must be globally unique."
                    },
                    "relatedIdentifierType": {
                      "$ref": "#/definitions/identifierType",
                      "description": "The type of the relatedIdentifier. Must be from the controlled list of identifierType."
                    },
                    "relationType": {
                      "$ref": "#/definitions/relationType",
                      "description": "The type of relationship between the standard (A) and the related resource (B). Must be from the controlled list of relationType."
                    },
                    "resourceTypeGeneral": {
                      "$ref": "#/definitions/resourceItemType",
                      "description": "The general type of the related resource. Must be from the controlled list of resourceItemType."
                    }
                  },
                  "required": [
                    "relatedIdentifierValue",
                    "relatedIdentifierType",
                    "relationType"
                  ]
                },
                "uniqueItems": true
              }
            }
          },
          "uniqueItems": true
        }
      },
      "required": ["metadataFileName", "metadataFileDescription"]
    },
    "identifierType": {
      "type": "string",
      "oneOf": [
        {
          "const": "ARK",
          "description": "Archival Resource Key: a URI designed to support long-term access to information objects. In general, ARK syntax is of the form (brackets, []. indicate optional elements): [http://NMA/]ark:/NAAN/Name [Qualifier]]"
        },
        {
          "const": "arXiv",
          "description": "arXiv identifier: arXiv.org is a repository of preprints of scientific papers in the fields of mathematics, physics, astronomy, computer science, quantitative biology, statistics, and quantitative finance."
        },
        {
          "const": "bibcode",
          "description": "Astrophysics Data System bibliographic codes: a standardized 19-character identifier according to the syntax yyyyjjjjjvvvvmppppa. See http://info-uri.info/registry/OAIHandler?verb=GetRecord&metadataPrefix=reg&identifier=info:bibcode/"
        },
        {
          "const": "DOI",
          "description": "Digital Object Identifier: a character string used to uniquely identify an object. A DOI name is divided into two parts, a prefix and a suffix, separated by a slash."
        },
        {
          "const": "EAN13",
          "description": "European Article Number, now renamed International Article Number, but retaining the original acronym, is a 13-digit barcoding standard that is a superset of the original 12-digit Universal Product Code (UPC) system"
        },
        {
          "const": "EISSN",
          "description": "Electronic International Standard Serial Number: ISSN used to identify periodicals in electronic form (eISSN or e ISSN)."
        },
        {
          "const": "Handle",
          "description": "This refers specifically to an ID in the Handle system operated by the Corporation for National Research Initiatives (CNRI)"
        },
        {
          "const": "IGSN",
          "description": "International Geo Sample Number: a 9-digit alphanumeric code that uniquely identifies samples from our natural environment and related sampling features."
        },
        {
          "const": "ISBN",
          "description": "International Standard Book Number: a unique numeric book identifier. There are 2 formats: a 10-digit ISBN format and a 13- digit ISBN."
        },
        {
          "const": "ISSN",
          "description": "International Standard Serial Number: a unique 8-digit number used to identify a print or electronic periodical publication."
        },
        {
          "const": "ISTC",
          "description": "International Standard Text Code: a unique `number` assigned to a textual work. An ISTC consists of 16 numbers and/or letters."
        },
        {
          "const": "LISSN",
          "description": "The linking ISSN or ISSN-L enables collocation or linking among different media versions of a continuing resource."
        },
        {
          "const": "LSID",
          "description": "Life Science Identifiers: a unique identifier for data in the Life Science domain. Format: urn:lsid:authority:namespace:identifier:revision"
        },
        {
          "const": "PMID",
          "description": "PubMed Identifier: a unique identifier assigned to each PubMed record."
        },
        {
          "const": "PURL",
          "description": "Persistent Uniform Resource Locator. A PURL has three parts: (1) a protocol, (2) a resolver address, and (3) a name."
        },
        {
          "const": "UPC",
          "description": "Universal Product Code is a barcode symbology used for tracking trade items in stores. Its most common form, the UPC-A, consists of 12 numerical digits."
        },
        {
          "const": "URL",
          "description": "Uniform Resource Locator, also known as web address, is a specific character string that constitutes a reference to a resource. The syntax is: scheme://domain:port/path?qu ery_string#fragment_id"
        },
        {
          "const": "URN",
          "description": "Uniform Resource Name: a unique and persistent identifier of an electronic document. The syntax is: urn:< NID>:<NSS> The leading urn: sequence is case-insensitive, <NID> is the namespace identifier, <NSS> is the namespace-specific string."
        },
        {
          "const": "w3id",
          "description": "Permanent identifier for Web applications. Mostly used to publish vocabularies and ontologies. The letters `w3` stand for `World Wide Web`."
        },
        {
          "const": "Other",
          "description": "None of the listed identifier types."
        }
      ]
    },
    "resourceItemType": {
      "type": "string",
      "oneOf": [
        {
          "const": "Audiovisual",
          "description": "A series of visual representations imparting an impression of motion when shown in succession. May or may not include sound."
        },
        {
          "const": "Book",
          "description": "A medium for recording information in the form of writing or images, typically composed of many pages bound together and protected by a cover"
        },
        {
          "const": "BookChapter",
          "description": "One of the main divisions of a book."
        },
        {
          "const": "Collection",
          "description": "An aggregation of resources, which may encompass collections of one resourceType as well as those of mixed types. A collection is described as a group; its parts may also be separately described. "
        },
        {
          "const": "ComputationalNotebook",
          "description": "A virtual notebook environment used for literate programming"
        },
        {
          "const": "ConferencePaper",
          "description": "Article that is written with the goal of being accepted to a conference"
        },
        {
          "const": "ConferenceProceeding",
          "description": "Collection of  academic papers  published in the  context of an  academic conference"
        },
        {
          "const": "DataPaper",
          "description": "A factual and objective publication with a focused intent to identify and describe specific data, sets of data, or data collections to facilitate discoverability"
        },
        {
          "const": "Dataset",
          "description": "Data encoded in a defined structure"
        },
        {
          "const": "Dissertation",
          "description": "A written essay,  treatise, or thesis, especially one written by a candidate for the degree of Doctor of Philosophy"
        },
        {
          "const": "Event",
          "description": "A non-persistent, time-based occurrence"
        },
        {
          "const": "Image",
          "description": "A visual representation other than text"
        },
        {
          "const": "InteractiveResource",
          "description": "A resource requiring interaction from the user to be understood, executed, or experienced"
        },
        {
          "const": "Journal",
          "description": "A scholarly  publication consisting of articles that is  published regularly throughout the year."
        },
        {
          "const": "JournalArticle",
          "description": "A written composition on a topic of interest, which forms a separate part of a journal."
        },
        {
          "const": "Model",
          "description": "An abstract, conceptual, graphical, mathematical or visualization model that represents empirical objects, phenomena, or physical processes"
        },
        {
          "const": "OutputManagementPlan",
          "description": "A formal document that outlines how  research outputs are to be handled both during a research  project and after the project is completed"
        },
        {
          "const": "PeerReview",
          "description": "Evaluation of  scientific, academic, or professional work by others working in the same field"
        },
        {
          "const": "PhysicalObject",
          "description": "An inanimate, three dimensional object or substance"
        },
        {
          "const": "Preprint",
          "description": "A version of a  scholarly or scientific paper that precedes formal peer review and publication in a peer-reviewed scholarly or scientific journal "
        },
        {
          "const": "Report",
          "description": "A document that presents information in an organized  format for a specific audience and purpose"
        },
        {
          "const": "Service",
          "description": "An organized system of apparatus, appliances, staff, etc., for supplying some function(s) required by end users"
        },
        {
          "const": "Software",
          "description": "A computer program other than a computational notebook, in either source code (text) or compiled form. Use this type for general software components supporting scholarly research. Use the “ComputationalNoteb ook” value for virtual notebooks."
        },
        {
          "const": "Sound",
          "description": "A resource primarily intended to be heard"
        },
        {
          "const": "Standard",
          "description": "Something  established by authority, custom, or general consent as a model, example, or point of reference"
        },
        {
          "const": "Text",
          "description": "A resource consisting primarily of words for reading that is not covered by any other textual resource type in this list"
        },
        {
          "const": "Workflow",
          "description": "A structured series of steps which can be executed to produce a final outcome, allowing users a means to specify and enact their work in a more reproducible manner"
        },
        {
          "const": "Other",
          "description": "If selected, supply a value for ResourceType."
        }
      ]
    },
    "relationType": {
      "type": "string",
      "description": "Description of the relationship of the dataset (A) and the related resource (B).",
      "oneOf": [
        {
          "const": "IsCitedBy",
          "description": "Indicates that B includes A in a citation"
        },
        {
          "const": "Cites",
          "description": "Indicates that A includes B in a citation"
        },
        {
          "const": "IsSupplementTo",
          "description": "Indicates that A is a supplement to B"
        },
        {
          "const": "IsSupplementedBy",
          "description": "Indicates that B is a supplement to A"
        },
        {
          "const": "IsContinuedBy",
          "description": "Indicates A is continued by the work B"
        },
        {
          "const": "Continues",
          "description": "Indicates A is a continuation of the work B"
        },
        {
          "const": "Describes",
          "description": "Indicates A describes B"
        },
        {
          "const": "IsDescribedBy",
          "description": "Indicates A is described by B"
        },
        {
          "const": "HasMetadata",
          "description": "Indicates resource A has additional metadata B"
        },
        {
          "const": "IsMetadataFor",
          "description": "Indicates additional metadata A for a resource B"
        },
        {
          "const": "HasVersion",
          "description": "Indicates A has a version (B)"
        },
        {
          "const": "IsVersionOf",
          "description": "Indicates A is a version of B"
        },
        {
          "const": "IsNewVersionOf",
          "description": "Indicates A is a new edition of B, where the new edition has been modified or updated"
        },
        {
          "const": "IsPreviousVersionOf",
          "description": "Indicates A is a previous edition of B"
        },
        {
          "const": "IsPartOf",
          "description": "Indicates A is a portion of B; may be used for elements of a series"
        },
        {
          "const": "HasPart",
          "description": "Indicates A includes the part B"
        },
        {
          "const": "IsPublishedIn",
          "description": "Indicates A is published inside B, but is independent of other things published inside of B"
        },
        {
          "const": "IsReferencedBy",
          "description": "Indicates A is used as a source of information by B"
        },
        {
          "const": "References",
          "description": "Indicates B is used as a source of information for A"
        },
        {
          "const": "IsDocumentedBy",
          "description": "Indicates B is documentation about/ explaining A; e.g. points to software documentation"
        },
        {
          "const": "Documents",
          "description": "Indicates A is documentation about B; e.g. points to software documentation"
        },
        {
          "const": "IsCompiledBy",
          "description": "Indicates B is used to compile or create A"
        },
        {
          "const": "Compiles",
          "description": "Indicates B is the result of a compile or creation event using  A"
        },
        {
          "const": "IsVariantFormOf",
          "description": "Indicates A is a variant or different form of B"
        },
        {
          "const": "IsOriginalFormOf",
          "description": "Indicates A is the original form of B"
        },
        {
          "const": "IsIdenticalTo",
          "description": "Indicates that A is identical to B, for use when there is a need to register two separate instances of the same resource"
        },
        {
          "const": "IsReviewedBy",
          "description": "Indicates that A is reviewed by B"
        },
        {
          "const": "Reviews",
          "description": "Indicates that A is a review of B"
        },
        {
          "const": "IsDerivedFrom",
          "description": "Indicates B is a source upon which A is based"
        },
        {
          "const": "IsSourceOf",
          "description": "Indicates A is a source upon which B is based"
        },
        {
          "const": "IsRequiredBy",
          "description": "Indicates A is required by B"
        },
        {
          "const": "Requires",
          "description": "Indicates A requires B"
        },
        {
          "const": "Obsoletes",
          "description": "Indicates A replaces B"
        },
        {
          "const": "IsObsoletedBy",
          "description": "Indicates A is replaced by B"
        },
        {
          "const": "IsCollectedBy",
          "description": "Indicates A is collected by B"
        },
        {
          "const": "Collects",
          "description": "Indicates A collects B"
        }
      ]
    }
  }
}
