diff --git a/chord_metadata_service/experiments/descriptions.py b/chord_metadata_service/experiments/descriptions.py index faeec5e4b..e84945214 100644 --- a/chord_metadata_service/experiments/descriptions.py +++ b/chord_metadata_service/experiments/descriptions.py @@ -53,6 +53,7 @@ "identifier": "An arbitrary identifier for an experiment result.", "description": "Description of an experiment result.", "filename": "The name of the file containing the result.", + "url": "A URL pointing to the file containing the result.", "genome_assembly_id": "Reference genome assembly ID.", "file_format": "(Controlled Vocabulary) File format.", "data_output_type": "The type of data output: Raw or Derived data." diff --git a/chord_metadata_service/experiments/migrations/0010_v7_0_0.py b/chord_metadata_service/experiments/migrations/0010_v7_0_0.py new file mode 100644 index 000000000..d36460951 --- /dev/null +++ b/chord_metadata_service/experiments/migrations/0010_v7_0_0.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.7 on 2024-01-24 15:48 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('experiments', '0009_v6_0_0'), + ] + + operations = [ + migrations.AddField( + model_name='experimentresult', + name='url', + field=models.CharField(blank=True, help_text='A URL pointing to the file containing the result.', max_length=500, null=True), + ), + ] diff --git a/chord_metadata_service/experiments/models.py b/chord_metadata_service/experiments/models.py index f494387ad..1f6117544 100644 --- a/chord_metadata_service/experiments/models.py +++ b/chord_metadata_service/experiments/models.py @@ -85,6 +85,7 @@ class ExperimentResult(models.Model, IndexableMixin): help_text=rec_help(d.EXPERIMENT_RESULT, "description")) filename = CharField(max_length=500, blank=True, null=True, help_text=rec_help(d.EXPERIMENT_RESULT, "filename")) + url = CharField(max_length=500, blank=True, null=True, help_text=rec_help(d.EXPERIMENT_RESULT, "url")) genome_assembly_id = CharField(max_length=50, blank=True, null=True, help_text=rec_help(d.EXPERIMENT_RESULT, "genome_assembly_id")) file_format = CharField(max_length=50, blank=True, null=True, diff --git a/chord_metadata_service/experiments/schemas.py b/chord_metadata_service/experiments/schemas.py index cefd88049..da9050a18 100644 --- a/chord_metadata_service/experiments/schemas.py +++ b/chord_metadata_service/experiments/schemas.py @@ -23,6 +23,12 @@ "filename": { "type": "string" }, + "url": { + "type": "string", + "format": "uri", + # only supported schemes allowed, in alphabetical order: + "pattern": r"^(data|doi|drs|file|ftp|https?|s3)://", + }, "genome_assembly_id": { "type": "string", }, diff --git a/chord_metadata_service/experiments/search_schemas.py b/chord_metadata_service/experiments/search_schemas.py index 4df5a5e48..07c5fdaab 100644 --- a/chord_metadata_service/experiments/search_schemas.py +++ b/chord_metadata_service/experiments/search_schemas.py @@ -20,17 +20,20 @@ "filename": { "search": search_optional_str(2) }, + "url": { + "search": search_optional_str(3) + }, "file_format": { - "search": search_optional_eq(3) + "search": search_optional_eq(4) }, "data_output_type": { - "search": search_optional_eq(4) + "search": search_optional_eq(5) }, "usage": { - "search": search_optional_str(5) + "search": search_optional_str(6) }, "genome_assembly_id": { - "search": search_optional_eq(6) + "search": search_optional_eq(7) }, }, "search": { diff --git a/chord_metadata_service/experiments/tests/example_experiments.json b/chord_metadata_service/experiments/tests/example_experiments.json index e888df91b..60d23b8f3 100644 --- a/chord_metadata_service/experiments/tests/example_experiments.json +++ b/chord_metadata_service/experiments/tests/example_experiments.json @@ -28,6 +28,7 @@ "identifier": "sample1_01", "description": "test", "filename": "sample1_01.vcf.gz", + "url": "http://example.org/sample1_01.vcf.gz", "file_format": "VCF", "data_output_type": "Derived data", "usage": "Visualized",