CONTACT US

568-3-53 (3rd Floor) Kompleks Mutiara 3 1/2 Mile, Jalan Ipoh 51200 Kuala Lumpur, Malaysia 6012-9714904 support@yohz.com https://www.yohz.com https://www.dicomsearch.com https://yohzapps.yohz.com
Copyright © 2005 - 2020 Yohz Software, a division of Yohz Ventures Sdn Bhd. ALL RIGHTS RESERVED. All trademarks or registered trademarks are property of their respective owners

2.5

Advanced searches

In the previous topics, we have seen how to write your search query to retrieve the values you want using the SELECT list, and how to use the WHERE condition to filter the images. In this topic, we will explore how to form more complex search conditions. We will be using simplified queries in our examples, using the default tag aliases. The simplest search condition is a single condition e.g. modality = 'US' To add more conditions, use the AND and OR operators. For e.g. modality = 'US' AND weight > 60 will search for all ultrasound images where the patient weight is 60 or more. If instead we entered: modality = 'US' OR weight > 60 then all ultrasound images or images whose patient weight is 60 or more is returned. You can combine multiple AND and OR operators e.g. modality = 'US' OR modality = 'MR' AND weight > 60 This query will run, but it isn’t very clear exactly what we are searching for. In these cases, using brackets to group the search conditions makes it clearer e.g. modality = 'US' OR (modality = 'MR' AND weight > 60) means search for all ultrasound images, or MR images whose patient weight is greater than 60.

2.5.1

Why does the tag type matter?

In the Tags and Fields window, you can see the ‘type’ of each DICOM element. The tag type determines the kind of comparisons you can make with the tag value.

text type

The text type is the most common type. You can search for equality values e.g. modality = 'US' or inequality values e.g. modality <> 'US' This means return all images whose modality value is not ultrasound. You can search for a set using the IN operator e.g. modality IN ('US', 'MR', 'ES') which is a shorter way of writing modality = 'US' OR modality = 'MR' OR modality = 'ES' You can also search for partial strings using the LIKE operator. To search for images with a specific prefix, use the wildcard character (%) as a suffix e.g. name LIKE 'patient%' This returns all images where the name tag value starts with patient. To search for images with a specific suffix, use the wildcard character as a prefix e.g. name LIKE '%patient' This returns all images where the name tag value ends with patient. To search for images containing a specific word anywhere in its value, use the wildcard character both as a prefix and suffix e.g. name LIKE '%patient%'

number type

You can use the common mathematical operators for numeric tag types i.e. >, <, =, >=, <=, <>. E.g. weight > 60 AND weight <= 80 returns images where the patient large is larger than 60 and less than or equal to 80.

date and time types

Use the DATETIME operator when working with date values. The entered date value must be in the format YYYY-MM-DD, so the date 8 January 2020 must be entered as '2020-01-08'. Applying search conditions to date values can be done like this e.g. DATETIME(studydate) = '2011-01-01' returns images where the study date ([00080020]) is on 1 January 2011. Like numbers, you can search for a range of dates e.g. DATETIME(studydate) >= '2011-01-01' AND DATETIME(studaydate) < '2012-01-01' will return images where the study date ([00080020]) is in 2011. We’re seen how we index our DICOM images and how to search for those images using SQL queries and simplified queries. Now let’s see how we can use the search results.

Section summary

Tag types determine the type of values we can search for.

Related help file topics

Common SQL queries

CONTACT US

568-3-53 (3rd Floor) Kompleks Mutiara 3 1/2 Mile, Jalan Ipoh 51200 Kuala Lumpur, Malaysia 6012-9714904 support@yohz.com https://www.yohz.com https://www.dicomsearch.com https://yohzapps.yohz.com
Copyright © 2005 - 2020 Yohz Software, a division of Yohz Ventures Sdn Bhd. ALL RIGHTS RESERVED. All trademarks or registered trademarks are property of their respective owners

2.5

Advanced searches

In the previous topics, we have seen how to write your search query to retrieve the values you want using the SELECT list, and how to use the WHERE condition to filter the images. In this topic, we will explore how to form more complex search conditions. We will be using simplified queries in our examples, using the default tag aliases. The simplest search condition is a single condition e.g. modality = 'US' To add more conditions, use the AND and OR operators. For e.g. modality = 'US' AND weight > 60 will search for all ultrasound images where the patient weight is 60 or more. If instead we entered: modality = 'US' OR weight > 60 then all ultrasound images or images whose patient weight is 60 or more is returned. You can combine multiple AND and OR operators e.g. modality = 'US' OR modality = 'MR' AND weight > 60 This query will run, but it isn’t very clear exactly what we are searching for. In these cases, using brackets to group the search conditions makes it clearer e.g. modality = 'US' OR (modality = 'MR' AND weight > 60) means search for all ultrasound images, or MR images whose patient weight is greater than 60.

2.5.1

Why does the tag type matter?

In the Tags and Fields window, you can see the ‘type’ of each DICOM element. The tag type determines the kind of comparisons you can make with the tag value.

text type

The text type is the most common type. You can search for equality values e.g. modality = 'US' or inequality values e.g. modality <> 'US' This means return all images whose modality value is not ultrasound. You can search for a set using the IN operator e.g. modality IN ('US', 'MR', 'ES') which is a shorter way of writing modality = 'US' OR modality = 'MR' OR modality = 'ES' You can also search for partial strings using the LIKE operator. To search for images with a specific prefix, use the wildcard character (%) as a suffix e.g. name LIKE 'patient%' This returns all images where the name tag value starts with patient. To search for images with a specific suffix, use the wildcard character as a prefix e.g. name LIKE '%patient' This returns all images where the name tag value ends with patient. To search for images containing a specific word anywhere in its value, use the wildcard character both as a prefix and suffix e.g. name LIKE '%patient%'

number type

You can use the common mathematical operators for numeric tag types i.e. >, <, =, >=, <=, <>. E.g. weight > 60 AND weight <= 80 returns images where the patient large is larger than 60 and less than or equal to 80.

date and time types

Use the DATETIME operator when working with date values. The entered date value must be in the format YYYY-MM-DD, so the date 8 January 2020 must be entered as '2020-01-08'. Applying search conditions to date values can be done like this e.g. DATETIME(studydate) = '2011-01-01' returns images where the study date ([00080020]) is on 1 January 2011. Like numbers, you can search for a range of dates e.g. DATETIME(studydate) >= '2011-01-01' AND DATETIME(studaydate) < '2012-01-01' will return images where the study date ([00080020]) is in 2011. We’re seen how we index our DICOM images and how to search for those images using SQL queries and simplified queries. Now let’s see how we can use the search results.

Section summary

Tag types determine the type of values we can search for.

Related help file topics

Common SQL queries