In this line DEVICES_BY_TYPE is fetched by CONCEPT_ID column. CONCEPT_ID column in the query behind the dataDevicesByType is device type concept ID (see analysis 2105 here), but it's compared with device concept id. So that it always returns empty results.