-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from c3g/rearrange-schemas-validators
Rearrange schemas and validators
- Loading branch information
Showing
23 changed files
with
878 additions
and
287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
chord_metadata_service/experiments/migrations/0005_auto_20200513_1401.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Generated by Django 2.2.12 on 2020-05-13 18:01 | ||
|
||
import chord_metadata_service.restapi.validators | ||
import django.contrib.postgres.fields.jsonb | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('experiments', '0004_auto_20200401_1445'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='experiment', | ||
name='biosample', | ||
field=models.ForeignKey(blank=True, help_text='Biosample on which this experiment was done', null=True, on_delete=django.db.models.deletion.SET_NULL, to='phenopackets.Biosample'), | ||
), | ||
migrations.AlterField( | ||
model_name='experiment', | ||
name='experiment_ontology', | ||
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, help_text='(Ontology: OBI) links to experiment ontology information.', null=True, validators=[chord_metadata_service.restapi.validators.JsonSchemaValidator({'$id': 'chord_metadata_service:ontology_class_list_schema', '$schema': 'http://json-schema.org/draft-07/schema#', 'description': 'Ontology class list', 'items': {'$id': 'chord_metadata_service:ontology_class_schema', '$schema': 'http://json-schema.org/draft-07/schema#', 'additionalProperties': False, 'description': 'todo', 'properties': {'id': {'description': 'CURIE style identifier.', 'type': 'string'}, 'label': {'description': 'Human-readable class name.', 'type': 'string'}}, 'required': ['id', 'label'], 'title': 'Ontology class schema', 'type': 'object'}, 'title': 'Ontology class list', 'type': 'array'}, formats=None)]), | ||
), | ||
migrations.AlterField( | ||
model_name='experiment', | ||
name='molecule_ontology', | ||
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, help_text='(Ontology: SO) links to molecule ontology information.', null=True, validators=[chord_metadata_service.restapi.validators.JsonSchemaValidator({'$id': 'chord_metadata_service:ontology_class_list_schema', '$schema': 'http://json-schema.org/draft-07/schema#', 'description': 'Ontology class list', 'items': {'$id': 'chord_metadata_service:ontology_class_schema', '$schema': 'http://json-schema.org/draft-07/schema#', 'additionalProperties': False, 'description': 'todo', 'properties': {'id': {'description': 'CURIE style identifier.', 'type': 'string'}, 'label': {'description': 'Human-readable class name.', 'type': 'string'}}, 'required': ['id', 'label'], 'title': 'Ontology class schema', 'type': 'object'}, 'title': 'Ontology class list', 'type': 'array'}, formats=None)]), | ||
), | ||
migrations.AlterField( | ||
model_name='experiment', | ||
name='other_fields', | ||
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, help_text='The other fields for the experiment', null=True, validators=[chord_metadata_service.restapi.validators.JsonSchemaValidator({'$id': 'chord_metadata_service:key_value_object_schema', '$schema': 'http://json-schema.org/draft-07/schema#', 'additionalProperties': False, 'description': 'The schema represents a key-value object.', 'patternProperties': {'^.*$': {'type': 'string'}}, 'title': 'Key-value object', 'type': 'object'}, formats=None)]), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from .descriptions import EXPERIMENT | ||
from chord_metadata_service.restapi.description_utils import describe_schema | ||
from chord_metadata_service.restapi.schemas import ONTOLOGY_CLASS_LIST, KEY_VALUE_OBJECT | ||
|
||
|
||
EXPERIMENT_SCHEMA = describe_schema({ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "chord_metadata_service:experiment_schema", | ||
"title": "Experiment schema", | ||
"description": "Schema for describing an experiment.", | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "string" | ||
}, | ||
"reference_registry_id": { | ||
"type": "string" | ||
}, | ||
"qc_flags": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"experiment_type": { | ||
"type": "string" | ||
}, | ||
"experiment_ontology": ONTOLOGY_CLASS_LIST, | ||
"molecule": { | ||
"type": "string" | ||
}, | ||
"molecule_ontology": ONTOLOGY_CLASS_LIST, | ||
"library_strategy": { | ||
"type": "string", | ||
"enum": [ | ||
"DNase-Hypersensitivity", | ||
"ATAC-seq", | ||
"NOME-Seq", | ||
"Bisulfite-Seq", | ||
"MeDIP-Seq", | ||
"MRE-Seq", | ||
"ChIP-Seq", | ||
"RNA-Seq", | ||
"miRNA-Seq", | ||
"WGS" | ||
] | ||
}, | ||
"other_fields": KEY_VALUE_OBJECT, | ||
"biosample": { | ||
"type": "string" | ||
}, | ||
"individual": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": ["id", "experiment_type", "library_strategy"] | ||
}, EXPERIMENT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.