TissueImageAnalytics / tiatoolbox

Computational Pathology Toolbox developed by TIA Centre, University of Warwick.
https://warwick.ac.uk/tia
Other
340 stars 71 forks source link

Unexpected behaviour in annotation store when property key has a . in it #771

Closed measty closed 5 months ago

measty commented 5 months ago

Description

If a properties dictionary of an annotation has a . in it, some operations of AnnotationStore behave unexpectedly if the operation involves the usage of json_extract

Cause

The root of the issue is in the line:

https://github.com/TissueImageAnalytics/tiatoolbox/blob/3cea66215e0f340534d5a6b2b34b89dcabd70939/tiatoolbox/annotation/dsl.py#L268

In the case of a key which contains a . this ends up being incorrectly parsed. For example, if properties dict has a key 'MSI.status' and you try to do an operation which needs to access that property from the json, it gets parsed into a json_extract function call that instead of accessing a field 'MSI.status' in the JSON, tries to access a subfield 'status' of a field 'MSI' in the JSON