Skip to main content
deepgram-data-handling Implement audio data handling best practices for Deepgram integrations.
Use when managing audio file storage, implementing data retention,
or ensuring GDPR/HIPAA compliance for transcription data.
Trigger: "deepgram data", "audio storage", "transcription data",
"deepgram GDPR", "deepgram HIPAA", "deepgram privacy", "PII redaction".
跳到安装 Skills Marketplace 发现并探索由社区构建的 Agent Skills
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/jeremylongshore/claude-code-plugins-plus-skills --skill deepgram-data-handling命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
下载 Zip 下载中... 同仓库更多 Skills Implement user sign-up and sign-in flows with Clerk.
Use when building authentication UI, customizing sign-in experience,
or implementing OAuth social login.
Trigger with phrases like "clerk sign-in", "clerk sign-up",
"clerk login flow", "clerk OAuth", "clerk social login".
Implement session management and middleware with Clerk.
Use when managing user sessions, configuring route protection,
or implementing token refresh and custom JWT templates.
Trigger with phrases like "clerk session", "clerk middleware",
"clerk route protection", "clerk token", "clerk JWT".
Configure enterprise SSO, role-based access control, and organization management.
Use when implementing SSO integration, configuring role-based permissions,
or setting up organization-level controls.
Trigger with phrases like "clerk SSO", "clerk RBAC",
"clerk enterprise", "clerk roles", "clerk permissions", "clerk organizations".
jeremylongshore
jeremylongshore/claude-code-plugins-plus-skills
打开 GitHub 仓库 name deepgram-data-handling description Implement audio data handling best practices for Deepgram integrations.
Use when managing audio file storage, implementing data retention,
or ensuring GDPR/HIPAA compliance for transcription data.
Trigger: "deepgram data", "audio storage", "transcription data",
"deepgram GDPR", "deepgram HIPAA", "deepgram privacy", "PII redaction".
allowed-tools Read, Write, Edit, Bash(aws:*), Bash(gcloud:*) version 1.13.0 license MIT author Jeremy Longshore <jeremy@intentsolutions.io> tags ["saas","deepgram","data","compliance","privacy"] compatibility Designed for Claude Code, also compatible with Codex and OpenClaw
Deepgram Data Handling
Overview
Best practices for handling audio and transcript data with Deepgram. Covers Deepgram's built-in redact parameter for PII, secure audio upload with encryption, transcript storage patterns, data retention policies, and GDPR/HIPAA compliance workflows.
Data Privacy Quick Reference
Deepgram Feature What It Does Enable redact: ['pci']Masks credit card numbers in transcript Query param redact: ['ssn']Masks Social Security numbers Query param redact: ['numbers']Masks all numeric sequences Query param Data retention Deepgram does NOT store audio or transcripts Default behavior
Deepgram's data policy: Audio is processed in real-time and not stored. Transcripts are not retained unless you use Deepgram's optional storage features.
Instructions
Step 1: Deepgram Built-in PII Redaction
import { createClient } from '@deepgram/sdk' ;
const deepgram = createClient (process.env .DEEPGRAM_API_KEY !);
const { result } = await deepgram.listen .prerecorded .transcribeUrl (
{ url : audioUrl },
{
model : 'nova-3' ,
smart_format : true ,
redact : ['pci' , 'ssn' ],
}
);
console . (result. . [ ]. [ ]. );
log
results
channels
0
alternatives
0
transcript
Step 2: Application-Level PII Redaction
const piiPatterns : Array <{ name : string ; pattern : RegExp ; replacement : string }> = [
{ name : 'email' , pattern : /\b[\w.-]+@[\w.-]+\.\w{2,}\b/g , replacement : '[EMAIL]' },
{ name : 'phone' , pattern : /\b(\+?\d{1,3}[-.\s]?)?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}\b/g , replacement : '[PHONE]' },
{ name : 'dob' , pattern : /\b(0[1-9]|1[0-2])\/.-\/.-\d{2}\b/g , replacement : '[DOB]' },
{ name : 'address' , pattern : /\b\d{1,5}\s[\w\s]+(?:Street|St|Avenue|Ave|Road|Rd|Drive|Dr|Lane|Ln|Boulevard|Blvd)\b/gi , replacement : '[ADDRESS]' },
];
function redactPII (text : string ): { redacted : string ; found : string [] } {
let redacted = text;
const found : string [] = [];
for (const { name, pattern, replacement } of piiPatterns) {
const matches = text.match (pattern);
if (matches) {
found.push (`${name} : ${matches.length} occurrence(s)` );
redacted = redacted.replace (pattern, replacement);
}
}
return { redacted, found };
}
const transcript = result.results .channels [0 ].alternatives [0 ].transcript ;
const { redacted, found } = redactPII (transcript);
if (found.length > 0 ) console .log ('PII found and redacted:' , found);
Step 3: Secure Audio Upload and Storage import { S3Client, PutObjectCommand , GetObjectCommand } from '@aws-sdk/client-s3' ;
import { getSignedUrl } from '@aws-sdk/s3-request-presigner' ;
import { createHash, randomUUID } from 'crypto' ;
import { readFileSync } from 'fs' ;
const s3 = new S3Client ({ region : process.env .AWS_REGION ?? 'us-east-1' });
const BUCKET = process.env .AUDIO_BUCKET !;
async function uploadAudio (filePath : string , metadata : Record <string , string > = {} ) {
const audio = readFileSync (filePath);
const checksum = createHash ('sha256' ).update (audio).digest ('hex' );
const key = `audio/${randomUUID()} -${checksum.substring(0 , 8 )} .wav` ;
await s3.send (new PutObjectCommand ({
Bucket : BUCKET ,
Key : key,
Body : audio,
ContentType : 'audio/wav' ,
ServerSideEncryption : 'aws:kms' ,
Metadata : {
...metadata,
checksum,
uploadedAt : new Date ().toISOString (),
},
}));
const presignedUrl = await getSignedUrl (s3,
new GetObjectCommand ({ Bucket : BUCKET , Key : key }),
{ expiresIn : 3600 }
);
return { key, checksum, presignedUrl };
}
const { presignedUrl } = await uploadAudio ('./recording.wav' , { source : 'call-center' });
const { result } = await deepgram.listen .prerecorded .transcribeUrl (
{ url : presignedUrl },
{ model : 'nova-3' , smart_format : true , redact : ['pci' , 'ssn' ] }
);
Step 4: Transcript Storage Pattern interface StoredTranscript {
id : string ;
audioKey : string ;
requestId : string ;
transcript : string ;
confidence : number ;
duration : number ;
model : string ;
speakers : number ;
utterances ?: Array <{
speaker : number ;
text : string ;
start : number ;
end : number ;
}>;
metadata : {
redacted : boolean ;
piiTypesFound : string [];
createdAt : string ;
retentionPolicy : 'standard' | 'legal_hold' | 'hipaa' ;
expiresAt : string ;
};
}
function buildTranscriptRecord (
audioKey : string ,
result : any ,
retentionDays = 90
): StoredTranscript {
const alt = result.results .channels [0 ].alternatives [0 ];
const { redacted, found } = redactPII (alt.transcript );
return {
id : randomUUID (),
audioKey,
requestId : result.metadata .request_id ,
transcript : redacted,
confidence : alt.confidence ,
duration : result.metadata .duration ,
model : Object .keys (result.metadata .model_info ?? {})[0 ] ?? 'unknown' ,
speakers : new Set (alt.words ?.map ((w : any ) => w.speaker ).filter (Boolean )).size ,
utterances : result.results .utterances ?.map ((u : any ) => ({
speaker : u.speaker ,
text : u.transcript ,
start : u.start ,
end : u.end ,
})),
metadata : {
redacted : found.length > 0 ,
piiTypesFound : found,
createdAt : new Date ().toISOString (),
retentionPolicy : 'standard' ,
expiresAt : new Date (Date .now () + retentionDays * 86400000 ).toISOString (),
},
};
}
Step 5: Data Retention Policies const retentionPolicies = {
standard : { days : 90 , description : 'Default retention' },
legal_hold : { days : 2555 , description : '7 years for legal' },
hipaa : { days : 2190 , description : '6 years per HIPAA' },
temp : { days : 7 , description : 'Temporary processing' },
};
async function enforceRetention (db : any , s3Client : S3Client, bucket : string ) {
const now = new Date ();
const expired = await db.query (
'SELECT id, audio_key FROM transcripts WHERE expires_at < $1 AND retention_policy != $2' ,
[now.toISOString (), 'legal_hold' ]
);
console .log (`Found ${expired.rows.length} expired transcripts` );
for (const row of expired.rows ) {
try {
await s3Client.send (new DeleteObjectCommand ({
Bucket : bucket, Key : row.audio_key ,
}));
} catch (err : any ) {
console .error (`S3 delete failed for ${row.audio_key} :` , err.message );
}
await db.query ('DELETE FROM transcripts WHERE id = $1' , [row.id ]);
console .log (`Deleted: ${row.id} ` );
}
return expired.rows .length ;
}
Step 6: GDPR Right to Erasure async function processErasureRequest (userId : string , db : any , s3Client : S3Client, bucket : string ) {
console .log (`Processing GDPR erasure request for user: ${userId} ` );
const transcripts = await db.query (
'SELECT id, audio_key FROM transcripts WHERE user_id = $1' , [userId]
);
for (const row of transcripts.rows ) {
if (row.audio_key ) {
await s3Client.send (new DeleteObjectCommand ({ Bucket : bucket, Key : row.audio_key }));
}
}
const deleted = await db.query ('DELETE FROM transcripts WHERE user_id = $1' , [userId]);
await db.query ('DELETE FROM user_metadata WHERE user_id = $1' , [userId]);
console .log (JSON .stringify ({
action : 'gdpr_erasure' ,
userId : userId.substring (0 , 8 ) + '...' ,
transcriptsDeleted : deleted.rowCount ,
audioFilesDeleted : transcripts.rows .length ,
timestamp : new Date ().toISOString (),
}));
return { transcriptsDeleted : deleted.rowCount , audioFilesDeleted : transcripts.rows .length };
}
Output
Deepgram built-in PII redaction (pci, ssn, numbers)
Application-level PII redaction (email, phone, DOB, address)
Secure audio upload to S3 with KMS encryption
Transcript storage pattern with retention metadata
Automated retention enforcement
GDPR erasure workflow
Error Handling Issue Cause Solution PII still visible Deepgram redact not set Add redact: ['pci', 'ssn'] to options S3 upload fails Missing KMS permissions Add kms:GenerateDataKey to IAM role Retention not enforced Cron not running Schedule retention job, add monitoring Erasure incomplete Transaction failed Use database transactions for atomic delete
Resources