Skip to content

Commit

Permalink
Updated default_neurobagel_query
Browse files Browse the repository at this point in the history
Refactored `query_string` in `utility` module
  • Loading branch information
rmanaem committed Oct 9, 2024
1 parent a93d476 commit f90f00c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
6 changes: 3 additions & 3 deletions app/api/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def create_query(
f"""
SELECT DISTINCT ?dataset_uuid ?dataset_name ?dataset_portal_uri ?sub_id ?age ?sex
?diagnosis ?subject_group ?num_matching_phenotypic_sessions ?num_matching_imaging_sessions
?session_id ?session_type ?assessment ?image_modal ?session_file_path ?pipeline_version ?pipeline_name
?session_id ?session_type ?assessment ?image_modal ?session_file_path ?pipeline_name ?pipeline_version
WHERE {{
?dataset_uuid a nb:Dataset;
nb:hasLabel ?dataset_name;
Expand Down Expand Up @@ -289,8 +289,8 @@ def create_query(
OPTIONAL {{
?imaging_session nb:hasCompletedPipeline ?pipeline.
?pipeline nb:hasPipelineVersion ?pipeline_version;
nb:hasPipelineName ?pipeline_name.
?pipeline nb:hasPipelineName ?pipeline_name;
nb:hasPipelineVersion ?pipeline_version.
}}
}}
{imaging_session_level_filters}
Expand Down
19 changes: 12 additions & 7 deletions docs/default_neurobagel_query.rq
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,18 @@ WHERE {
?subject a nb:Subject.
OPTIONAL {
?subject nb:hasSession ?imaging_session.
?imaging_session a nb:ImagingSession;
nb:hasAcquisition/nb:hasContrastType ?image_modal.
}
OPTIONAL {
?imaging_session nb:hasCompletedPipeline ?pipeline.
?pipeline nb:hasPipelineVersion ?pipeline_version.
?pipeline nb:hasPipelineName ?pipeline_name.
?imaging_session a nb:ImagingSession.

OPTIONAL {
?imaging_session nb:hasAcquisition ?acquisition.
?acquisition nb:hasContrastType ?image_modal.
}

OPTIONAL {
?imaging_session nb:hasCompletedPipeline ?pipeline.
?pipeline nb:hasPipelineName ?pipeline_name;
nb:hasPipelineVersion ?pipeline_version.
}
}

} GROUP BY ?subject
Expand Down

0 comments on commit f90f00c

Please sign in to comment.