SKILL.md
Abridge Debug Bundle
Overview
Collect HIPAA-safe diagnostic data for Abridge support tickets. All PHI is automatically redacted before bundle creation.
Prerequisites
- Abridge credentials configured
- Access to application logs
- Node.js or bash for running diagnostic scripts
Instructions
Step 1: Generate Debug Bundle
// src/debug/abridge-debug-bundle.ts
import fs from 'fs';
import { execSync } from 'child_process';
interface DebugBundle {
timestamp: string;
environment: Record<string, string>;
connectivity: Record<string, any>;
recentErrors: any[];
sessionDiagnostics: any[];
fhirStatus: any;
}
async function generateDebugBundle(): Promise<DebugBundle> {
const bundle: DebugBundle = {
timestamp: new Date().toISOString(),
environment: collectEnvironment(),
connectivity: await testConnectivity(),
recentErrors: await collectRecentErrors(),
sessionDiagnostics: await collectSessionDiagnostics(),
fhirStatus: await checkFhirStatus(),
};
// Redact PHI before saving
const sanitized = redactPhi(JSON.stringify(bundle, null, 2));
const filename = `abridge-debug-${Date.now()}.json`;
fs.writeFileSync(filename, sanitized);
console.log(`Debug bundle saved: ${filename}`);
return bundle;
}
function collectEnvironment(): Record<string, string> {
return {
nodeVersion: process.version,
platform: process.platform,
abridgeBaseUrl: process.env.ABRIDGE_BASE_URL || 'NOT SET',
orgId: process.env.ABRIDGE_ORG_ID ? 'SET (redacted)' : 'NOT SET',
clientSecret: process.env.ABRIDGE_CLIENT_SECRET ? 'SET (redacted)' : 'NOT SET',
fhirBaseUrl: process.env.EPIC_FHIR_BASE_URL || 'NOT SET',
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
};
}
async function testConnectivity(): Promise<Record<string, any>> {
const results: Record<string, any> = {};
const endpoints = [
{ name: 'abridge_api', url: `${process.env.ABRIDGE_BASE_URL}/health` },
{ name: 'fhir_server', url: `${process.env.EPIC_FHIR_BASE_URL}/metadata` },
];
for (const ep of endpoints) {
try {
const start = Date.now();
const res = await fetch(ep.url, { signal: AbortSignal.timeout(5000) });
results[ep.name] = { status: res.status, latency_ms: Date.now() - start };
} catch (err) {
results[ep.name] = { status: 'UNREACHABLE', error: (err as Error).message };
}
}
return results;
}
function redactPhi(text: string): string {
return text
.replace(/\b\d{3}-\d{2}-\d{4}\b/g, '[SSN-REDACTED]')
.replace(/\b\d{10}\b/g, '[MRN-REDACTED]')
.replace(/"(name|patient_name|given|family)":\s*"[^"]+"/g, '"$1": "[REDACTED]"')
.replace(/\b\d{1,2}\/\d{1,2}\/\d{2,4}\b/g, '[DOB-REDACTED]');
}
