MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / main

Function main

dlp/deIdentifyTableRowSuppress.js:21–106  ·  view source on GitHub ↗
(projectId)

Source from the content-addressed store, hash-verified

19// description: De-identify table data using conditional logic to suppress row data.
20// usage: node deIdentifyTableRowSuppress.js my-project
21function main(projectId) {
22 // [START dlp_deidentify_table_row_suppress]
23 // Imports the Google Cloud Data Loss Prevention library
24 const DLP = require('@google-cloud/dlp');
25
26 // Initialize google DLP Client
27 const dlp = new DLP.DlpServiceClient();
28
29 // The project ID to run the API call under
30 // const projectId = 'my-project';
31
32 // Construct the tabular data
33 const tablularData = {
34 headers: [{name: 'AGE'}, {name: 'PATIENT'}, {name: 'HAPPINESS SCORE'}],
35 rows: [
36 {
37 values: [
38 {integerValue: 101},
39 {stringValue: 'Charles Dickens'},
40 {integerValue: 95},
41 ],
42 },
43 {
44 values: [
45 {integerValue: 22},
46 {stringValue: 'Jane Austen'},
47 {integerValue: 21},
48 ],
49 },
50 {
51 values: [
52 {integerValue: 55},
53 {stringValue: 'Mark Twain'},
54 {integerValue: 75},
55 ],
56 },
57 ],
58 };
59 async function deIdentifyTableRowSuppress() {
60 // Specify when the content should be de-identified.
61 const condition = {
62 expressions: {
63 conditions: {
64 conditions: [
65 {
66 field: {name: 'AGE'},
67 operator: 'GREATER_THAN',
68 value: {integerValue: 89},
69 },
70 ],
71 },
72 },
73 };
74
75 // Apply the condition to record suppression.
76 const recordTransformations = {
77 recordSuppressions: [
78 {

Callers 1

Calls 1

Tested by

no test coverage detected