The "exclude" argument in the getCandidateCodes function excludes all codes that contain the specified character vectors. However, I believe it would be more useful if it excluded only the exact words or character sequences specified.
For example, when phenotyping depression, I included codes containing the words "depression" or "depressive" and their descendants. However, some codes such as "ST depression" (referring to ECG changes and not the mental health condition) were also included. When I specified "ST depression" in the exclude argument, all codes containing the word "depression" were excluded, excluding the main codes relevant for the depression phenotype.
Thanks!