From f37b3dfceea00d6511fb987a7b332121e380a696 Mon Sep 17 00:00:00 2001 From: Michael Baudis Date: Wed, 21 Aug 2024 21:28:03 +0200 Subject: [PATCH] proper filteringTerms definition for models The previous filteringTerms.yaml/json endpoint definitions were odd: - either defined as empty lists (well, okish) - or having some random values This PR redefines filteringTerms endpoints as containing a list of https://raw.githubusercontent.com/ga4gh-beacon/beacon-v2/main/framework/json/responses/sections/beaconFilteringTermsResults.json#/definitions/FilteringTerm items. Should be non-breaking. --- bin/beaconYamler.py | 2 +- .../sections/beaconFilteringTermsResults.json | 32 ++++++++++++------- .../sections/beaconFilteringTermsResults.yaml | 2 +- .../analyses/filteringTerms.json | 5 ++- .../biosamples/filteringTerms.json | 5 ++- .../cohorts/filteringTerms.json | 12 +++---- .../beacon-v2-default-model/common/age.json | 4 +-- .../common/ageRange.json | 4 +-- .../common/complexValue.json | 4 ++- .../datasets/filteringTerms.json | 12 +++---- .../genomicVariations/filteringTerms.json | 14 +++----- .../genomicVariations/requestParameters.json | 6 ++-- .../individuals/filteringTerms.json | 5 ++- .../runs/filteringTerms.json | 5 ++- .../analyses/filteringTerms.yaml | 4 ++- .../biosamples/filteringTerms.yaml | 4 ++- .../cohorts/filteringTerms.yaml | 8 ++--- .../datasets/filteringTerms.yaml | 8 ++--- .../genomicVariations/filteringTerms.yaml | 8 ++--- .../individuals/filteringTerms.yaml | 4 ++- .../runs/filteringTerms.yaml | 4 ++- 21 files changed, 81 insertions(+), 71 deletions(-) diff --git a/bin/beaconYamler.py b/bin/beaconYamler.py index 022ea5fc2..e0d05d78e 100755 --- a/bin/beaconYamler.py +++ b/bin/beaconYamler.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python3 +#!/usr/bin/env python3 import sys, re, json import pathlib diff --git a/framework/json/responses/sections/beaconFilteringTermsResults.json b/framework/json/responses/sections/beaconFilteringTermsResults.json index 1755fb582..556d35993 100644 --- a/framework/json/responses/sections/beaconFilteringTermsResults.json +++ b/framework/json/responses/sections/beaconFilteringTermsResults.json @@ -21,6 +21,25 @@ ], "type": "string" }, + "scopes": { + "description": "Entry types affected by this filter.", + "examples": [ + [ + "individual", + "biosample", + "analysis", + "run", + "genomicVariation" + ], + [ + "biosample" + ] + ], + "items": { + "type": "string" + }, + "type": "array" + }, "type": { "description": "Either \"custom\", \"alphanumeric\" or ontology/terminology full name. TODO: An ontology ... with a registered prefix does not need a full name so one may better use CURIE to indicate that the resource can be retrieved from the id. This also will allow to provide an enum here.", "examples": [ @@ -28,17 +47,6 @@ "alphanumeric" ], "type": "string" - }, - "scopes": { - "description": "Entry types affected by this filter.", - "examples": [ - ["individual", "biosample", "analysis", "run", "genomicVariation"], - ["biosample"] - ], - "type": "array", - "items": { - "type": "string" - } } }, "required": [ @@ -115,4 +123,4 @@ } }, "type": "object" -} +} \ No newline at end of file diff --git a/framework/src/responses/sections/beaconFilteringTermsResults.yaml b/framework/src/responses/sections/beaconFilteringTermsResults.yaml index 05748d8cc..bba4967ea 100644 --- a/framework/src/responses/sections/beaconFilteringTermsResults.yaml +++ b/framework/src/responses/sections/beaconFilteringTermsResults.yaml @@ -47,7 +47,7 @@ definitions: - 'B Lymphoblastic Leukemia/Lymphoma' - 'Aplasia/Hypoplasia of the middle ear' scopes: - description: >- + description: >- Entry types affected by this filter. examples: - diff --git a/models/json/beacon-v2-default-model/analyses/filteringTerms.json b/models/json/beacon-v2-default-model/analyses/filteringTerms.json index 9cd753def..3114eb83c 100644 --- a/models/json/beacon-v2-default-model/analyses/filteringTerms.json +++ b/models/json/beacon-v2-default-model/analyses/filteringTerms.json @@ -1,4 +1,7 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "filteringTerms": [] + "items": { + "$ref": "https://raw.githubusercontent.com/ga4gh-beacon/beacon-v2/main/framework/json/responses/sections/beaconFilteringTermsResults.json#/definitions/FilteringTerm" + }, + "type": "array" } \ No newline at end of file diff --git a/models/json/beacon-v2-default-model/biosamples/filteringTerms.json b/models/json/beacon-v2-default-model/biosamples/filteringTerms.json index 9cd753def..3114eb83c 100644 --- a/models/json/beacon-v2-default-model/biosamples/filteringTerms.json +++ b/models/json/beacon-v2-default-model/biosamples/filteringTerms.json @@ -1,4 +1,7 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "filteringTerms": [] + "items": { + "$ref": "https://raw.githubusercontent.com/ga4gh-beacon/beacon-v2/main/framework/json/responses/sections/beaconFilteringTermsResults.json#/definitions/FilteringTerm" + }, + "type": "array" } \ No newline at end of file diff --git a/models/json/beacon-v2-default-model/cohorts/filteringTerms.json b/models/json/beacon-v2-default-model/cohorts/filteringTerms.json index d53359eb0..3114eb83c 100644 --- a/models/json/beacon-v2-default-model/cohorts/filteringTerms.json +++ b/models/json/beacon-v2-default-model/cohorts/filteringTerms.json @@ -1,11 +1,7 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "filteringTerms": [ - { - "ftType": "ontologyTerm", - "id": "DUO:0000006", - "label": "health or medical or biomedical research", - "version": "2021-02-23" - } - ] + "items": { + "$ref": "https://raw.githubusercontent.com/ga4gh-beacon/beacon-v2/main/framework/json/responses/sections/beaconFilteringTermsResults.json#/definitions/FilteringTerm" + }, + "type": "array" } \ No newline at end of file diff --git a/models/json/beacon-v2-default-model/common/age.json b/models/json/beacon-v2-default-model/common/age.json index e7f4a6c66..f6b941fde 100644 --- a/models/json/beacon-v2-default-model/common/age.json +++ b/models/json/beacon-v2-default-model/common/age.json @@ -3,7 +3,7 @@ "description": "Age value definition. Provenance: GA4GH Phenopackets v2 `Age`", "properties": { "iso8601duration": { - "description": "Represents age as a ISO8601 duration (e.g., 'P40Y10M05D').", + "description": "Represents age as a ISO8601 duration (e.g., P40Y10M05D).", "example": "P32Y6M1D", "type": "string" } @@ -13,4 +13,4 @@ ], "title": "Age", "type": "object" -} +} \ No newline at end of file diff --git a/models/json/beacon-v2-default-model/common/ageRange.json b/models/json/beacon-v2-default-model/common/ageRange.json index 31fb79c76..1bb6ff693 100644 --- a/models/json/beacon-v2-default-model/common/ageRange.json +++ b/models/json/beacon-v2-default-model/common/ageRange.json @@ -12,8 +12,8 @@ } }, "required": [ - "end", - "start" + "start", + "end" ], "title": "AgeRange", "type": "object" diff --git a/models/json/beacon-v2-default-model/common/complexValue.json b/models/json/beacon-v2-default-model/common/complexValue.json index fd9993392..e60d69cb8 100644 --- a/models/json/beacon-v2-default-model/common/complexValue.json +++ b/models/json/beacon-v2-default-model/common/complexValue.json @@ -40,7 +40,9 @@ "type": "array" } }, - "required": [ "typedQuantities" ], + "required": [ + "typedQuantities" + ], "title": "Complex Value", "type": "object" } \ No newline at end of file diff --git a/models/json/beacon-v2-default-model/datasets/filteringTerms.json b/models/json/beacon-v2-default-model/datasets/filteringTerms.json index d53359eb0..3114eb83c 100644 --- a/models/json/beacon-v2-default-model/datasets/filteringTerms.json +++ b/models/json/beacon-v2-default-model/datasets/filteringTerms.json @@ -1,11 +1,7 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "filteringTerms": [ - { - "ftType": "ontologyTerm", - "id": "DUO:0000006", - "label": "health or medical or biomedical research", - "version": "2021-02-23" - } - ] + "items": { + "$ref": "https://raw.githubusercontent.com/ga4gh-beacon/beacon-v2/main/framework/json/responses/sections/beaconFilteringTermsResults.json#/definitions/FilteringTerm" + }, + "type": "array" } \ No newline at end of file diff --git a/models/json/beacon-v2-default-model/genomicVariations/filteringTerms.json b/models/json/beacon-v2-default-model/genomicVariations/filteringTerms.json index 3241f2272..3114eb83c 100644 --- a/models/json/beacon-v2-default-model/genomicVariations/filteringTerms.json +++ b/models/json/beacon-v2-default-model/genomicVariations/filteringTerms.json @@ -1,13 +1,7 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "filteringTerms": [ - { - "ftType": "alphanumeric", - "id": "gene" - }, - { - "ftType": "alphanumeric", - "id": "aminoacidChanges" - } - ] + "items": { + "$ref": "https://raw.githubusercontent.com/ga4gh-beacon/beacon-v2/main/framework/json/responses/sections/beaconFilteringTermsResults.json#/definitions/FilteringTerm" + }, + "type": "array" } \ No newline at end of file diff --git a/models/json/beacon-v2-default-model/genomicVariations/requestParameters.json b/models/json/beacon-v2-default-model/genomicVariations/requestParameters.json index e469211f4..5831f13cf 100644 --- a/models/json/beacon-v2-default-model/genomicVariations/requestParameters.json +++ b/models/json/beacon-v2-default-model/genomicVariations/requestParameters.json @@ -17,7 +17,7 @@ "$ref": "./requestParametersComponents.json#/definitions/Assembly" }, "end": { - "description": "Precise or bracketing the end of the variants of interest: * (0-based, exclusive) - see `start` * for bracket queries, provide 2 values (e.g. [111,222]).", + "description": "Precise or bracketing the end of the variants of interest: * (0-based, exclusive) - see `start` * for bracket queries, provide 2 values (e.g. [111,222]).\"", "items": { "format": "int64", "minimum": 1, @@ -52,7 +52,7 @@ "$ref": "./requestParametersComponents.json#/definitions/RefSeqId" }, "start": { - "description": "Precise or fuzzy start coordinate position(s), allele locus (0-based, inclusive). * `start` only:\n - for single positions, e.g. the start of a specified sequence\nalteration where the size is given through the specified `alternateBases`\n - typical use are queries for SNV and small InDels\n - the use of `start` without an `end` parameter requires the use of\n`alternateBases`\n* 1 value each in both `start` and `end`:\n - for searching any variant falling fully or partially within the range\n between `start` and `end` (a.k.a. \"range query\")\n - additional use of `variantType` OR `alternateBases` can limit the\n scope of the query\n - by convention, partial overlaps of variants with the indicated genomic\n range are accepted; for specific overlap requirements the 4-parameter\n \"Bracket Queries\" should be employed\n* 2 values in both `start` and `end` for constructing a \"Bracket Query\":\n - can be used to match any contiguous genomic interval, e.g. for querying\n imprecise positions\n - identifies all structural variants starting between `start[0]` and `start[1]`,\n and ending between `end[0]` <-> `end[1]`\n - single or double sided precise matches can be achieved by setting\n `start[1]=start[0]+1` and `end[1]=end[0]+1`", + "description": "Precise or fuzzy start coordinate position(s), allele locus (0-based, inclusive). * `start` only:\n - for single positions, e.g. the start of a specified sequence\n alteration where the size is given through the specified `alternateBases`\n - typical use are queries for SNV and small InDels\n - the use of `start` without an `end` parameter requires the use of\n `alternateBases`\n* 1 value in both `start` and `end`:\n - for searching any variant falling fully or partially within the range\n between `start` and `end` (a.k.a. \"range query\")\n - additional use of `variantType` OR `alternateBases` can limit the\n scope of the query\n - by convention, partial overlaps of variants with the indicated genomic\n range are accepted; for specific overlap requirements the 4-parameter\n \"Bracket Queries\" should be employed\n* 2 values in both `start` and `end` for constructing a \"Bracket Query\":\n - can be used to match any contiguous genomic interval, e.g. for querying\n imprecise positions\n - identifies all structural variants starting between `start[0]` and `start[1]`,\n and ending between `end[0]` <-> `end[1]`\n - single or double sided precise matches can be achieved by setting\n `start[1]=start[0]+1` and `end[1]=end[0]+1`", "items": { "format": "int64", "minimum": 0, @@ -87,4 +87,4 @@ }, "type": "object" } -} +} \ No newline at end of file diff --git a/models/json/beacon-v2-default-model/individuals/filteringTerms.json b/models/json/beacon-v2-default-model/individuals/filteringTerms.json index 9cd753def..3114eb83c 100644 --- a/models/json/beacon-v2-default-model/individuals/filteringTerms.json +++ b/models/json/beacon-v2-default-model/individuals/filteringTerms.json @@ -1,4 +1,7 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "filteringTerms": [] + "items": { + "$ref": "https://raw.githubusercontent.com/ga4gh-beacon/beacon-v2/main/framework/json/responses/sections/beaconFilteringTermsResults.json#/definitions/FilteringTerm" + }, + "type": "array" } \ No newline at end of file diff --git a/models/json/beacon-v2-default-model/runs/filteringTerms.json b/models/json/beacon-v2-default-model/runs/filteringTerms.json index 9cd753def..3114eb83c 100644 --- a/models/json/beacon-v2-default-model/runs/filteringTerms.json +++ b/models/json/beacon-v2-default-model/runs/filteringTerms.json @@ -1,4 +1,7 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "filteringTerms": [] + "items": { + "$ref": "https://raw.githubusercontent.com/ga4gh-beacon/beacon-v2/main/framework/json/responses/sections/beaconFilteringTermsResults.json#/definitions/FilteringTerm" + }, + "type": "array" } \ No newline at end of file diff --git a/models/src/beacon-v2-default-model/analyses/filteringTerms.yaml b/models/src/beacon-v2-default-model/analyses/filteringTerms.yaml index 0701175cf..27927183d 100644 --- a/models/src/beacon-v2-default-model/analyses/filteringTerms.yaml +++ b/models/src/beacon-v2-default-model/analyses/filteringTerms.yaml @@ -1,2 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -filteringTerms: [] +type: array +items: + $ref: https://raw.githubusercontent.com/ga4gh-beacon/beacon-v2/main/framework/json/responses/sections/beaconFilteringTermsResults.json#/definitions/FilteringTerm \ No newline at end of file diff --git a/models/src/beacon-v2-default-model/biosamples/filteringTerms.yaml b/models/src/beacon-v2-default-model/biosamples/filteringTerms.yaml index 0701175cf..27927183d 100644 --- a/models/src/beacon-v2-default-model/biosamples/filteringTerms.yaml +++ b/models/src/beacon-v2-default-model/biosamples/filteringTerms.yaml @@ -1,2 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -filteringTerms: [] +type: array +items: + $ref: https://raw.githubusercontent.com/ga4gh-beacon/beacon-v2/main/framework/json/responses/sections/beaconFilteringTermsResults.json#/definitions/FilteringTerm \ No newline at end of file diff --git a/models/src/beacon-v2-default-model/cohorts/filteringTerms.yaml b/models/src/beacon-v2-default-model/cohorts/filteringTerms.yaml index 92b6ef659..27927183d 100644 --- a/models/src/beacon-v2-default-model/cohorts/filteringTerms.yaml +++ b/models/src/beacon-v2-default-model/cohorts/filteringTerms.yaml @@ -1,6 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -filteringTerms: - - ftType: ontologyTerm - id: DUO:0000006 - label: health or medical or biomedical research - version: '2021-02-23' +type: array +items: + $ref: https://raw.githubusercontent.com/ga4gh-beacon/beacon-v2/main/framework/json/responses/sections/beaconFilteringTermsResults.json#/definitions/FilteringTerm \ No newline at end of file diff --git a/models/src/beacon-v2-default-model/datasets/filteringTerms.yaml b/models/src/beacon-v2-default-model/datasets/filteringTerms.yaml index 92b6ef659..27927183d 100644 --- a/models/src/beacon-v2-default-model/datasets/filteringTerms.yaml +++ b/models/src/beacon-v2-default-model/datasets/filteringTerms.yaml @@ -1,6 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -filteringTerms: - - ftType: ontologyTerm - id: DUO:0000006 - label: health or medical or biomedical research - version: '2021-02-23' +type: array +items: + $ref: https://raw.githubusercontent.com/ga4gh-beacon/beacon-v2/main/framework/json/responses/sections/beaconFilteringTermsResults.json#/definitions/FilteringTerm \ No newline at end of file diff --git a/models/src/beacon-v2-default-model/genomicVariations/filteringTerms.yaml b/models/src/beacon-v2-default-model/genomicVariations/filteringTerms.yaml index ca25a1cd9..27927183d 100644 --- a/models/src/beacon-v2-default-model/genomicVariations/filteringTerms.yaml +++ b/models/src/beacon-v2-default-model/genomicVariations/filteringTerms.yaml @@ -1,6 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -filteringTerms: - - ftType: alphanumeric - id: gene - - ftType: alphanumeric - id: aminoacidChanges +type: array +items: + $ref: https://raw.githubusercontent.com/ga4gh-beacon/beacon-v2/main/framework/json/responses/sections/beaconFilteringTermsResults.json#/definitions/FilteringTerm \ No newline at end of file diff --git a/models/src/beacon-v2-default-model/individuals/filteringTerms.yaml b/models/src/beacon-v2-default-model/individuals/filteringTerms.yaml index 0701175cf..27927183d 100644 --- a/models/src/beacon-v2-default-model/individuals/filteringTerms.yaml +++ b/models/src/beacon-v2-default-model/individuals/filteringTerms.yaml @@ -1,2 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -filteringTerms: [] +type: array +items: + $ref: https://raw.githubusercontent.com/ga4gh-beacon/beacon-v2/main/framework/json/responses/sections/beaconFilteringTermsResults.json#/definitions/FilteringTerm \ No newline at end of file diff --git a/models/src/beacon-v2-default-model/runs/filteringTerms.yaml b/models/src/beacon-v2-default-model/runs/filteringTerms.yaml index 0701175cf..27927183d 100644 --- a/models/src/beacon-v2-default-model/runs/filteringTerms.yaml +++ b/models/src/beacon-v2-default-model/runs/filteringTerms.yaml @@ -1,2 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -filteringTerms: [] +type: array +items: + $ref: https://raw.githubusercontent.com/ga4gh-beacon/beacon-v2/main/framework/json/responses/sections/beaconFilteringTermsResults.json#/definitions/FilteringTerm \ No newline at end of file