{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://schema.humancellatlas.org/type/project/20.0.0/project",
  "description": "A project entity contains information about the overall project.",
  "additionalProperties": false,
  "required": [
    "describedBy",
    "schema_type",
    "project_core",
    "funders",
    "data_use_restriction"
  ],
  "title": "Project",
  "name": "project",
  "type": "object",
  "properties": {
    "describedBy": {
      "description": "The URL reference to the schema.",
      "type": "string",
      "pattern": "^(http|https)://schema.(.*?)humancellatlas.org/type/project/(([0-9]{1,}.[0-9]{1,}.[0-9]{1,})|([a-zA-Z]*?))/project"
    },
    "schema_version": {
      "description": "The version number of the schema in major.minor.patch format.",
      "type": "string",
      "pattern": "^[0-9]{1,}.[0-9]{1,}.[0-9]{1,}$",
      "example": "4.6.1"
    },
    "schema_type": {
      "description": "The type of the metadata schema entity.",
      "type": "string",
      "enum": [
        "project"
      ]
    },
    "provenance": {
      "description": "Provenance information provided by the system.",
      "type": "object",
      "$ref": "https://schema.humancellatlas.org/system/1.1.0/provenance"
    },
    "project_core": {
      "description": "Core project-level information.",
      "type": "object",
      "$ref": "https://schema.humancellatlas.org/core/project/7.0.5/project_core",
      "user_friendly": "Project core"
    },
    "contributors": {
      "description": "People contributing to any aspect of the project.",
      "type": "array",
      "items": {
        "$ref": "https://schema.humancellatlas.org/module/project/9.0.0/contact"
      },
      "user_friendly": "Contributors"
    },
    "supplementary_links": {
      "description": "External link(s) pointing to code, supplementary data files, or analysis files associated with the project which will not be uploaded.",
      "type": "array",
      "example": "https://github.com/czbiohub/tabula-muris; http://celltag.org/",
      "items": {
        "type": "string"
      },
      "user_friendly": "Supplementary link(s)"
    },
    "publications": {
      "description": "Publications resulting from this project.",
      "type": "array",
      "items": {
        "$ref": "https://schema.humancellatlas.org/module/project/7.0.0/publication"
      },
      "user_friendly": "Publications"
    },
    "hca_bionetworks": {
      "description": "HCA Bionetworks and Atlases the project is associated with",
      "type": "array",
      "items": {
        "$ref": "https://schema.humancellatlas.org/module/project/2.0.0/hca_bionetwork"
      },
      "user_friendly": "HCA Bionetwork(s)"
    },
    "insdc_project_accessions": {
      "description": "An International Nucleotide Sequence Database Collaboration (INSDC) project accession.",
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[D|E|S]RP[0-9]+$"
      },
      "example": "SRP000000",
      "user_friendly": "INSDC project accession",
      "guidelines": "Enter accession if project has been archived. Accession can be from the DDBJ, NCBI, or EMBL-EBI and must start with DRP, SRP, or ERP, respectively."
    },
    "ega_accessions": {
      "description": "A list of accessions referring to EGA (European Genome-Phenome Archive) datasets or studies.",
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^EGA[DS][0-9]{11}$"
      },
      "example": "EGAS00000000001; EGAD00000000002",
      "guidelines": "Enter any EGA study or dataset accessions that relate to the project. Should start with EGAD or EGAS, study accession preferred.",
      "user_friendly": "EGA Study/Dataset Accession(s)"
    },
    "dbgap_accessions": {
      "description": "A list of database of Genotypes and Phenotypes (dbGaP) study accessions.",
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^phs[0-9]{6}(\\.v[0-9])?(\\.p[0-9])?$"
      },
      "example": "phs001997.v1.p1; phs001836",
      "guidelines": "Enter any dbGaP study accessions that relate to this project. Should start with phs, can contain the specific version information.",
      "user_friendly": "dbGaP Study Accession(s)"
    },
    "geo_series_accessions": {
      "description": "A Gene Expression Omnibus (GEO) series accession.",
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^GSE.*$"
      },
      "example": "GSE00000",
      "user_friendly": "GEO series accession",
      "guidelines": "Enter accession if project has been archived. Accession must start with GSE."
    },
    "array_express_accessions": {
      "description": "An ArrayExpress accession.",
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^E-....-.*$"
      },
      "example": "E-AAAA-00",
      "user_friendly": "ArrayExpress accession",
      "guidelines": "Enter accession if project has been archived. Accession must start with E-."
    },
    "insdc_study_accessions": {
      "description": "An International Nucleotide Sequence Database Collaboration (INSDC) study accession.",
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^PRJ[E|N|D][a-zA-Z][0-9]+$"
      },
      "example": "PRJNA000000",
      "user_friendly": "INSDC study accession",
      "guidelines": "Enter accession if study has been archived. Accession can be from the DDBJ, NCBI, or EMBL-EBI and must start with PRJD, PRJN, or PRJE, respectively."
    },
    "biostudies_accessions": {
      "description": "A BioStudies study accession.",
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^S-[A-Z]{4}[0-9]+$"
      },
      "example": "S-EXMP1; S-HCAS33",
      "user_friendly": "BioStudies accession",
      "guidelines": "Enter accession if study has been archived."
    },
    "funders": {
      "description": "Funding source(s) supporting the project.",
      "type": "array",
      "items": {
        "$ref": "https://schema.humancellatlas.org/module/project/2.0.0/funder"
      },
      "user_friendly": "Funding source(s)"
    },
    "estimated_cell_count": {
      "description": "An estimated number of cells in this project",
      "type": "integer",
      "example": "10000; 2100000",
      "user_friendly": "Estimated cell count"
    },
    "data_use_restriction": {
      "description": "Data use restrictions that apply to the project.",
      "type": "string",
      "enum": [
        "NRES",
        "GRU",
        "GRU-NCU"
      ],
      "user_friendly": "Data use restriction",
      "guidelines": "Must be one of: NRES, GRU, GRU-NCU. The use restriction codes are based on the DUO ontology where NRES corresponds to DUO:0000004, GRU corresponds to DUO:0000042, GRU-NCU corresponds to a combination of DUO:0000042 and DUO:0000046",
      "example": "GRU"
    },
    "duos_id": {
      "description": "A DUOS dataset id.",
      "type": "string",
      "pattern": "^DUOS-\\d{6}$",
      "example": "DUOS-000108; DUOS-000114",
      "user_friendly": "DUOS ID",
      "guidelines": "Managed access projects are registered in DUOS to regulate access. If the project is managed access record the corresponding DUOS ID here."
    }
  },
  "if": {
    "properties": {
      "data_use_restriction": {
        "enum": [
          "GRU",
          "GRU-NCU"
        ]
      }
    }
  },
  "then": {
    "required": [
      "duos_id"
    ]
  },
  "else": {
    "properties": {
      "data_use_restriction": {
        "enum": [
          "NRES"
        ]
      },
      "duos_id": {
        "maxLength": 0
      }
    }
  }
}
