(projectId)
| 20 | // usage: node deIdentifyTableBucketing.js my-project |
| 21 | |
| 22 | function main(projectId) { |
| 23 | // [START dlp_deidentify_table_bucketing] |
| 24 | // Imports the Google Cloud Data Loss Prevention library |
| 25 | const DLP = require('@google-cloud/dlp'); |
| 26 | |
| 27 | // Initialize google DLP Client |
| 28 | const dlp = new DLP.DlpServiceClient(); |
| 29 | |
| 30 | // The project ID to run the API call under |
| 31 | // const projectId = 'my-project'; |
| 32 | |
| 33 | // Construct the tabular data |
| 34 | const tablularData = { |
| 35 | headers: [{name: 'AGE'}, {name: 'PATIENT'}, {name: 'HAPPINESS SCORE'}], |
| 36 | rows: [ |
| 37 | { |
| 38 | values: [ |
| 39 | {integerValue: 101}, |
| 40 | {stringValue: 'Charles Dickens'}, |
| 41 | {integerValue: 95}, |
| 42 | ], |
| 43 | }, |
| 44 | { |
| 45 | values: [ |
| 46 | {integerValue: 22}, |
| 47 | {stringValue: 'Jane Austen'}, |
| 48 | {integerValue: 21}, |
| 49 | ], |
| 50 | }, |
| 51 | { |
| 52 | values: [ |
| 53 | {integerValue: 55}, |
| 54 | {stringValue: 'Mark Twain'}, |
| 55 | {integerValue: 75}, |
| 56 | ], |
| 57 | }, |
| 58 | ], |
| 59 | }; |
| 60 | async function deIdentifyTableBucketing() { |
| 61 | // Specify field to be de-identified. |
| 62 | const targetColumn = {name: 'HAPPINESS SCORE'}; |
| 63 | |
| 64 | // Specify how the content should be de-identified. |
| 65 | const bucketingConfig = { |
| 66 | bucketSize: 10, |
| 67 | lowerBound: { |
| 68 | integerValue: 0, |
| 69 | }, |
| 70 | upperBound: { |
| 71 | integerValue: 100, |
| 72 | }, |
| 73 | }; |
| 74 | |
| 75 | const primitiveTransformation = { |
| 76 | fixedSizeBucketingConfig: bucketingConfig, |
| 77 | }; |
| 78 | |
| 79 | // Combine configurations into a request for the service. |
no test coverage detected