Skip to content

Commit 88ff415

Browse files
authored
Merge pull request #31 from VirtualFlyBrain/dev
Fix for bracket encoding in label
2 parents 7f57842 + 2ffd914 commit 88ff415

2 files changed

Lines changed: 20 additions & 21 deletions

File tree

performance.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# VFBquery Performance Test Results
22

3-
**Test Date:** 2025-10-21 16:42:22 UTC
4-
**Git Commit:** 1d3a4f0209a2afe11f2e3cbd3249ba15b1a16d5a
5-
**Branch:** main
6-
**Workflow Run:** 18691129981
3+
**Test Date:** 2025-10-21 17:38:40 UTC
4+
**Git Commit:** 92d798acf78d6f2e28fda943a831718308e92efd
5+
**Branch:** dev
6+
**Workflow Run:** 18692555570
77

88
## Test Overview
99

@@ -25,11 +25,11 @@ This performance test measures the execution time of VFB term info queries for s
2525

2626
**Test Status**: Performance test completed
2727

28-
- **FBbt_00003748 Query Time**: 0.8937 seconds
29-
- **VFB_00101567 Query Time**: 0.8238 seconds
30-
- **Total Query Time**: 1.7175 seconds
28+
- **FBbt_00003748 Query Time**: 1.5398 seconds
29+
- **VFB_00101567 Query Time**: 1.5656 seconds
30+
- **Total Query Time**: 3.1054 seconds
3131

3232
🎉 **Result**: All performance thresholds met!
3333

3434
---
35-
*Last updated: 2025-10-21 16:42:22 UTC*
35+
*Last updated: 2025-10-21 17:38:40 UTC*

src/vfbquery/vfb_queries.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,8 +1058,11 @@ def _get_instances_from_solr(short_form: str, return_dataframe=True, limit: int
10581058
# Use the ordered tags to match expected format
10591059
tags = '|'.join(ordered_tags)
10601060

1061-
# Extract thumbnail URL
1061+
# Extract thumbnail URL and convert to HTTPS
10621062
thumbnail_url = image_info.get('image_thumbnail', '') if image_info else ''
1063+
if thumbnail_url:
1064+
# Replace http with https and thumbnailT.png with thumbnail.png
1065+
thumbnail_url = thumbnail_url.replace('http://', 'https://').replace('thumbnailT.png', 'thumbnail.png')
10631066

10641067
# Format thumbnail with proper markdown link (matching Neo4j format)
10651068
thumbnail = ''
@@ -1071,6 +1074,7 @@ def _get_instances_from_solr(short_form: str, return_dataframe=True, limit: int
10711074

10721075
if template_label and anatomy_label:
10731076
# Create thumbnail markdown link matching the original format
1077+
# DO NOT encode brackets in alt text - that's done later by encode_markdown_links
10741078
alt_text = f"{anatomy_label} aligned to {template_label}"
10751079
link_target = f"{template_short_form},{anatomy_short_form}"
10761080
thumbnail = f"[![{alt_text}]({thumbnail_url} '{alt_text}')]({link_target})"
@@ -1083,22 +1087,13 @@ def _get_instances_from_solr(short_form: str, return_dataframe=True, limit: int
10831087
if template_label and template_short_form:
10841088
template_formatted = f"[{template_label}]({template_short_form})"
10851089

1086-
# Handle URL encoding for labels (match Neo4j format)
1090+
# Handle label formatting (match Neo4j format)
10871091
anatomy_label = anatomy.get('label', 'Unknown')
10881092
anatomy_short_form = anatomy.get('short_form', '')
10891093

1090-
# URL encode special characters in label for markdown links (matching Neo4j behavior)
1091-
# Only certain labels need encoding (like those with parentheses)
1092-
import urllib.parse
1093-
if '(' in anatomy_label or ')' in anatomy_label:
1094-
# URL encode but keep spaces and common characters
1095-
encoded_label = urllib.parse.quote(anatomy_label, safe=' -_.')
1096-
else:
1097-
encoded_label = anatomy_label
1098-
10991094
row = {
11001095
'id': anatomy_short_form,
1101-
'label': f"[{encoded_label}]({anatomy_short_form})",
1096+
'label': f"[{anatomy_label}]({anatomy_short_form})",
11021097
'tags': tags,
11031098
'parent': f"[{term_info.get('term', {}).get('core', {}).get('label', 'Unknown')}]({short_form})",
11041099
'source': '', # Not readily available in SOLR anatomy_channel_image
@@ -1116,7 +1111,11 @@ def _get_instances_from_solr(short_form: str, return_dataframe=True, limit: int
11161111
total_count = len(anatomy_images)
11171112

11181113
if return_dataframe:
1119-
return pd.DataFrame(rows)
1114+
df = pd.DataFrame(rows)
1115+
# Apply encoding to markdown links (matches Neo4j implementation)
1116+
columns_to_encode = ['label', 'parent', 'source', 'source_id', 'template', 'dataset', 'license', 'thumbnail']
1117+
df = encode_markdown_links(df, columns_to_encode)
1118+
return df
11201119

11211120
return {
11221121
"headers": _get_instances_headers(),

0 commit comments

Comments
 (0)