Commit b710092
committed
TermsForPub: add Template / Imaging Technique / Thumbnail columns
Reviewer report: "List all terms that reference [pub]" results
table on v2-dev shows only Name | Type | Gross_Type. v2 prod shows
Name | Type | Gross_Type | Template_Space | Imaging_Technique |
Images. Three columns missing — parity regression from the SOLR
enrichment step that was dropped during the VFBquery migration.
Pre-migration the legacy XMI chain was:
//@dataSources.0/@queries.29 Cypher: get primary.short_form
//@dataSources.0/@queries.24 ProcessQuery: pass ids to SOLR
//@dataSources.3/@queries.1 SOLR: fetch denormalised record
SOLR's individual record had template / imaging-technique /
thumbnail fields baked in for any channel_image / anatomy_channel
individual. When the chain collapsed to a single VFBquery call,
the Cypher kept only id / name / tags / type and never gained the
template/technique/thumbnail walk.
Mirror the AnatomyExpressedIn pattern (vfb_queries.py:2837-2870)
adapted to TermsForPub. Walk keyed off `primary` (the cited
Individual) acting as its own channel:
OPTIONAL MATCH (primary)-[irw:in_register_with]->(template)-[:depicts]->(template_anat)
OPTIONAL MATCH (primary)-[:is_specified_output_of]->(technique)
For channel_image primaries: walks fire, columns populate.
For non-image primaries (datasets, EPs, anatomies): OPTIONAL
MATCHes return null, REPLACE strips `[null](null)` -> '', so
template / technique / thumbnail cells render empty. Matches
v2 prod's behaviour on Wolff2018 dataset rows (cells declared
but blank).
LIMIT applies before the CALL subquery so the multi-hop walk only
runs on rows we actually return — same idiom as AnatomyExpressedIn
and TransgeneExpressionHere.
Verified live against pdb on the reviewer-reported case
(FBrf0240744, Wolff and Rubin 2018):
Row: id=Wolff2018, name=[Splits targetting CX neurons, Wolff2018](Wolff2018),
tags=DataSet, type='', template='', technique='', thumbnail=''
Row: id=FlyLight2019Wolff2018, name=[Splits targetting CX neurons,
Wolff2018](FlyLight2019Wolff2018), tags=DataSet, type='',
template='', technique='', thumbnail=''
Both rows now return the full 7-column shape with empty trailing
cells — exact parity with the v2 prod screenshot.
Considered: route through SOLR enrichment instead, mirroring
_owlery_query_to_results pattern (Cypher id-fetch -> SOLR batch
lookup via {!terms f=id} fq, same as the legacy XMI's queries.24
step). Benchmarked against pdb + solr.virtualflybrain.org on the
four pubs with highest non-Unattributed has_reference counts:
pub nrefs | Cypher walk | Cypher+SOLR | speedup
FBrf0240744 2 | 129 ms | 206 ms | 0.63x
FBrf0256843 9 | 132 ms | 251 ms | 0.53x
FBrf0219813 3 | 130 ms | 246 ms | 0.53x
FBrf0242477 4 | 131 ms | 255 ms | 0.51x
Cypher walk wins because round-trip latency dominates at small N
and the SOLR approach adds a second HTTPS hop. Pre-computation
helps record compute (sub-ms either way), not record fetching.
Also: SOLR's anat_query field isn't populated on dataset ids
(only on classes), so a single-field SOLR fetch would miss
enrichment on the Wolff2018-shape rows that triggered this
report. Per-type field dispatch (anat_query for Class,
anat_image_query for Individual image, no enrichment for
DataSet) would widen the gap.
If a future pub grows TermsForPub past ~100 refs the trade
flips. Revisit then.
Patch bump 1.14.9 -> 1.14.10. @with_solr_cache('terms_for_pub')
buckets invalidated implicitly by the function source-hash
change (no bucket rename per [feedback_cache_invalidation]).1 parent 80c43e6 commit b710092
2 files changed
Lines changed: 71 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5404 | 5404 | | |
5405 | 5405 | | |
5406 | 5406 | | |
5407 | | - | |
| 5407 | + | |
| 5408 | + | |
| 5409 | + | |
| 5410 | + | |
| 5411 | + | |
| 5412 | + | |
| 5413 | + | |
| 5414 | + | |
| 5415 | + | |
| 5416 | + | |
| 5417 | + | |
| 5418 | + | |
| 5419 | + | |
| 5420 | + | |
5408 | 5421 | | |
5409 | 5422 | | |
5410 | 5423 | | |
5411 | | - | |
5412 | | - | |
| 5424 | + | |
| 5425 | + | |
| 5426 | + | |
| 5427 | + | |
| 5428 | + | |
| 5429 | + | |
| 5430 | + | |
5413 | 5431 | | |
5414 | | - | |
5415 | | - | |
5416 | | - | |
| 5432 | + | |
| 5433 | + | |
| 5434 | + | |
| 5435 | + | |
| 5436 | + | |
| 5437 | + | |
| 5438 | + | |
| 5439 | + | |
| 5440 | + | |
| 5441 | + | |
| 5442 | + | |
| 5443 | + | |
| 5444 | + | |
| 5445 | + | |
| 5446 | + | |
| 5447 | + | |
| 5448 | + | |
| 5449 | + | |
| 5450 | + | |
| 5451 | + | |
| 5452 | + | |
| 5453 | + | |
| 5454 | + | |
| 5455 | + | |
| 5456 | + | |
| 5457 | + | |
| 5458 | + | |
5417 | 5459 | | |
5418 | 5460 | | |
5419 | | - | |
5420 | | - | |
5421 | | - | |
5422 | | - | |
| 5461 | + | |
| 5462 | + | |
| 5463 | + | |
| 5464 | + | |
| 5465 | + | |
| 5466 | + | |
| 5467 | + | |
| 5468 | + | |
| 5469 | + | |
| 5470 | + | |
| 5471 | + | |
| 5472 | + | |
| 5473 | + | |
| 5474 | + | |
| 5475 | + | |
| 5476 | + | |
| 5477 | + | |
| 5478 | + | |
| 5479 | + | |
| 5480 | + | |
| 5481 | + | |
| 5482 | + | |
5423 | 5483 | | |
5424 | 5484 | | |
5425 | 5485 | | |
| |||
0 commit comments