From 40e34d68eea9f19bdc94bb8da0757ed7ced3619d Mon Sep 17 00:00:00 2001 From: Arkadii Yakovets Date: Wed, 18 Oct 2023 14:40:34 -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 ++ common/tests/models/test_sample.py | 1 + .../data_refinery_foreman/surveyor/harmony.py | 1 + 5 files changed, 24 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 diff --git a/common/tests/models/test_sample.py b/common/tests/models/test_sample.py index 7d12a1fa8..f5f6f8de6 100644 --- a/common/tests/models/test_sample.py +++ b/common/tests/models/test_sample.py @@ -17,6 +17,7 @@ def test_to_metadata_dict(self): "refinebio_annotations", "refinebio_cell_line", "refinebio_compound", + "refinebio_developmental_stage", "refinebio_disease", "refinebio_disease_stage", "refinebio_genetic_information", diff --git a/foreman/data_refinery_foreman/surveyor/harmony.py b/foreman/data_refinery_foreman/surveyor/harmony.py index 277a80f96..a2712de0b 100644 --- a/foreman/data_refinery_foreman/surveyor/harmony.py +++ b/foreman/data_refinery_foreman/surveyor/harmony.py @@ -6,6 +6,7 @@ `age`, `specimen_part`, `genetic_information`, + `developmental_stage`, `disease`, `disease_stage`, `cell_line`,