-
Notifications
You must be signed in to change notification settings - Fork 5
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
Modified query_template
in utility.py
#81
Conversation
Wrapped age, sex, diagnosis, subject group, and assessment with sparql optional pattern
Pull Request Test Coverage Report for Build 4180748389
💛 - Coveralls |
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.
Thanks @rmanaem! Is there a reason we're keeping bg:hasSession
as non-optional here for now? Does it break the below SELECT
block if we also wrap it in an OPTIONAL
group?
I'd refer this to @surchs |
Aha, excellent question @alyssadai. I think you are right, based on the current data model it would make sense for At the moment, we expect to return a session file-path for every subject that meets the the cohort criteria because (at least in the API) we expect every subject to have at least one session. My view on this at the moment is:
It so happens that I fortuitously failed to create a file_path attribute for all |
Thanks for the explanation @surchs. Your second bullet point makes sense to me (and I like always having a session for subjects), but just to clarify the first
What do you mean by optional? Would participants without imaging data just not be annotated with paths in the graph in the first place? So, from the API aggregate query results perspective (assuming there are participants in the graph who have only non-imaging data), you would still get a list of paths for your query, but the # participants with paths in that list may not be the same as the total # matching participants for the given query (?) |
Thanks, that's a good point. I think we haven't really discussed what the decision that "you can exist without neuroimaging data" means for the API userflow - and to a lesser extent also the query tool. My view is that for this PR / release, your suggestion of returning a list of paths with possibly fewer entries than the stated number of subject*sessions is fine. The main purpose of the paths at the moment is so that a user can get to the binary imaging files if they want to. We don't really have something similar to provide to the user yet for a subject without imaging data, but we still want to mention that these subjects exist. That said, we should revisit the question of "what can we tell a user about a pheno-only subject" quickly. I made #84 to track this. With that, I'd say we can go ahead here and make the file_path attribute optional. LMK if you want to look at this together @rmanaem |
Wrapped file path with sparql optional pattern
The starlette.response.JSONResponse class which is the default response class in fastapi doesn't allow nan values and throws `ValueError: Out of range float values are not JSON compliant` error
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.
Looks great @rmanaem, thanks for catching + addressing this quirk with the SPARQL results!
I've added a commit to drop the NaN file paths in the aggregate query response. With this change the ORJSONResponse
class should no longer be needed, but I think it's fine if we keep it in for now in case we decide to revert to returning NaN values for attributes.
Main changes:
bg:isSubjectGroup
toquery_template
, Closes Add bg:isSubjectGroup to SPARQL query pattern in create_query function #44query_template
in utility.py module #72