Skip to content

Commit

Permalink
[ALS-5656] Make TimeSeriesProcessor handle missing concept paths
Browse files Browse the repository at this point in the history
- In GIC land, we get queries that have a concept path that is present
in some other site, but not the one the query is getting run in
- The TimeseriesProcessor needs to not explode when this happens
  • Loading branch information
Luke Sikina committed Jan 10, 2024
1 parent 3d460e9 commit aead8c9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,19 @@ protected PhenoCube getCube(String path) {
}
}

/**
* Get a cube without throwing an error if not found.
* Useful for federated pic-sure's where there are fewer
* guarantees about concept paths.
*/
protected Optional<PhenoCube<?>> nullableGetCube(String path) {
try {
return Optional.ofNullable(store.get(path));
} catch (ExecutionException e) {
return Optional.empty();
}
}

public TreeMap<String, ColumnMeta> getDictionary() {
return phenotypeMetaStore.getMetaStore();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,12 @@ private void addDataForConcepts(Collection<String> pathList, Set<String> exporte
continue;
}
ArrayList<String[]> dataEntries = new ArrayList<String[]>();
PhenoCube<?> cube = abstractProcessor.getCube(conceptPath);
if(cube == null) {
log.warn("Attempting export of non-existant concept: " + conceptPath);
Optional<PhenoCube<?>> maybeCube = abstractProcessor.nullableGetCube(conceptPath);
if(maybeCube.isEmpty()) {
log.warn("Attempting export of non-existant concept: {}", conceptPath);
continue;
}
PhenoCube<?> cube = maybeCube.get();
log.debug("Exporting " + conceptPath);
List<?> valuesForKeys = cube.getValuesForKeys(idList);
for (Object kvObj : valuesForKeys) {
Expand Down

0 comments on commit aead8c9

Please sign in to comment.