Commit dfefff5b authored by Vilem Ded's avatar Vilem Ded
Browse files

Merge branch '6-include-JSON-schemas-as-submodule' into 'master'

Resolve "include JSON schemas as submodule"

Closes #6

See merge request pinar.alper/metadata-tools!11
parents fc15087b c0084d2b
[submodule "metadata_tools/resources/json-schemas"]
path = metadata_tools/resources/json-schemas
url = git@github.com:elixir-luxembourg/json-schemas.git
# Elixir LU metadata utilities
## Clone the repository
Do not forget to also **clone the submodules!**
```bash
git clone <repository-url>
git submodule update --init
```
## Development environment setup
Create virtual environment:
```bash
mkdir project_venv
python3 -m venv project_venv
source ./project_venv/bin/activate
```
Install dependencies (single brackets are required if you are using `zsh`):
```bash
pip install -e '.[dev]'
```
## Testing
Run tests with:
```bash
python setup.py test
```
## Current Version
**v0.2.0-dev**
......@@ -144,7 +144,7 @@ def save_exported_datasets_to_file(exported_dataset, output_file):
else:
items = [exported_dataset]
obj = {
"$schema": "https://git-r3lab.uni.lu/pinar.alper/metadata-tools/raw/master/metadata_tools/resources/elu-dataset.json",
"$schema": "https://raw.githubusercontent.com/elixir-luxembourg/json-schemas/master/schemas/elu-dataset.json",
"items": items
}
return json.dump(obj, output_file, ensure_ascii = False, indent=4)
{
"description": "ELIXIR Luxembourg Core json schema",
"title": "Schema containing core attributes for any json serialisable ELIXIR Luxembourg record.",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"required": [
"source",
"name"
],
"properties": {
"source": {
"type": "string",
"format": "uri"
},
"acronym": {
"type": ["string", "null"]
},
"name": {
"type": "string"
},
"description": {
"type": ["string", "null"]
},
"elu_accession": {
"type": ["string", "null"]
},
"elu_uuid": {
"type": ["string", "null"]
},
"other_external_id": {
"type": ["string", "null"]
},
"url": {
"type": ["string", "null"]
},
"contacts": {
"type": "array",
"items": {
"type": "object",
"properties": {
"first_name": {
"type": "string"
},
"last_name": {
"type": "string"
},
"role": {
"type": "string",
"enum": [
"Principal_Investigator",
"Researcher",
"Data_Manager",
"Data_Protection_Officer",
"Legal_Representative",
"Other"
]
},
"email": {
"type": "string",
"format": "email"
},
"affiliations": {
"description": "Names of the affiliated institutions.",
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"type": ["string", "null"]
}
}
},
"required": [
"first_name",
"last_name",
"role",
"email",
"affiliations"
]
}
}
}
}
{
"description": "ELIXIR Luxembourg Projects Schema",
"title": "A JSON Schema for describing biomedical research Projects.",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"allOf": [
{
"$ref": "https://git-r3lab.uni.lu/pinar.alper/metadata-tools/raw/master/metadata_tools/resources/elu-core.json"
}
],
"properties": {
"project": {
"description": "Name of the project the dataset belongs to.",
"type": ["string", "null"]
},
"data_declarations": {
"type": "array",
"items": {
"$ref": "#/definitions/elu:data"
}
},
"storages": {
"type": "array",
"items": {
"$ref": "#/definitions/elu:storage"
}
},
"legal_bases": {
"type": "array",
"items": {
"$ref": "#/definitions/elu:legal_basis"
}
},
"transfers": {
"type": "array",
"items": {
"$ref": "#/definitions/elu:transfer"
}
}
},
"definitions": {
"elu:storage": {
"type": "object",
"properties": {
"platform": {"type": "string"},
"location": {"type": "string"},
"accesses": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"elu:transfer": {
"type": "object",
"properties": {
"partner": {"type": "string"},
"transfer_details": {"type": ["string", "null"]},
"transfer_date": {
"type": ["string", "null"],
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
}
}
},
"elu:legal_basis": {
"type": "object",
"properties": {
"data_declarations": {
"type": "array",
"items": {
"type": "string"
}
},
"legal_basis_codes": {
"type": "array",
"items": {
"type": "string",
"enum": [
"6.1(a)",
"6.1(b)",
"6.1(c)",
"6.1(d)",
"6.1(e)",
"6.1(f)"
]
}},
"personal_data_codes": {
"type": "array",
"items": {
"type": "string",
"enum": [
"Standard",
"Special",
"Race",
"Genetic",
"Biometric",
"Health",
"Sexual orientation",
"Convictions",
"Other"
]
}
},
"legal_basis_notes": {
"type": "string"
}
},
"required": [
"legal_basis_codes",
"personal_data_codes"
]
},
"elu:data": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"use_restrictions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"use_class": {
"type": "string",
"enum": [
"NRES",
"GRU(CC)",
"HMB(CC)",
"DS-[XX](CC)",
"POA",
"RS-[XX]",
"RUO",
"NMDS",
"GSO",
"NPU",
"PUB",
"COL-[XX]",
"RTN",
"IRB",
"GS-[XX]",
"MOR-[XX]",
"TS-[XX]",
"US",
"PS",
"IS",
"IP",
"Other"
]
},
"use_class_note": {
"type": "string"
},
"use_restriction_rule": {
"type": "string",
"enum": [
"CONSTRAINTS",
"NO_CONSTRAINTS",
"FORBIDDEN"
]
},
"use_restriction_objects": {
"type": "array",
"items": {
"type": "string"
},
"use_restriction_note": {
"type": "string"
}
}
},
"required": [
"use_class_note",
"use_restriction_rule"
]
}
},
"data_types": {
"type": "array",
"items": {
"type": "string",
"enum": [
"ATAC-seq",
"Biometric_data",
"ChIP-seq",
"Samples",
"Disease status",
"Ethnic_origin",
"Imaging",
"Omics_data",
"Genotype_data",
"Whole_genome_sequencing",
"Exome_sequencing",
"Genomics_variant_array",
"RNASeq",
"Genetic_and_derived_genetic_data",
"Transcriptome_array",
"Methylation_array",
"MicroRNA_array",
"Metabolomics",
"Metagenomics",
"Metatranscriptomics",
"Metaproteomics",
"Single_Cell_RNAseq",
"Proteomics",
"Other_omics_data",
"Clinical_Imaging",
"Cell_Imaging",
"Human_subject_data",
"Clinical_data",
"Lifestyle_data",
"Socio_Economic_Data",
"Environmental_Data",
"Other_Phenotype_data",
"Other"
]
},
"data_type_notes": {
"type": "string"
},
"access_category": {
"type": "string",
"enum": [
"open-access",
"controlled-access",
"registered-access"
]
},
"subjects_category": {
"type": "array",
"items": {
"type": "string",
"enum": [
"cases",
"controls",
"cases_and_controls"
]
}
},
"de_identification": {
"type": "string",
"enum": [
"anonymized",
"pseudonymized"
]
},
"consent_status": {
"type": "string",
"enum": [
"heterogeneous",
"homogeneous"
]
},
"consent_status_description": {
"type": "string"
},
"has_special_subjects": {
"type": "boolean"
},
"special_subjects_description": {
"type": "string"
},
"embargo_date": {
"type": "string",
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
},
"storage_end_date": {
"type": "string",
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
},
"storage_duration_criteria": {
"type": "string",
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
}
}
}
}
}
}
{
"description": "ELIXIR Luxembourg Partner Schema",
"title": "A JSON Schema for describing partners institutes.",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"allOf": [{
"$ref": "#/definitions/elu:partner"
}],
"definitions": {
"elu:partner": {
"type": "object",
"allOf": [
{
"$ref": "https://git-r3lab.uni.lu/pinar.alper/metadata-tools/raw/master/metadata_tools/resources/elu-core.json"
}
],
"properties": {
"is_clinical": {
"type": "boolean"
},
"geo_category": {
"type": "string",
"enum": [
"National",
"EU",
"Non_EU",
"International"
]
},
"sector_category": {
"type": "string",
"enum": [
"PUBLIC",
"PRIVATE_P",
"PRIVATE_NP"
]
},
"address": {
"type": ["string", "null"]
},
"country_code":{
"title": "ISO 3166-1 Alpha-2 Country code",
"type": ["string", "null"],
"pattern": "^[A-Z]{2}$"
}
}
}
}
}
{
"description": "ELIXIR Luxembourg Projects Schema",
"title": "A JSON Schema for describing biomedical research Projects.",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"allOf": [{
"$ref": "#/definitions/elu:project"
}],
"definitions": {
"elu:project": {
"type": "object",
"allOf": [
{
"$ref": "https://git-r3lab.uni.lu/pinar.alper/metadata-tools/raw/master/metadata_tools/resources/elu-study.json"
}
],
"properties": {
"has_institutional_ethics_approval": {
"type": "boolean"
},
"institutional_ethics_approval_notes": {
"type": ["string", "null"]
},
"has_national_ethics_approval": {
"type": "boolean"
},
"national_ethics_approval_notes": {
"type": ["string", "null"]
}
}
}
}
}
{
"description": "Study-Project Schema",
"title": "A JSON Schema for describing Studies-Projects within the ELIXIR Data Submission System.",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"allOf": [
{
"$ref": "#/definitions/elu:study"
}
],
"definitions": {
"elu:study": {
"type": "object",
"allOf": [
{
"$ref": "https://git-r3lab.uni.lu/pinar.alper/metadata-tools/raw/master/metadata_tools/resources/elu-core.json"
}
],
"properties": {
"has_ethics_approval": {
"type": "boolean"
},
"ethics_approval_notes": {
"type": [
"string",
"null"
]
},
"start_date": {
"type": [
"string",
"null"
],
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
},
"end_date": {
"type": [
"string",
"null"
],
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
},
"feature_terms": {
"$ref": "#/definitions/term_set"
},
"disease_terms": {
"$ref": "#/definitions/term_set"
},
"gene_id_terms": {
"$ref": "#/definitions/term_set"
},
"phenotype_terms": {
"$ref": "#/definitions/term_set"
},
"funding_sources": {
"type": "array",
"items": {
"type": "string",
"enum": [
"IMI",
"H2020",
"FP7",
"NIH",
"OTHER"
]
}
},
"funding_source_description": {
"type": "string"
},
"web_page": {
"type": "string",
"format": "uri"
},
"publications": {
"type": "array",
"items": {
"type": "object",
"properties": {
"doi": {
"type": "string"