Search in sources :

Example 1 with NoSuchValueTableException

use of org.obiba.magma.NoSuchValueTableException in project mica2 by obiba.

the class PublishedDataschemaDatasetVariableResource method getVariableSummaries.

@GET
@Path("/summary")
@Timed
public List<Math.SummaryStatisticsDto> getVariableSummaries() {
    ImmutableList.Builder<Math.SummaryStatisticsDto> builder = ImmutableList.builder();
    HarmonizationDataset dataset = getDataset(HarmonizationDataset.class, datasetId);
    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) {
            // case the study has not implemented this dataschema variable
            builder.add(Math.SummaryStatisticsDto.newBuilder().setResource(variableName).build());
        }
    });
    return builder.build();
}
Also used : NoSuchValueTableException(org.obiba.magma.NoSuchValueTableException) NoSuchVariableException(org.obiba.magma.NoSuchVariableException) ImmutableList(com.google.common.collect.ImmutableList) HarmonizationDataset(org.obiba.mica.dataset.domain.HarmonizationDataset) Path(javax.ws.rs.Path) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET)

Example 2 with NoSuchValueTableException

use of org.obiba.magma.NoSuchValueTableException 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();
}
Also used : NoSuchValueTableException(org.obiba.magma.NoSuchValueTableException) NoSuchVariableException(org.obiba.magma.NoSuchVariableException) ImmutableList(com.google.common.collect.ImmutableList) HarmonizationDataset(org.obiba.mica.dataset.domain.HarmonizationDataset) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 3 with NoSuchValueTableException

use of org.obiba.magma.NoSuchValueTableException 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();
}
Also used : NoSuchValueTableException(org.obiba.magma.NoSuchValueTableException) NoSuchVariableException(org.obiba.magma.NoSuchVariableException) ImmutableList(com.google.common.collect.ImmutableList) HarmonizationDataset(org.obiba.mica.dataset.domain.HarmonizationDataset) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 4 with NoSuchValueTableException

use of org.obiba.magma.NoSuchValueTableException 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();
}
Also used : NoSuchValueTableException(org.obiba.magma.NoSuchValueTableException) NoSuchVariableException(org.obiba.magma.NoSuchVariableException) ImmutableList(com.google.common.collect.ImmutableList) HarmonizationDataset(org.obiba.mica.dataset.domain.HarmonizationDataset) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 5 with NoSuchValueTableException

use of org.obiba.magma.NoSuchValueTableException 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();
}
Also used : NoSuchValueTableException(org.obiba.magma.NoSuchValueTableException) NoSuchVariableException(org.obiba.magma.NoSuchVariableException) ImmutableList(com.google.common.collect.ImmutableList) HarmonizationDataset(org.obiba.mica.dataset.domain.HarmonizationDataset) Path(javax.ws.rs.Path) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)5 GET (javax.ws.rs.GET)5 Path (javax.ws.rs.Path)5 NoSuchValueTableException (org.obiba.magma.NoSuchValueTableException)5 NoSuchVariableException (org.obiba.magma.NoSuchVariableException)5 HarmonizationDataset (org.obiba.mica.dataset.domain.HarmonizationDataset)5 Timed (com.codahale.metrics.annotation.Timed)2