Skip to content

Add /imaging-modalities route for getting available imaging modality term instances & labels #502

@alyssadai

Description

@alyssadai

Currently, the instances endpoint responses have this structure:

{
  "nb:Diagnosis": [
    {
      "TermURL": "ncit:C94342",
      "Label": "Healthy Control"
    },
    {
      "TermURL": "snomed:58214004",
      "Label": "Schizophrenia"
    }
  ]
}

To provide all the imaging modality metadata the query tool needs to display, we at minimum need to add:

  • abbreviation (BIDS suffix)
  • data_type

We also want to make imaging terms configurable via a vocab file (similar to diagnoses/assessments) instead of hardcoding in CLI/query tool.

Implementation tasks

  • Communities

    • Add imaging modalities vocab to neurobagel/communities configs (e.g., Image standardized variable): update communities README with a small hint on imaging modalities being different
      • Include fields: term identifier (NIDM URI), label, abbreviation (BIDS suffix), and data_type.
      • Ensure config.json references the new vocab file so it’s fetched at startup.
  • API:

    • Add /imaging-modalities and /imaging-modalities/vocab routes mirroring assessments/diagnoses.
    • Ensure instances SPARQL query targets objects of nb:hasContrastType and matches each TermURL returned from the graph to the term's corresponding Label, abbreviation, and data_type from the vocab file fetched on startup
    • Extend startup vocab loading to include imaging vocab, add Imaging modality to configurable variables.
    • Update term response shaping to pass through the extra metadata for imaging modalities while keeping existing shape for other attributes.
    • implement test coverage for the new routes, including:
      • Happy path with vocab providing labels/abbreviation/data_type.
      • Handling missing labels/metadata.
      • Auth behavior consistent with other standardized-term routes.

Metadata

Metadata

Assignees

Labels

releasedThis issue/pull request has been released.

Projects

Status

Review - Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions