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

hierarchical query with parent node to get all individuals under parent node returns no results #359

Open
dcci1 opened this issue Aug 7, 2024 · 3 comments

Comments

@dcci1
Copy link

dcci1 commented Aug 7, 2024

I've setup a Beacon API instance and I want to perform a hierarchical query with a parent node ontology term to get all individuals under the parent node. I currently get 0 results for a query like that even if there are children under the parent node.

I am using a slightly different data model than the one provided in the dummy data and I've tested multiple queries so far and everything else is working. I've also ran the commands provided in the deploy readme. Any help would be much appreciated.

@costero-e
Copy link
Collaborator

costero-e commented Aug 27, 2024

Hi @dcci1, thank you for reporting the issue.

To make a descendant terms query work, please, check out if you have followed the next steps:

  1. Verify you have the "parent term" correctly inserted in filtering terms collection, like this:
{
"type": "ontology",
"id": "NCIT:C42331",
"label": "African",
"scopes": [
"individual"
]
}
  1. Make sure you have inserted the descendants you want to accept for the "parent term" in the collection similarities, like this (adding nigerian term under african):
{
    id: 'NCIT:C42331',
    descendants: [
        'NCIT:C43834'
    ]
}
  1. Throw the query using the parent term (just using a get through the browser in this example):
http://localhost:5050/api/individuals?filters=NCIT:C42331

Doing this, my queries work. Please, let me know if this was your issue or if you had another issue and I did not understand well.

Thanks,
Oriol

@dcci1
Copy link
Author

dcci1 commented Sep 5, 2024

Hi @costero-e thanks for your response.

I am currently only inserting biosamples, individuals and datasets into the database when I up the docker containers. I run the docker cp and docker exec commands, then run reindex.py and extract_filtering_terms.py.

In my individuals.json file I sometimes only have data that is a child of a parent. Will I need to manually insert all the parents in the filtering terms collection and update the similarities collection as well?

Also do you recommend creating a similarities.json and filtering_terms.json file to include as part of my initial database seeding process?

Thanks

@costero-e
Copy link
Collaborator

Hi @dcci1,

thanks for your reply.
Although I said add the descendants, the process can be done the other way round if you insert the parents for the child term you have in filtering terms. Hence, no need of inserting more filtering terms 👍 .
On the other hand, the extract_filtering_terms.py script that you execute is just to avoid having to insert all the terms "manually" but this task in theory shoud be done cherry picking the ones you want your beacon to allow in a query, so more than creating a .json file or a similarities.json file, I would first think in the list of filtering terms and similarities you want to include for your beacon and then create them either in a .json file or by introducing them in mongoDB directly.

Let me know if you have any other doubts.

Best,

Oriol

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

No branches or pull requests

2 participants