This explanation is necessarily quite long…
As I read I naturally saw the list of similar AND statements before I even read your description of what you wanted….. I thought “Couldn’t those be combined into one OR statement” ….. So as I then read the mail I realised I had thought exactly the same way as you had, and would have started with exactly the same query that doesn’t do what’s wanted….. ( for thinking like you, for it not doing what we want)
The Logic in CRIS is actually right and I’ll try to explain why:
In this version –
((Note_Text = “amitriptyline” OR Note_Text = “dosulepin” OR Note_Text = “clomipramine” OR Note_Text = “ofepramine” OR Note_Text = “mianserin” OR Note_Text = “nortriptyline” OR Note_Text = “mipramine” OR Note_Text = “trazodone” OR Note_Text = “trimipramine” OR Note_Text = “doxepin” OR Note_Text = “desipramine” OR Note_Text = “nefazodone” OR Note_Text = “phenelzine” OR Note_Text = “moclobemide” OR Note_Text = “tranylcypromine” OR Note_Text = “agomelatine” OR Note_Text = “bupropion” OR Note_Text = “citalopram” OR Note_Text = “desvenlafaxine” OR Note_Text = “duloxetine” OR Note_Text = “escitalopram” OR Note_Text = “fluoxetine” OR Note_Text = “fluvoxamine” OR Note_Text = “levomilnacipran” OR Note_Text = “milnacipran” OR Note_Text = “mirtazapine” OR Note_Text = “paroxetine” OR Note_Text = “reboxetine” OR Note_Text = “sertraline” OR Note_Text = “venlafaxine” OR Note_Text = “vilazodone” OR Note_Text = “vortioxetine”) AND Note_Date >= “2017-06-01”)
All of the Green text is within the large set of brackets and so all of those OR’s are being applied to the same individual instance of a clinical note [all notes will be looked at to see if they have any of the drugs], after that is done and we get outside the large brackets, only then is the black Note_Date being looked for, for more/other matches based on the date. Because this is outside the large set of brackets it is treated separately and looks afresh for instances of the field which match what is being asked for in that specific layer of bracketing.
Asides: The small brackets contain the whole query so could be removed [though I recognise that this may have been part of a larger query and so would be required in that case].If all the brackets are removed then there are ‘implied brackets’ around Note_Text = “vortioxetine” AND Note_Date >= “2017-06-01” this is due to AND having a higher priority than OR [in the same way that multiply takes a higher priority than plus in algebraic logic].
I didn’t grasp this “Layers of logic” principle for a good while, but it is actually right and becomes more intuitive with use and handles more queries than the sytem would if we made assumptions (which could be wrong). If you’re trying to explain to others then we did try to highlight/explain on the advanced searches page of the guide in the “search with Brackets” video there, so that maybe helpful for them to read/watch
Cont…