Skip to content

Commit 6f302fb

Browse files
committed
Add IsPaintedDomain field to TermInfoOutputSchema and update term_info_parse_object logic
1 parent f0be00b commit 6f302fb

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

src/vfbquery/vfb_queries.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ class TermInfoOutputSchema(Schema):
297297
IsClass = fields.Bool(missing=False, required=False)
298298
Examples = fields.Dict(keys=fields.String(), values=fields.List(fields.Nested(ImageSchema()), missing={}), required=False, allow_none=True)
299299
IsTemplate = fields.Bool(missing=False, required=False)
300+
IsPaintedDomain = fields.Bool(missing=False, required=False)
300301
Domains = fields.Dict(keys=fields.Integer(), values=fields.Nested(ImageSchema()), required=False, allow_none=True)
301302
Licenses = fields.Dict(keys=fields.Integer(), values=fields.Nested(LicenseSchema()), required=False, allow_none=True)
302303
Publications = fields.List(fields.Dict(keys=fields.String(), values=fields.Field()), required=False)
@@ -407,7 +408,7 @@ def term_info_parse_object(results, short_form):
407408
termInfo["Domains"] = {}
408409
termInfo["Licenses"] = {}
409410
termInfo["Publications"] = []
410-
termInfo["Synonyms"] = []
411+
termInfo["IsPaintedDomain"] = False
411412

412413
if results.hits > 0 and results.docs and len(results.docs) > 0:
413414
termInfo["Meta"] = {}
@@ -540,6 +541,12 @@ def term_info_parse_object(results, short_form):
540541
if vfbTerm.anatomy_channel_image and len(vfbTerm.anatomy_channel_image) > 0:
541542
images = {}
542543
for image in vfbTerm.anatomy_channel_image:
544+
# Check if this is a computer graphic image (painted domain)
545+
if hasattr(image, 'channel_image') and hasattr(image.channel_image, 'image') and hasattr(image.channel_image.image, 'imaging_technique'):
546+
technique = image.channel_image.image.imaging_technique
547+
if hasattr(technique, 'symbol') and technique.symbol and 'computer' in technique.symbol.lower():
548+
termInfo["IsPaintedDomain"] = True
549+
543550
record = {}
544551
record["id"] = image.anatomy.short_form
545552
label = image.anatomy.label
@@ -568,6 +575,12 @@ def term_info_parse_object(results, short_form):
568575
if vfbTerm.channel_image and len(vfbTerm.channel_image) > 0:
569576
images = {}
570577
for image in vfbTerm.channel_image:
578+
# Check if this is a computer graphic image (painted domain)
579+
if hasattr(image, 'image') and hasattr(image.image, 'imaging_technique'):
580+
technique = image.image.imaging_technique
581+
if hasattr(technique, 'symbol') and technique.symbol and 'computer' in technique.symbol.lower():
582+
termInfo["IsPaintedDomain"] = True
583+
571584
record = {}
572585
record["id"] = vfbTerm.term.core.short_form
573586
label = vfbTerm.term.core.label
@@ -888,7 +901,7 @@ def term_info_parse_object(results, short_form):
888901
queries.append(q)
889902

890903
# For individuals that are painted domains of anatomical regions, add parent class queries
891-
if termInfo["IsIndividual"]:
904+
if termInfo["IsIndividual"] and termInfo["IsPaintedDomain"]:
892905
anatomical_classes = []
893906

894907
# Check parents

0 commit comments

Comments
 (0)