-
Notifications
You must be signed in to change notification settings - Fork 2
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
Query OLS to update term status #77
Conversation
@tskir testing this functionality is tricky, because it turns out that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good & succinct for the most part! Just left some comments about reorganising the logic flow of the status updates
term.status = get_term_status(term_info['is_obsolete'], term_ontology_id) | ||
else: | ||
term.status = Status.DELETED | ||
term.save() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a question of personal preference, but I feel it would be better to have just one function here which would, in one cycle, go through all traits and make the necessary queries/status updates. That would make the logic more readable.
Also, I see that this currently the “current” terms are only queried in their native ontology, and only “awaiting import” are queried in EFO. But actually, we want to query all terms both in their native ontology and in EFO (of course, if EFO is the native ontology, then we only want to make one query), and then make the appropriate decisions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a question of personal preference, but I feel it would be better to have just one function here which would, in one cycle, go through all traits and make the necessary queries/status updates. That would make the logic more readable.
I am not sure I understood that, you mean we should merge the check_awaiting_import_terms
and the check_term_status
functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly. Into one function which would go through all traits (regardless of their current status), and then for each trait do the necessary logic for queries and status updates. Something like (pseudocode):
def ols_update():
for trait in all_traits:
query efo
query native ontology
new_status = decide_status(current_status, efo_status, native_ontology_status)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that example, the decide_status
doesn't have to be a separate function (and probably even shouldn't be). This could all be a monolithic function which both does the queries and then immediately decides the new status of the traits based on a bunch of branching if statements. The purpose of this is to translate the logic of choosing the new status as directly into code as possible, so that it's easy to verify its correctness
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if this is still not clear, I'll be happy to elaborate more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think this approach makes much more sense. Although I think it would be best then to separate the status calculation, since there are going to be a bunch of if statements, and it is going to make the code much more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I think it would be best then to separate the status calculation, since there are going to be a bunch of if statements, and it is going to make the code much more readable.
Well yes, actually a good point. I agree.
@joj0s May I ask whats not working for you with |
Hi @jerch, first of all thanks for coming here and providing assistance. I have been investigating an issue since yesterday, where a Once I identify the exact problem (if it is indeed something that has to do with the package), I can open an issue in the package's page to investigate it further, and of course provide any other feedback needed to improve it. |
Yes, thats indeed not supported, computed fields are non editable by default (not even sure, how you got that changed) and get recalculated from the method code on May I ask whats your exact usecase here? For me it was never an issue to be able to set a CF value manually, furthermore it would work against the idea of computed fields, as it skips the method logic (prolly leading to desync issues). |
@jerch Bad wording on my part, I didn't try to manually change the computed field itself, rather the field that the computed field depended on. I did manage to fix it though, and the mentioned problem was unrelated to the |
@joj0s Ah ok, np. I had a quick look at your defined CFs in the code, I see one issue with this one trait-curation/traitcuration/traits/models.py Lines 88 to 92 in 532ef37
The concrete field listing on the right side is empty, which basically makes this rule a NOOP (no explicit dependency is added). This might lead to desync issues, if elements of |
@jerch Thank you very much for this suggestion, I will add that! |
This PR adds the ability to query OLS for status updates, via asynchronous background tasks. Closes #31.