-
Notifications
You must be signed in to change notification settings - Fork 22
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
filteringTerms
: Add excluded
flag
#63
Comments
Use case examplesAll breast adenocarcinoma samples by NCIt (NCIT:C5214), excluding triple-negative (NCIT:C71732)This is a simple use case where a diagnosis is queried w/ the explicit exclusion of one specific subtype. In principle this could be achieved by an AND query for all wanted codes at the same hierarchy level as
GET:
COVID19 in a non-diabetic patient with cardiovascular risk factorsThis is based on an example provided inn the Phenopackets documentation.
GET:
|
Hi all, Just a naïve question. May the exclusion (negation) be included in filtering logic along with AND & OR?. Cheers, D. |
@redmitry These are actually 2 questions.
If Boolean queries are developed than negated filters would be included in that scenario; just treat them as another filter, with a flag.
In the Booleans? If allowing Boolean combinations a "normal" query (some filters connected by AND) are just a special case - so yes. It is not so much about dreaming up scenarios where this needs to happen (e.g. retrieving 2 groups of results in a single query); In any case adding the Footnotes
|
I never understood the exact meaning of similarity for practical implementation. From the usecase I understand that we want all but triple negative breast cancers. Without exclusion we would need repeat too many identifiers one by one.
"query": {
"filters": [
{"id": "NCIT:C5214"}, {"id": "NCIT:C71732"}
],
"filters_logic": "NCIT:C5214 & !NCIT:C71732"
} I mean that we may use "filters_logic" (similar to @anuradhawick "queryExpression": "(A|B)&(C&D|E&F)&!G"). Cheers, D. |
If I understand correctly, the proposal is to be able to make a query and get back results where a particular ontology is absent... is that correct? But this is quite a bit different from the phenopackets Is "missing" or "absent" a less confusing name for this feature? Especially for those of us already using phenopackets with beacon. |
@redmitry happy with your implementation, but not sure if it would extend to support But keen to see where it lands :) @gsfk one area this approach shines is when Cancer X is covered by datasets from HPO and SNOMED ontologies. Logical expressions makes querying this magically easy. Also when there are mutually exclusive conditions like "from Australia" or "from New Zealand" kind of queries are nearly impossible in one go without some logic. If we can achieve logic, I think we cover all the bases for "missing", etc. |
I'll echo @gsfk point, it's not clear here whether we're talking about filtering on properties that are explicitly mentioned as excluded (as Phenopackets does), or if we're talking about adding a flag that checks whether a property is absent from a given record. |
O.k., several convincing arguments although they fall into different camps: 1. the So
Btw. the comment by @gsfk Gordon actually points to a potential need for a specific |
Surprisingly the name "negated" still seems ambiguous to me, in the same way as above (does it mean "negate this particular term in my query" or "this term is negated in the data")? "Negated" is actually the original name of the phenopackets excluded field. |
@gsfk While I started w/ pointing to PXF it really is different when using the term negation here. So probably All: Comments on |
I implemented a possible prototype and still do not understand the difference between "excluded" and "negation". "query": {
"filters": [
{ "id": "NCIT:C9335" }
],
"filtersLogic": "NCIT:C9335 & !NCIT:C5213" does this query do what we expect with "excluded"? D. |
@redmitry i think your solution should imply exclusion. It looks really good and intuitive. Can we use indices in logic expression? There's a slim chance same ontology term or filter appearing in different scopes. For example "NCIT:123456" filter could be present across multiple scopes. So if it does this ontology code in filter logic becomes ambiguous. Also complex queries like
What are your thoughts on that? |
The scopes are defined in the filters[] array. The "filtersLogic" only defines the logic. I use "ids" (or better should be "labels") in "filtersLogic" because we may reuse the same filter in a complex query. |
@redmitry Some notes:
Regarding the flag names: As Gordon pointed out, Also, I really would prefer to separate the discussion of the filter flag from "how does this get implemented" |
fixed (typo). This is a question of interpretation and what actually be generated for execution.
Note that in a query disease $in: ["NCIT:C9335", "NCIT:C4671", ...] and $ne NCIT:C5213 checks the disease field existence in the first "and" operand. |
@redmitry My take here is:
|
My 2 cents:
|
Following a Filters Scout discussion on this issue, I will try to summarise what we are asking for votes on (👍,👎 or leave +1,-1). Question: Do you agree that the ontology filter query options should include an Some considerations that have emerged from following the discussion:
|
+1 |
1 similar comment
+1 |
I also insist is that "excluded" is not an operator but a different property to take into account. |
There is currently no way to exclude specific ontologyTerms in filter queries although this would be desirable to expand query options (especially regarding the limitation of not having Booleans) and to stay in line with Phenopackets (which has an
excluded
flag e.g. inPhenotypicFeature
.(There is a current workaround to use some custom filter design, e.g. pre-pending an ontologyTerm in a request with
!
- but this is non-standard & only would work for individual Beacons.)Proposal:
The text was updated successfully, but these errors were encountered: