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

Exact matches in a list of exclusion patterns do not work #337

Open
anton-abushkevich opened this issue Feb 7, 2022 · 0 comments
Open
Labels

Comments

@anton-abushkevich
Copy link
Contributor

anton-abushkevich commented Feb 7, 2022

"resultExclusions" are passing to ArachneExecutionEngine through DTO https://github.com/OHDSI/ArachneCommons/blob/develop/execution-engine-commons/src/main/java/com/odysseusinc/arachne/execution_engine_common/api/v1/dto/AnalysisSyncRequestDTO.java#L22

Before result send back to client, it's content is filtered according to exclusion patterns, and files that matches these patterns are deleted from results. But if list of exclusion patterns contains exact match, it will be skipped. See filterFiles() method in https://github.com/OHDSI/ArachneCommons/blob/develop/execution-engine-commons/src/main/java/com/odysseusinc/arachne/execution_engine_common/util/CommonFileUtils.java#L119

filterFiles() uses noneMatch() to filter files:

private static boolean noneMatch(List<String> patterns, String fileName) {

        return patterns.stream()
                .filter(matcher::isPattern)
                .noneMatch(e -> matcher.match(e.trim(), fileName));
}

matcher::isPattern returns false for exact matches, so only actual patterns are applied.

To fix this, we should change noneMatch() to something like this:

private static boolean noneMatch(List<String> patterns, String fileName) {

        return patterns.stream()
                .noneMatch(pattern -> matcher.isPattern(pattern)
                        ? matcher.match(pattern.trim(), fileName)
                        : pattern.equals(fileName));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants