Skip to content

Commit

Permalink
philterd#161 Adding a default ph-eye configuration. Fixing pheye filt…
Browse files Browse the repository at this point in the history
…er name for person.
  • Loading branch information
jzonthemtn committed Nov 19, 2024
1 parent ca739c0 commit 0cffd8a
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1083,10 +1083,10 @@ public List<Filter> getFiltersForPolicy(final Policy policy, final Map<String, M

}

if(policy.getIdentifiers().hasFilter(FilterType.PHEYE) && policy.getIdentifiers().getPhEye().isEnabled()) {
if(policy.getIdentifiers().hasFilter(FilterType.PERSON) && policy.getIdentifiers().getPhEye().isEnabled()) {

if(cache.containsKey(FilterType.PHEYE)) {
enabledFilters.add(cache.get(FilterType.PHEYE));
if(cache.containsKey(FilterType.PERSON)) {
enabledFilters.add(cache.get(FilterType.PERSON));
} else {

final FilterConfiguration filterConfiguration = new FilterConfiguration.FilterConfigurationBuilder()
Expand Down Expand Up @@ -1117,7 +1117,7 @@ public List<Filter> getFiltersForPolicy(final Policy policy, final Map<String, M
);

enabledFilters.add(filter);
filterCache.get(policy.getName()).put(FilterType.PHEYE, filter);
filterCache.get(policy.getName()).put(FilterType.PERSON, filter);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public enum FilterType {
IP_ADDRESS("ip-address", true),
MAC_ADDRESS("mac-address", true),
PASSPORT_NUMBER("passport-number", true),
PHEYE("pheye", false),
PERSON("person", false),
PHONE_NUMBER("phone-number", true),
PHONE_NUMBER_EXTENSION("phone-number-extension", true),
PHYSICIAN_NAME("physician-name", true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public static List<? extends AbstractFilterStrategy> getFilterStrategies(final P
return policy.getIdentifiers().getIbanCode().getIbanCodeFilterStrategies();
} else if(filterType == FilterType.IP_ADDRESS) {
return policy.getIdentifiers().getIpAddress().getIpAddressFilterStrategies();
} else if(filterType == FilterType.PHEYE) {
} else if(filterType == FilterType.PERSON) {
return policy.getIdentifiers().getPhEye().getPhEyeFilterStrategies();
} else if(filterType == FilterType.PASSPORT_NUMBER) {
return policy.getIdentifiers().getPassportNumber().getPassportNumberFilterStrategies();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ public static List<Span> fromLappsJson(String lappsJson) {

if(StringUtils.equalsIgnoreCase("PER", annotation.getFeatures().getCategory())) {

span.setFilterType(FilterType.PHEYE);
span.setFilterType(FilterType.PERSON);
span.setClassification("PER");

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public boolean hasFilter(FilterType filterType) {
if(this.getIpAddress() != null) { return true; } break;
case MAC_ADDRESS:
if(this.getMacAddress() != null) { return true; } break;
case PHEYE:
case PERSON:
if(this.getPhEye() != null) { return true; } break;
case PASSPORT_NUMBER:
if(this.getPassportNumber() != null) { return true; } break;
Expand Down Expand Up @@ -322,7 +322,7 @@ public Object getFilter(FilterType filterType) {
return this.macAddress;
case PASSPORT_NUMBER:
return this.passportNumber;
case PHEYE:
case PERSON:
return this.phEyeFilter;
case PHONE_NUMBER:
return this.phoneNumber;
Expand Down Expand Up @@ -419,7 +419,7 @@ public void setFilter(FilterType filterType, Object filter) {
case PASSPORT_NUMBER:
this.passportNumber = (PassportNumber) filter;
break;
case PHEYE:
case PERSON:
this.phEyeFilter = (PhEyeFilter) filter;
break;
case PHONE_NUMBER:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ public abstract class AbstractPhEyeFilter extends AbstractFilter {
protected PhEyeConfiguration phEyeConfiguration;

public PhEyeConfiguration getPhEyeConfiguration() {

// In case a configuration is not specified in the policy, use a default configuration.
if(phEyeConfiguration == null) {
phEyeConfiguration = new PhEyeConfiguration();
}

return phEyeConfiguration;

}

public void setPhEyeConfiguration(PhEyeConfiguration phEyeConfiguration) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class PhEyeConfiguration {

@SerializedName("endpoint")
@Expose
protected String endpoint = "http://localhost:18080/";
protected String endpoint = "http://philter-ph-eye-1:5000/";

@SerializedName("username")
@Expose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class PhEyeFilterStrategy extends AbstractFilterStrategy {

private static final Logger LOGGER = LogManager.getLogger(PhEyeFilterStrategy.class);

private static final FilterType filterType = FilterType.PHEYE;
private static final FilterType filterType = FilterType.PERSON;

@Override
public FilterType getFilterType() {
Expand Down

0 comments on commit 0cffd8a

Please # to comment.