use of org.obiba.mica.dataset.domain.DatasetVariable in project mica2 by obiba.
the class PublishedHarmonizedDatasetVariableResource method getContingencyExcel.
@GET
@Path("/contingency/_export")
@Produces("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
@Timed
public Response getContingencyExcel(@QueryParam("by") String crossVariable) throws IOException {
Pair<DatasetVariable, DatasetVariable> variables = getContingencyVariables(crossVariable);
ByteArrayOutputStream res = new ExcelContingencyWriter(variables.getFirst(), variables.getSecond()).write(getContingencyDto(variables.getFirst(), variables.getSecond()));
return Response.ok(res.toByteArray()).header("Content-Disposition", String.format("attachment; filename=\"contingency-table-%s-%s.xlsx\"", variableName, crossVariable)).build();
}
use of org.obiba.mica.dataset.domain.DatasetVariable in project mica2 by obiba.
the class VariableQuery method processHits.
@Override
protected void processHits(MicaSearch.QueryResultDto.Builder builder, Searcher.DocumentResults results, QueryScope scope, CountStatsData counts) throws IOException {
MicaSearch.DatasetVariableResultDto.Builder resBuilder = MicaSearch.DatasetVariableResultDto.newBuilder();
Map<String, BaseStudy> studyMap = Maps.newHashMap();
Map<String, Network> networkMap = Maps.newHashMap();
for (Searcher.DocumentResult result : results.getDocuments()) {
if (result.hasSource()) {
DatasetVariable.IdResolver resolver = DatasetVariable.IdResolver.from(result.getId());
DatasetVariable variable = objectMapper.readValue(result.getSourceInputStream(), DatasetVariable.class);
resBuilder.addSummaries(processHit(resolver, variable, studyMap, networkMap));
}
}
builder.setExtension(MicaSearch.DatasetVariableResultDto.result, resBuilder.build());
}
Aggregations