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

[ALS-5656] Make TimeSeriesProcessor handle missing concept paths #97

Merged
merged 1 commit into from
Jan 10, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,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 (InvalidCacheLoadException | 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