use of org.pmiops.workbench.model.ChartInfo in project workbench by all-of-us.
the class CohortBuilderController method getChartInfo.
@Override
public ResponseEntity<ChartInfoListResponse> getChartInfo(Long cdrVersionId, SearchRequest request) {
CdrVersionContext.setCdrVersion(cdrVersionDao.findOne(cdrVersionId));
ChartInfoListResponse response = new ChartInfoListResponse();
QueryJobConfiguration qjc = bigQueryService.filterBigQueryConfig(participantCounter.buildChartInfoCounterQuery(new ParticipantCriteria(request)));
QueryResult result = bigQueryService.executeQuery(qjc);
Map<String, Integer> rm = bigQueryService.getResultMapper(result);
for (List<FieldValue> row : result.iterateAll()) {
response.addItemsItem(new ChartInfo().gender(bigQueryService.getString(row, rm.get("gender"))).race(bigQueryService.getString(row, rm.get("race"))).ageRange(bigQueryService.getString(row, rm.get("ageRange"))).count(bigQueryService.getLong(row, rm.get("count"))));
}
return ResponseEntity.ok(response);
}
Aggregations