Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'filtersLogic' property #205

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Add 'filtersLogic' property #205

wants to merge 2 commits into from

Conversation

redmitry
Copy link
Collaborator

@redmitry redmitry commented Mar 5, 2025

This is a BSC's Logical Filters proposal for the Beacons Queries.

Currently, Beacon v2 (and 2.1) specification applies filters as a logical intersection (AND). Nevertheless, some queries may require more complex conditions like logical unions (OR) or negations (NOT). Imagine a researcher is looking for the medical condition that includes either 'Nonalcoholic fatty liver disease' (SNOMED:197315008) or 'Hepatic fibrosis' (SNOMED:62484002). It is also may be plausible to be able to exclude some conditions (e.g. no Hepatitis) from the search.

Beacon Filtering Scouts have been discussed several possibilities no include such a functionality into the Beacon specification.
Here is one proposal that we believe is quite simple to be implemented by Beacon's developers.
Basically it consists in adding an additional optional property "filtersLogic" into the "BeaconQuery" object.
The query must support all three logical operations (& - 'AND', | - 'OR' and ! - 'NOT') as well as parenthesis for grouping. Without parenthesis the sequence of logical operators should follow the standard flow where precedence is defined as 'NOT' then 'AND' then 'OR' operators.
All filter identifiers MUST be present in the "filters" property of the query.

Example (from presentation):

"query": {
  "filters": [
    { "id": "NCIT:C20197" },
    { "id": "Weight",
      "operator": ">",
      "value": "80"
    },
    { "id": "BMI",
      "operator": ">",
      "value": "25"
    }
  ],
  "filtersLogic": "NCIT:C20197 & !(Weight & !BMI)",

Some previous discussions: #63

redmitry added 2 commits March 5, 2025 11:08
This is a BSC's Logical Filters proposal for the Beacons Queries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant