Skip to content

Commit

Permalink
[ENH] Implemented pipeline_name and pipeline_version query params (
Browse files Browse the repository at this point in the history
  • Loading branch information
rmanaem authored Oct 15, 2024
1 parent 9f7ed17 commit eacdaa7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/api/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ async def get(
min_num_phenotypic_sessions: int,
assessment: str,
image_modal: str,
pipeline_name: str,
pipeline_version: str,
node_urls: list[str],
) -> dict:
"""
Expand All @@ -67,6 +69,10 @@ async def get(
Non-imaging assessment completed by subjects.
image_modal : str
Imaging modality of subject scans.
pipeline_name : str
Name of pipeline run on subject scans.
pipeline_version : str
Version of pipeline run on subject scans.
node_urls : list[str]
List of Neurobagel nodes to send the query to.
Expand Down Expand Up @@ -101,6 +107,10 @@ async def get(
params["assessment"] = assessment
if image_modal:
params["image_modal"] = image_modal
if pipeline_name:
params["pipeline_name"] = pipeline_name
if pipeline_version:
params["pipeline_version"] = pipeline_version

tasks = [
util.send_get_request(node_url + "query", params)
Expand Down
3 changes: 3 additions & 0 deletions app/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class QueryModel(BaseModel):
min_num_phenotypic_sessions: int = None
assessment: str = None
image_modal: str = None
pipeline_name: str = None
pipeline_version: str = None
# TODO: Replace default value with union of local and public nodes once https://github.com/neurobagel/federation-api/issues/28 is merged
# syntax from https://github.com/tiangolo/fastapi/issues/4445#issuecomment-1117632409
node_url: list[str] | None = Field(Query(default=[]))
Expand All @@ -39,6 +41,7 @@ class CohortQueryResponse(BaseModel):
num_matching_subjects: int
subject_data: Union[list[dict], str]
image_modals: list
available_pipelines: dict


class NodesResponseStatus(str, Enum):
Expand Down
2 changes: 2 additions & 0 deletions app/api/routers/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ async def get_query(
query.min_num_phenotypic_sessions,
query.assessment,
query.image_modal,
query.pipeline_name,
query.pipeline_version,
query.node_url,
)

Expand Down
8 changes: 8 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,12 @@ def mocked_single_matching_dataset_result():
"http://purl.org/nidash/nidm#T1Weighted",
"http://purl.org/nidash/nidm#T2Weighted",
],
"available_pipelines": {
"https://github.com/nipoppy/pipeline-catalog/tree/main/processing/fmriprep": [
"23.1.3"
],
"https://github.com/nipoppy/pipeline-catalog/tree/main/processing/freesurfer": [
"7.3.2"
],
},
}

0 comments on commit eacdaa7

Please sign in to comment.