Skip to content

Commit

Permalink
do not structure schema
Browse files Browse the repository at this point in the history
(postpone for another commit)
  • Loading branch information
redmitry committed Jul 31, 2023
1 parent bad1f13 commit 753d12f
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 48 deletions.
87 changes: 55 additions & 32 deletions framework/json/common/filteringTerms.json
Original file line number Diff line number Diff line change
@@ -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`.",
Expand All @@ -48,30 +24,74 @@
"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" ],
"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": "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.",
Expand All @@ -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"
}
57 changes: 41 additions & 16 deletions framework/src/common/filteringTerms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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.
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

0 comments on commit 753d12f

Please sign in to comment.