use of org.obiba.mica.dataset.domain.HarmonizationDataset in project mica2 by obiba.
the class DraftDataschemaDatasetVariableResource method getVariableFacets.
@GET
@Path("/facet")
public List<Search.QueryResultDto> getVariableFacets() {
ImmutableList.Builder<Search.QueryResultDto> builder = ImmutableList.builder();
HarmonizationDataset dataset = getDataset();
dataset.getBaseStudyTables().forEach(table -> {
try {
String studyId = table.getStudyId();
builder.add(datasetService.getVariableFacet(dataset, variableName, studyId, table.getProject(), table.getTable()));
} catch (NoSuchVariableException | NoSuchValueTableException e) {
// ignore (case the study has not implemented this dataschema variable)
}
});
return builder.build();
}
use of org.obiba.mica.dataset.domain.HarmonizationDataset in project mica2 by obiba.
the class DraftDataschemaDatasetVariableResource method getVariableSummaries.
@GET
@Path("/summary")
public List<Math.SummaryStatisticsDto> getVariableSummaries() {
ImmutableList.Builder<Math.SummaryStatisticsDto> builder = ImmutableList.builder();
HarmonizationDataset dataset = getDataset();
dataset.getBaseStudyTables().forEach(table -> {
try {
String studyId = table.getStudyId();
builder.add(datasetService.getVariableSummary(dataset, variableName, studyId, table.getProject(), table.getTable()).getWrappedDto());
} catch (NoSuchVariableException | NoSuchValueTableException e) {
// ignore (case the study has not implemented this dataschema variable)
}
});
return builder.build();
}
use of org.obiba.mica.dataset.domain.HarmonizationDataset in project mica2 by obiba.
the class DraftDataschemaDatasetVariableResource method getHarmonizedVariables.
@GET
@Path("/harmonizations")
public List<Mica.DatasetVariableDto> getHarmonizedVariables() {
ImmutableList.Builder<Mica.DatasetVariableDto> builder = ImmutableList.builder();
HarmonizationDataset dataset = getDataset();
dataset.getBaseStudyTables().forEach(table -> {
try {
builder.add(dtos.asDto(datasetService.getDatasetVariable(dataset, variableName, table)));
} catch (NoSuchVariableException | NoSuchValueTableException e) {
// ignore (case the study has not implemented this dataschema variable)
}
});
return builder.build();
}
use of org.obiba.mica.dataset.domain.HarmonizationDataset in project mica2 by obiba.
the class Mica2Upgrade method migrateHarmonizationDataset.
private void migrateHarmonizationDataset() {
List<HarmonizationDataset> harmonizationDatasetsWithoutModel = harmonizationDatasetRepository.findWithoutModel();
if (!harmonizationDatasetsWithoutModel.isEmpty()) {
logger.info("Migrating harmonization datasets 1.x to 2.x: START");
for (HarmonizationDataset harmonizationDatasetWithoutModel : harmonizationDatasetsWithoutModel) {
harmonizationDatasetWithoutModel.getModel();
harmonizationDatasetRepository.save(harmonizationDatasetWithoutModel);
}
logger.info("Migrating harmonization datasets: END");
}
}
use of org.obiba.mica.dataset.domain.HarmonizationDataset in project mica2 by obiba.
the class HarmonizedDatasetService method delete.
public void delete(String id) {
HarmonizationDataset dataset = harmonizationDatasetRepository.findOne(id);
if (dataset == null) {
throw NoSuchDatasetException.withId(id);
}
fileSystemService.delete(FileUtils.getEntityPath(dataset));
helper.evictCache(dataset);
harmonizationDatasetStateRepository.delete(id);
harmonizationDatasetRepository.delete(id);
gitService.deleteGitRepository(dataset);
eventBus.post(new DatasetDeletedEvent(dataset));
}
Aggregations