Skip to content

Carousel multi-template query images + collapse multi-dataset rows#61

Merged
Robbie1977 merged 3 commits into
mainfrom
fix/carousel-get-instances
Jun 30, 2026
Merged

Carousel multi-template query images + collapse multi-dataset rows#61
Robbie1977 merged 3 commits into
mainfrom
fix/carousel-get-instances

Conversation

@Robbie1977

@Robbie1977 Robbie1977 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Query-result rows previously returned a single image thumbnail per row, and for image terms aligned to more than one template (e.g. DNc02 VFB_jrmc37oj — brain JRC2018U + VNC JRCVNC2018U) that single thumbnail was an arbitrary alignment that didn't follow the loaded template. Separately, get_instances (ListAllAvailableImages) multiplied rows for images sourced from several datasets, producing duplicate/triple rows for the same image.
This PR makes every affected query function emit all alignments' thumbnails as a ; -joined carousel (each item tagged template,imageId), and collapses the multi-dataset rows into one row per image. The frontend (geppetto-vfb slideshowImageComponent) then brings the loaded template's thumbnail to the front of the carousel.
Changes
get_instances / ListAllAvailableImages

The registration + has_source MATCH yields one row per (instance, template, dataset). Collapse to one row per instance via groupby('id'):

thumbnails join into a DISTINCT '; ' carousel (a template's thumbnail repeats across datasets, so dedupe);
datasets join into a distinct ', ' list (fixes the duplicate/triple rows for images sourced from several datasets, e.g. larval mushroom body output neuron).

get_neuron_neuron_connectivity, get_similar_neurons, get_individual_neuron_inputs

Previously used LIMIT 1 to a single alignment. Now use collect + apoc.text.join (with collect(DISTINCT …) where the INSTANCEOF type/technique cross-product would otherwise duplicate entries) so multi-template neurons return all alignments' thumbnails as a carousel. A representative template/technique is kept for the non-image columns.
Validation
All Cypher changes validated against pdb.virtualflybrain.org (read-only):

multi-template neurons return nThumbs == nTemplates (no duplicates, none dropped);
multi-dataset instances collapse to one row with every dataset listed (confirmed against a known 4-dataset instance).

Downstream / no Java change needed
The multi-valued dataset cell (ds1, ds2, …) passes straight through VFBqueryJsonProcessor.formatGenericCell and renders via MarkdownLinkComponent, whose label regex is global — so every dataset renders as its own clickable chip regardless of separator. The thumbnail carousel cell is handled by the existing separator-agnostic imageMarkdownToVariableJson path.
Scope
Backend (VFBquery) only. The frontend carousel-reorder-by-loaded-template lives in geppetto-client (slideshowImageComponent) / geppetto-vfb and is tracked separately. The larger per-template geometry and downloads work (lazy ImportType per template + frontend select/promote) is also separate and not in this PR.

…arousel

The registration MATCH returns one row per (instance, template), so a
multi-template instance appeared as several rows each with a single thumbnail.
Group by instance and join every alignment's thumbnail into the '; '-joined
multi-image carousel the V2 Images column renders, so the frontend can bring the
loaded template's thumbnail to the front. Mirrors the existing groupby collapse
in TransgeneExpressionHere and the multi-thumbnail carousel the shared
_owlery_query_to_results helper already emits.
- get_instances: collapse the per-(template, dataset) rows the registration +
  has_source MATCH multiplies into one row per instance: thumbnails join into a
  DISTINCT '; ' carousel (a template's thumbnail repeats across datasets), and
  datasets join into a distinct ', ' list (fixes the duplicate/triple rows for
  images sourced from several datasets, e.g. larval mushroom body output neuron).
- get_neuron_neuron_connectivity, get_similar_neurons: replace the single-
  alignment LIMIT 1 subquery with collect + apoc.text.join so multi-template
  neurons return all alignments' thumbnails as a carousel (representative template/
  technique kept for those columns). Validated against pdb.virtualflybrain.org.

Frontend (geppetto-vfb slideshowImageComponent) brings the loaded template's
thumbnail to the front of the carousel.
@Robbie1977 Robbie1977 changed the title get_instances: collapse per-template rows into a multi-template thumbnail carousel Carousel multi-template query images + collapse multi-dataset rows Jun 30, 2026
The Images/Template_Space collects had no DISTINCT, so the cross-product with
INSTANCEOF types / imaging techniques repeated each alignment's thumbnail (e.g.
2 templates -> 6 thumbnails, 1 -> 3). Use collect(DISTINCT ...) so it is one
thumbnail per template, and align the thumbnail markdown with the other query
functions (template,imageId ref + 'aligned to' alt + '; ' separator) so the
frontend reorders by the loaded template. Validated against pdb (nThumbs ==
nTemplates per neuron).
@Robbie1977

Copy link
Copy Markdown
Contributor Author

Now also included (was previously deferred): the connectivity/similarity functions — get_neuron_neuron_connectivity, get_similar_neurons, get_individual_neuron_inputs — previously used LIMIT 1 to a single alignment. They now use collect + apoc.text.join (with collect(DISTINCT …) where a cross-product would otherwise duplicate) so multi-template neurons return all alignments' thumbnails as a carousel, with a representative template/technique kept for the non-image columns. All validated against pdb.virtualflybrain.org (nThumbs == nTemplates).

@Robbie1977 Robbie1977 merged commit 79a5fda into main Jun 30, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant