Skip to content

Commit

Permalink
received filters in summary to object
Browse files Browse the repository at this point in the history
  • Loading branch information
redmitry committed Jul 31, 2023
1 parent e7d7962 commit bad1f13
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 96 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,39 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": true,
"definitions": {
"AlphanumericFilter": {
"description": "Filter results based on operators and values applied to alphanumeric fields.",
"FilteringTerm": {
"title": "Filtering Term Element",
"type": "object",
"properties": {
"id": {
"description": "Field identfier to be queried.",
"example": "age",
"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" ],
"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`.",
Expand All @@ -21,77 +45,33 @@
">=",
"<="
],
"example": ">",
"type": "string"
},
"scope": {
"description": "The entry type to which the filter applies",
"example": "biosamples",
"examples": [ ">" ],
"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.",
"example": "P70Y",
"examples": [ "P70Y" ],
"type": "string"
}
},
"required": [
"id",
"operator",
"value"
],
"type": "object"
},
"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": "biosamples",
"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",
"example": "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.",
Expand All @@ -104,16 +84,13 @@
"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 Term Element",
"type": "array"
}
}
2 changes: 1 addition & 1 deletion framework/json/requests/beaconRequestBody.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Parameters to limit the list of returned results.",
"properties": {
"filters": {
"$ref": "./filteringTerms.json",
"$ref": "../common/filteringTerms.json",
"description": "Ontology based filters. Using CURIE syntax is encouraged."
},
"includeResultsetResponses": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
}
},
"required": [
"type",
"id"
"id",
"type"
],
"type": "object"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"description": "API version expected by the client to be supported by the server and used in the response format."
},
"filters": {
"$ref": "../../common/beaconCommonComponents.json#/definitions/Filters",
"$ref": "../../common/filteringTerms.json",
"description": "Filters as submitted in the request."
},
"includeResultsetResponses": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,28 @@ 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.
example: HP:0002664
includeDescendantTerms:
type: boolean
default: true
Expand All @@ -43,23 +50,14 @@ 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
example: 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.
example: age
operator:
type: string
enum:
Expand All @@ -78,23 +76,7 @@ definitions:
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
example: biosamples
CustomFilter:
type: object
description: Filter results to include records that contain a custom term defined
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
example: biosamples
additionalProperties: true
by this Beacon.
2 changes: 1 addition & 1 deletion framework/src/requests/beaconRequestBody.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ definitions:
filters:
description: >-
Ontology based filters. Using CURIE syntax is encouraged.
$ref: ./filteringTerms.yaml
$ref: ../common/filteringTerms.yaml
includeResultsetResponses:
$ref: ../common/beaconCommonComponents.yaml#/definitions/IncludeResultsetResponses
pagination:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ definitions:
description: >-
Entities can be filtered using this term.
required:
- type
- id
- type
properties:
type:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ properties:
filters:
description: >-
Filters as submitted in the request.
$ref: ../../common/beaconCommonComponents.yaml#/definitions/Filters
$ref: ../../common/filteringTerms.yaml
requestParameters:
description: >-
Dictionary of request parameters received in the `RequestBody` or as part
Expand Down

0 comments on commit bad1f13

Please sign in to comment.