OHDSI / WebAPI

OHDSI WebAPI contains all OHDSI services that can be called from OHDSI applications
Apache License 2.0
126 stars 156 forks source link

TagRepository findXXXTagInfo() produces invalid SQL, should return minimal columns #2241

Closed chrisknoll closed 1 year ago

chrisknoll commented 1 year ago

Expected behavior

Calling TagRepository findCcTagInfo() should result in valid SQL.

Actual behavior

The HQL results in a query that fetches all columns of Tag, but only groups by the tag.id.

Steps to reproduce behavior

TagService.refreshTagStatistics() calls out to various TagRepository methods to collect counts-by-tag for information purposes. The problem is in queries like this, there select is pulling in all columns of Tag, but only grouping by tag_id.

After confirming with @anton-abushkevich , it seems we could change TagInfo to only have a tagId and the count, and eliminate the selection of the tag columns and only return columns that are necessary for tag statistics.