cutright / DVH-Analytics

A DICOM Database Application for Radiation Oncology
Other
82 stars 30 forks source link

Exclude is only working one time for Query #125

Closed Kiragroh closed 3 years ago

Kiragroh commented 3 years ago

Hi Dan,

I encountered a strange thing.

With these query settings MRN exclution is not working. screenshot_522

It works when one MRN-exclusion is present.

Is this normal?

cutright commented 3 years ago

Thanks for posting. I think the issue is in here: https://github.com/cutright/DVH-Analytics/blob/126f204a73adc8009a9d7a0769158d849abf9e6d/dvha/main.py#L897-L900

When multiple entries are provided for the same SQL column, they're combined with an OR. But I think maybe they should be combined with AND if the Filter Type is Exclude.

Kiragroh commented 3 years ago

Thanks Dan. With this simple if statement all is working fine.

DVH-Analytics/dvha/main.py Line 897:

` for table in queries:

        for col in queries_by_sql_column[table]:

            if "!=" in str(queries_by_sql_column[table][col]):
                queries[table].append("(%s)" % ' AND '.join(queries_by_sql_column[table][col]))
            else:
                queries[table].append("(%s)" % ' OR '.join(queries_by_sql_column[table][col]))

        queries[table] = ' AND '.join(queries[table])

`

cutright commented 3 years ago

I think that may fail if you have an include and an exclude for the same column? I'll come up with a more robust method this weekend.

Kiragroh commented 3 years ago

You are right. In this case, you get an unwanted Query. But in my Querys it is very unlikely that I mix 'include' and 'exclude' for the same 'category1'. Therefore I am happy about my quick fix. But please add a more robust fix.

cutright commented 3 years ago

Sorry for the delay, it's not the cleanest, but I think it works as expected.

https://github.com/cutright/DVH-Analytics/blob/ed7aa19e72b006496f71f6b0a2c0e92b4e1370be/dvha/main.py#L902-L913

Kiragroh commented 3 years ago

Hi Dan, I tried the newest 0.9.2 branch. I can do anything on my 13'' MacBookPro (BigSur) because the buttons that are cutOff can be access via ContextBar. But Keyboard-Shortcut for Fullscreen (Command+Control+F) or other tricks to get Fullscreen is not working.

screenshot_70
cutright commented 3 years ago

fixed in v0.9.2

cutright commented 3 years ago

Nope. Not fixed yet.

Screen Shot 2021-01-05 at 3 23 58 PM