Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DIXON-3 => R21 project: get back heel into WebAPI/Atlas. #209

Merged
merged 2 commits into from Jun 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/main/java/org/ohdsi/webapi/service/CohortResultsService.java
Expand Up @@ -26,6 +26,7 @@
import org.ohdsi.webapi.cohortanalysis.CohortAnalysis;
import org.ohdsi.webapi.cohortanalysis.CohortAnalysisTask;
import org.ohdsi.webapi.cohortanalysis.CohortSummary;
import org.ohdsi.webapi.cohortresults.CohortAttribute;
import org.ohdsi.webapi.cohortresults.CohortBreakdown;
import org.ohdsi.webapi.cohortresults.CohortConditionDrilldown;
import org.ohdsi.webapi.cohortresults.CohortConditionEraDrilldown;
Expand Down Expand Up @@ -1564,6 +1565,37 @@ public List<PredictorResult> getExposureOutcomeCohortPredictors(@PathParam("sour
return results;
}

/**
* Returns heracles heel results (data quality issues) for the given cohort
* definition id
*
* @param id cohort definition id
* @return List<CohortAttribute>
*/
@GET
@Path("{sourceKey}/{id}/heraclesheel")
@Produces(MediaType.APPLICATION_JSON)
public List<CohortAttribute> getHeraclesHeel(@PathParam("id") final int id,
@PathParam("sourceKey") final String sourceKey,
@DefaultValue("false") @QueryParam("refresh") boolean refresh) {
List<CohortAttribute> attrs = new ArrayList<CohortAttribute>();
Source source = getSourceRepository().findBySourceKey(sourceKey);
final String key = CohortResultsAnalysisRunner.HERACLES_HEEL;
VisualizationData data = refresh ? null : this.visualizationDataRepository.findByCohortDefinitionIdAndSourceIdAndVisualizationKey(id, source.getSourceId(), key);

if (refresh || data == null) {
attrs = this.queryRunner.getHeraclesHeel(this.getSourceJdbcTemplate(source), id, source, true);
} else {
try {
attrs = mapper.readValue(data.getData(), new TypeReference<List<CohortAttribute>>(){});
} catch (Exception e) {
log.error(e);
}
}

return attrs;
}

private String JoinArray(final String[] array) {
String result = "";

Expand Down
@@ -1,4 +1,4 @@
select analysis_id as ATTRIBUTE_NAME, HERACLES_HEEL_warning as ATTRIBUTE_VALUE
from HERACLES_HEEL_results
from @ohdsi_database_schema.HERACLES_HEEL_results
where cohort_definition_id in (@cohortDefinitionId)
order by case when left(HERACLES_HEEL_warning,5) = 'Error' then 1 else 2 end, analysis_id