use of org.obiba.mica.dataset.domain.HarmonizationDataset in project mica2 by obiba.
the class StudyPackageImportServiceImpl method importDataset.
private void importDataset(HarmonizationDataset dataset, boolean publish) {
try {
HarmonizationDataset existing = harmonizedDatasetService.findById(dataset.getId());
// TODO merge study tables
harmonizedDatasetService.save(existing);
} catch (NoSuchDatasetException e) {
harmonizedDatasetService.save(dataset);
}
if (publish)
harmonizedDatasetService.publish(dataset.getId(), publish, PublishCascadingScope.ALL);
}
use of org.obiba.mica.dataset.domain.HarmonizationDataset in project mica2 by obiba.
the class PublishedDataschemaDatasetVariableResource method getVariableFacets.
@GET
@Path("/facet")
@Timed
public List<Search.QueryResultDto> getVariableFacets() {
ImmutableList.Builder<Search.QueryResultDto> builder = ImmutableList.builder();
HarmonizationDataset dataset = getDataset(HarmonizationDataset.class, datasetId);
dataset.getBaseStudyTables().forEach(table -> {
try {
String studyId = table.getStudyId();
builder.add(datasetService.getVariableFacet(dataset, variableName, studyId, table.getProject(), table.getTable()));
} catch (NoSuchVariableException | NoSuchValueTableException e) {
// case the study has not implemented this dataschema variable
builder.add(Search.QueryResultDto.newBuilder().setTotalHits(0).build());
}
});
return builder.build();
}
use of org.obiba.mica.dataset.domain.HarmonizationDataset in project mica2 by obiba.
the class PublishedHarmonizedDatasetResource method getVariableHarmonizationsInternal.
private Mica.DatasetVariablesHarmonizationsDto getVariableHarmonizationsInternal(String id, int from, int limit, String sort, String order, boolean includeSummaries) {
checkAccess(id);
Mica.DatasetVariablesHarmonizationsDto.Builder builder = Mica.DatasetVariablesHarmonizationsDto.newBuilder();
HarmonizationDataset dataset = getDataset(HarmonizationDataset.class, id);
Mica.DatasetVariablesDto variablesDto = getDatasetVariableDtos(id, DatasetVariable.Type.Dataschema, from, limit, sort, order);
builder.setTotal(variablesDto.getTotal()).setLimit(variablesDto.getLimit()).setFrom(variablesDto.getFrom());
variablesDto.getVariablesList().forEach(variable -> builder.addVariableHarmonizations(getVariableHarmonizationDto(dataset, variable.getName(), includeSummaries)));
return builder.build();
}
Aggregations