Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
193 changes: 115 additions & 78 deletions README.md

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions samples/detect-api/deidentify-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
Transformations,
Bleep,
VaultConfig,
DeidentifyFileResponse,
} from 'skyflow-node';
import fs from 'fs';

Expand Down Expand Up @@ -92,7 +93,7 @@ async function performDeidentifyFile() {
// --- Image Options (apply when file is an image) ---
// options.setOutputProcessedImage(true); // Include processed image in output
// options.setOutputOcrText(true); // Include OCR text in response
// options.setMaskingMethod(MaskingMethod.Blackout); // Masking method for image entities
// options.setMaskingMethod(MaskingMethod.Blackbox); // Masking method for image entities

// --- PDF Options (apply when file is a PDF) ---
// options.setPixelDensity(1.5); // Pixel density for PDF processing
Expand All @@ -112,7 +113,7 @@ async function performDeidentifyFile() {


// Step 6: Call deidentifyFile API
const response = await skyflowClient
const response: DeidentifyFileResponse = await skyflowClient
.detect(primaryVaultConfig.vaultId)
.deidentifyFile(deidentifyFile, options);

Expand Down
15 changes: 8 additions & 7 deletions samples/detect-api/deidentify-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
TokenFormat,
TokenType,
Transformations,
DetectEntities
DetectEntities,
DeidentifyTextResponse
} from 'skyflow-node';

/**
Expand Down Expand Up @@ -55,10 +56,10 @@ async function performDeidentifyText() {
);

// Step 5: Configure DeidentifyTextOptions
const optionsText = new DeidentifyTextOptions();
const options = new DeidentifyTextOptions();

// setEntities: Specify which entities to deidentify
optionsText.setEntities([DetectEntities.CREDIT_CARD, DetectEntities.SSN]);
options.setEntities([DetectEntities.CREDIT_CARD, DetectEntities.SSN]);

// setAllowRegexList: Allowlist regex patterns (entities matching these will not be deidentified)
// optionsText.setAllowRegexList(['<YOUR_REGEX_PATTERN>']);
Expand All @@ -69,7 +70,7 @@ async function performDeidentifyText() {
// setTokenFormat: Specify the token format for deidentified entities
const tokenFormat = new TokenFormat();
tokenFormat.setDefault(TokenType.VAULT_TOKEN);
optionsText.setTokenFormat(tokenFormat);
options.setTokenFormat(tokenFormat);

// setTransformations: Specify custom transformations for entities
const transformations = new Transformations();
Expand All @@ -78,12 +79,12 @@ async function performDeidentifyText() {
min: 30, // Minimum shift days
entities: [DetectEntities.DOB], // Entities to apply the shift
});
optionsText.setTransformations(transformations);
options.setTransformations(transformations);

// Step 6: Call deidentifyText API
const response = await skyflowClient
const response: DeidentifyTextResponse = await skyflowClient
.detect(primaryVaultConfig.vaultId)
.deidentifyText(deidentifyTextRequest, optionsText);
.deidentifyText(deidentifyTextRequest, options);

// Handle Successful Response
console.log('Deidentify Text Response:', response);
Expand Down
5 changes: 3 additions & 2 deletions samples/detect-api/reidentify-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
ReidentifyTextRequest,
ReidentifyTextOptions,
DetectEntities,
SkyflowError
SkyflowError,
ReidentifyTextResponse
} from 'skyflow-node';

/**
Expand Down Expand Up @@ -60,7 +61,7 @@ async function performReidentifyText() {
options.setPlainTextEntities([DetectEntities.PHONE_NUMBER]);

// Step 6: Call reidentifyText
const response = await skyflowClient
const response: ReidentifyTextResponse = await skyflowClient
.detect(primaryVaultConfig.vaultId)
.reidentifyText(reidentifyRequest, options);

Expand Down
Loading
Loading