Redacting PHI and PII from documents using Java

When you need to redact sensitive information like Protected Health Information (PHI) and Personally Identifiable Information (PII) from documents the Philter SDK for Java has you covered!

The Philter SDK for Java is an open source project that provides a client SDK for Philter. With this library it is easy to redact PHI and PII from documents using Philter. Here’s an example:

In our Maven project we will add the dependency:


Now, we can instantiate a client:

PhilterClient client = new PhilterClient.PhilterClientBuilder().withEndpoint("").build();
FilterResponse filterResponse = client.filter(text);

Be sure to change the endpoint to the endpoint of your running Philter instance. Now you are ready to redact!

FilterResponse response = client.filter("George Washington was president.");

The text parameter will be sent to Philter for redaction. The returned object will contain a value that is the redacted text. With the default settings, that return value will be {{{REDACTED-ner}}} was president.

If you want to get more details of what happened you can use the explain function instead.

ExplainResponse response = client.explain("George Washington was president.");

The explain function provides insight into what Philter redacted and why it was redacted. You can use explain to help tune your redaction or for troubleshooting.

That’s it! Now you are ready to integrate Philter’s powerful redaction capabilities into your Java libraries and applications. For full samples check out the project’s test class.

The Philter SDK for Java is licensed under the Apache License, version 2. It is available on GitHub.

Leave a Comment

Your email address will not be published. Required fields are marked *