Skip to content

Commit 6af602d

Browse files
committed
feat: add programmatically redaction example
1 parent 42dd655 commit 6af602d

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { baseOptions } from "../../shared/base-options";
2+
3+
const SENSITIVE_DATA = {
4+
places: ["Koram", "NomSao", "Uganda", "Ngogo", "Thailand", "Myanmar"],
5+
names: [
6+
"Lydia V Luncz",
7+
"Amanda Tan",
8+
"Michael Haslam",
9+
"Lars Kulik",
10+
"Tomos Proffitt",
11+
"Suchinda Malaivijitnond",
12+
"Michael Gumert",
13+
],
14+
};
15+
16+
const REDACTION_SEARCH_OPTIONS = {
17+
searchType: window.NutrientViewer.SearchType.TEXT,
18+
searchInAnnotations: false,
19+
caseSensitive: false,
20+
startPageIndex: 0,
21+
} as const;
22+
23+
window.NutrientViewer.load({
24+
...baseOptions,
25+
theme: window.NutrientViewer.Theme.DARK,
26+
}).then(async (instance) => {
27+
await Promise.all(
28+
SENSITIVE_DATA.places.map((place) =>
29+
instance.createRedactionsBySearch(place, REDACTION_SEARCH_OPTIONS),
30+
),
31+
);
32+
33+
await Promise.all(
34+
SENSITIVE_DATA.names.map((name) =>
35+
instance.createRedactionsBySearch(name, REDACTION_SEARCH_OPTIONS),
36+
),
37+
);
38+
39+
await instance.applyRedactions();
40+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
category: redaction
3+
title: Redact Keywords Programmatically
4+
description: Automatically searches for and redacts sensitive information like place names and personal names using the createRedactionsBySearch API.
5+
keywords: [redaction, search, keywords, sensitive-data, batch-redaction, programmatic]
6+
---

0 commit comments

Comments
 (0)