From 37dc9f06cc7e31c1c67b93c08216d13f65242a64 Mon Sep 17 00:00:00 2001 From: Arkadii Yakovets Date: Tue, 17 Oct 2023 16:13:44 -0700 Subject: [PATCH] Add Sample::developmental_stage field support --- api/data_refinery_api/views/sample.py | 2 ++ .../0074_sample_developmental_stage.py | 18 ++++++++++++++++++ common/data_refinery_common/models/sample.py | 2 ++ 3 files changed, 22 insertions(+) create mode 100644 common/data_refinery_common/migrations/0074_sample_developmental_stage.py diff --git a/api/data_refinery_api/views/sample.py b/api/data_refinery_api/views/sample.py index 124c28124..d4e208bcf 100644 --- a/api/data_refinery_api/views/sample.py +++ b/api/data_refinery_api/views/sample.py @@ -88,6 +88,7 @@ class Meta: "age", "specimen_part", "genetic_information", + "developmental_stage", "disease", "disease_stage", "cell_line", @@ -159,6 +160,7 @@ class SampleListView(generics.ListAPIView): "age", "specimen_part", "genetic_information", + "developmental_stage", "disease", "disease_stage", "cell_line", diff --git a/common/data_refinery_common/migrations/0074_sample_developmental_stage.py b/common/data_refinery_common/migrations/0074_sample_developmental_stage.py new file mode 100644 index 000000000..5c47c54bd --- /dev/null +++ b/common/data_refinery_common/migrations/0074_sample_developmental_stage.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.18 on 2023-10-17 22:53 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("data_refinery_common", "0073_rename_genotype_sample_genetic_information"), + ] + + operations = [ + migrations.AddField( + model_name="sample", + name="developmental_stage", + field=models.CharField(blank=True, max_length=255), + ), + ] diff --git a/common/data_refinery_common/models/sample.py b/common/data_refinery_common/models/sample.py index c5b1a8329..9d2152496 100644 --- a/common/data_refinery_common/models/sample.py +++ b/common/data_refinery_common/models/sample.py @@ -60,6 +60,7 @@ def __str__(self): age = models.DecimalField(max_length=255, blank=True, max_digits=8, decimal_places=3, null=True) specimen_part = models.CharField(max_length=255, blank=True) genetic_information = models.CharField(max_length=255, blank=True) + developmental_stage = models.CharField(max_length=255, blank=True) disease = models.CharField(max_length=255, blank=True) disease_stage = models.CharField(max_length=255, blank=True) cell_line = models.CharField(max_length=255, blank=True) @@ -126,6 +127,7 @@ def to_metadata_dict(self, computed_file=None): metadata["refinebio_annotations"] = [ data for data in self.sampleannotation_set.all().values_list("data", flat=True) ] + metadata["refinebio_developmental_stage"] = self.developmental_stage if computed_file and computed_file.result and computed_file.result.processor: metadata["refinebio_processor_id"] = computed_file.result.processor.id