Skip to content

Commit

Permalink
fix(models): make biosample.sampled_tissue field nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
v-rocheleau committed Jan 17, 2024
2 parents 329ea6a + dbf18c9 commit 1af9268
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
19 changes: 19 additions & 0 deletions chord_metadata_service/phenopackets/migrations/0009_v6_1_0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.2.7 on 2024-01-17 18:06

import chord_metadata_service.restapi.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('phenopackets', '0008_v6_0_0'),
]

operations = [
migrations.AlterField(
model_name='biosample',
name='sampled_tissue',
field=models.JSONField(blank=True, help_text='An ontology term describing the tissue from which the specimen was collected. The use of UBERON is recommended.', null=True, validators=[chord_metadata_service.restapi.validators.JsonSchemaValidator({'$id': '/chord_metadata_service/restapi/ontology_class', '$schema': 'http://json-schema.org/draft-07/schema#', 'additionalProperties': False, 'description': 'An ontology term.', 'help': 'An ontology term.', 'properties': {'id': {'$id': '/chord_metadata_service/restapi/ontology_class/id', 'description': 'A CURIE-style identifier for an ontology term.', 'help': 'A CURIE-style identifier for an ontology term.', 'type': 'string'}, 'label': {'$id': '/chord_metadata_service/restapi/ontology_class/label', 'description': 'A human readable class name for an ontology term.', 'help': 'A human readable class name for an ontology term.', 'type': 'string'}}, 'required': ['id', 'label'], 'title': 'Ontology class schema', 'type': 'object'}, formats=None)]),
),
]
3 changes: 2 additions & 1 deletion chord_metadata_service/phenopackets/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ class Biosample(BaseExtraProperties, BaseTimeStamp, IndexableMixin):
"self", on_delete=models.CASCADE, blank=True, null=True, related_name="derived_biosamples",
help_text=rec_help(d.BIOSAMPLE, "derived_from_id"))
description = models.CharField(max_length=200, blank=True, help_text=rec_help(d.BIOSAMPLE, "description"))
sampled_tissue = JSONField(validators=[ontology_validator], help_text=rec_help(d.BIOSAMPLE, "sampled_tissue"))
sampled_tissue = JSONField(blank=True, null=True, validators=[ontology_validator],
help_text=rec_help(d.BIOSAMPLE, "sampled_tissue"))
sample_type = JSONField(blank=True, null=True, validators=[ontology_validator],
help_text=rec_help(d.BIOSAMPLE, "sample_type"))

Expand Down

0 comments on commit 1af9268

Please sign in to comment.