diff --git a/framework/json/common/filteringTerms.json b/framework/json/common/filteringTerms.json index 35d89810..ce8ea330 100644 --- a/framework/json/common/filteringTerms.json +++ b/framework/json/common/filteringTerms.json @@ -1,39 +1,15 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", + "additionalProperties": true, "definitions": { - "FilteringTerm": { - "title": "Filtering Term Element", - "type": "object", + "AlphanumericFilter": { + "description": "Filter results based on operators and values applied to alphanumeric fields.", "properties": { "id": { - "description": "Custom filter terms should contain a unique identifier.", - "examples": [ "demographic.ethnicity:asian" ], - "type": "string" - }, - "scope": { - "description": "The entry type to which the filter applies", - "examples": [ "biosamples" ], + "description": "Field identfier to be queried.", + "example": "ageOfOnset", "type": "string" - } - }, - "anyOf": [ - { - "$ref": "#/definitions/OntologyFilter" }, - { - "$ref": "#/definitions/AlphanumericFilter" - }, - { - "$ref": "#/definitions/CustomFilter" - } - ], - "required": [ - "id" - ] - }, - "AlphanumericFilter": { - "description": "Filter results based on operators and values applied to alphanumeric fields.", - "properties": { "operator": { "default": "=", "description": "Defines how the value relates to the field `id`.", @@ -48,6 +24,11 @@ "examples": [ ">" ], "type": "string" }, + "scope": { + "description": "The entry type to which the filter applies", + "example": "individuals", + "type": "string" + }, "value": { "description": "Alphanumeric search term to be used within the query which can contain wildcard characters (%) to denote any number of unknown characters. Values can be assocatied with units if applicable.", "examples": [ "P70Y" ], @@ -55,6 +36,7 @@ } }, "required": [ + "id", "operator", "value" ], @@ -62,16 +44,54 @@ }, "CustomFilter": { "description": "Filter results to include records that contain a custom term defined by this Beacon.", + "properties": { + "id": { + "description": "Custom filter terms should contain a unique identifier.", + "example": "demographic.ethnicity:asian", + "type": "string" + }, + "scope": { + "description": "The entry type to which the filter applies", + "example": "individuals", + "type": "string" + } + }, + "required": [ + "id" + ], "type": "object" }, + "FilteringTerm": { + "anyOf": [ + { + "$ref": "#/definitions/OntologyFilter" + }, + { + "$ref": "#/definitions/AlphanumericFilter" + }, + { + "$ref": "#/definitions/CustomFilter" + } + ] + }, "OntologyFilter": { "description": "Filter results to include records that contain a specific ontology term.", "properties": { + "id": { + "description": "Term ID to be queried, using CURIE syntax where possible.", + "example": "HP:0002664", + "type": "string" + }, "includeDescendantTerms": { "default": true, "description": "Define if the Beacon should implement the ontology hierarchy, thus query the descendant terms of `id`.", "type": "boolean" }, + "scope": { + "description": "The entry type to which the filter applies", + "examples": [ "biosamples" ], + "type": "string" + }, "similarity": { "default": "exact", "description": "Allow the Beacon to return results which do not match the filter exactly, but do match to a certain degree of similarity. The Beacon defines the semantic similarity model implemented and how to apply the thresholds of 'high', 'medium' and 'low' similarity.", @@ -84,13 +104,16 @@ "type": "string" } }, + "required": [ + "id" + ], "type": "object" } }, "description": "Filtering terms are the main means to select subsets of records from a Beacon response. While the name implies the application to a generated response, in practice implementations may apply them at the query stage. Note: In the processing of Beacon v2.0 requests multiple filters are assumed to be chained by the logical AND operator.", - "title": "Filtering Term Element", - "type": "array", "items": { "$ref": "#/definitions/FilteringTerm" - } + }, + "title": "Filtering Terms Array", + "type": "array" } \ No newline at end of file diff --git a/framework/src/common/filteringTerms.yaml b/framework/src/common/filteringTerms.yaml index d083448a..00174f82 100644 --- a/framework/src/common/filteringTerms.yaml +++ b/framework/src/common/filteringTerms.yaml @@ -11,28 +11,22 @@ items: $ref: '#/definitions/FilteringTerm' definitions: FilteringTerm: - properties: - id: - type: string - description: Term ID to be queried, using CURIE syntax where possible. - examples: - - HP:0002664 - scope: - type: string - description: The entry type to which the filter applies - examples: - - biosamples anyOf: - $ref: '#/definitions/OntologyFilter' - $ref: '#/definitions/AlphanumericFilter' - $ref: '#/definitions/CustomFilter' - required: - - id OntologyFilter: type: object description: Filter results to include records that contain a specific ontology term. + required: + - id properties: + id: + type: string + description: Term ID to be queried, using CURIE syntax where possible. + examples: + - HP:0002664 includeDescendantTerms: type: boolean default: true @@ -50,14 +44,25 @@ definitions: exactly, but do match to a certain degree of similarity. The Beacon defines the semantic similarity model implemented and how to apply the thresholds of 'high', 'medium' and 'low' similarity. + scope: + type: string + description: The entry type to which the filter applies + examples: + - biosamples AlphanumericFilter: description: Filter results based on operators and values applied to alphanumeric fields. type: object required: + - id - operator - value properties: + id: + type: string + description: Field identfier to be queried. + examples: + - ageOfOnset operator: type: string enum: @@ -69,14 +74,34 @@ definitions: - <= description: Defines how the value relates to the field `id`. default: '=' - example: '>' + examples: + - '>' value: type: string - description: Alphanumeric search term to be used within the query which can + description: >- + Alphanumeric search term to be used within the query which can contain wildcard characters (%) to denote any number of unknown characters. Values can be assocatied with units if applicable. example: P70Y + scope: + type: string + description: The entry type to which the filter applies + examples: + - individuals CustomFilter: type: object description: Filter results to include records that contain a custom term defined - by this Beacon. \ No newline at end of file + by this Beacon. + required: + - id + properties: + id: + type: string + description: Custom filter terms should contain a unique identifier. + example: demographic.ethnicity:asian + scope: + type: string + description: The entry type to which the filter applies + examples: + - individuals +additionalProperties: true