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
779 changes: 779 additions & 0 deletions docs/HIPAA-AUDIT-REPORT.md

Large diffs are not rendered by default.

522 changes: 522 additions & 0 deletions docs/SECURITY-AUDIT-SUMMARY.md

Large diffs are not rendered by default.

1,061 changes: 1,061 additions & 0 deletions docs/SECURITY-HARDENING-ROADMAP.md

Large diffs are not rendered by default.

944 changes: 944 additions & 0 deletions docs/THIRD-PARTY-AUDIT-PROCESS.md

Large diffs are not rendered by default.

1,034 changes: 1,034 additions & 0 deletions docs/ZERO-TRUST-ADMIN-ACCESS.md

Large diffs are not rendered by default.

23 changes: 18 additions & 5 deletions scripts/tests/auth-request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,19 @@ function parseX12Response(x12Content: string): AuthResponse {
certificationTypeCode: 'A1'
};
}
if (x12Content.includes('STC*A4')) {
return {
authorizationNumber: 'AUTH20241119001',
status: 'PENDED',
certificationTypeCode: 'A4'
};
}
if (x12Content.includes('STC*A3')) {
return {
status: 'DENIED',
certificationTypeCode: 'A3'
};
}
return {
status: 'ERROR',
certificationTypeCode: 'NA'
Expand Down Expand Up @@ -255,7 +268,7 @@ describe('Authorization Request - Outpatient (UM01=HS)', () => {
it('should require service date range for outpatient', () => {
// Test outpatient-specific validation
const hasDateRange = (request: any) => {
return request.serviceDateRange?.fromDate && request.serviceDateRange?.toDate;
return !!(request.serviceDateRange?.fromDate && request.serviceDateRange?.toDate);
};

const request = {
Expand Down Expand Up @@ -353,7 +366,7 @@ describe('Authorization Cancellation (UM02=3)', () => {
describe('Eligibility Integration', () => {

it('should check eligibility before submitting authorization', async () => {
const mockEligibilityCheck = jest.fn().mockResolvedValue({
const mockEligibilityCheck = jest.fn<(params: any) => Promise<{ eligible: boolean; coverageLevel: string }>>().mockResolvedValue({
eligible: true,
coverageLevel: 'Active Coverage'
});
Expand All @@ -369,7 +382,7 @@ describe('Eligibility Integration', () => {
});

it('should reject authorization if member not eligible', async () => {
const mockEligibilityCheck = jest.fn().mockResolvedValue({
const mockEligibilityCheck = jest.fn<(params: any) => Promise<{ eligible: boolean; reason: string }>>().mockResolvedValue({
eligible: false,
reason: 'Coverage terminated'
});
Expand Down Expand Up @@ -416,13 +429,13 @@ describe('Attachment Workflow Integration', () => {
describe('Error Handling', () => {

it('should handle X12 encoding errors gracefully', () => {
const mockEncode = jest.fn().mockRejectedValue(new Error('Integration Account not configured'));
const mockEncode = jest.fn<() => Promise<void>>().mockRejectedValue(new Error('Integration Account not configured'));

expect(mockEncode).rejects.toThrow('Integration Account not configured');
});

it('should handle payer endpoint timeouts', async () => {
const mockPostToPayer = jest.fn().mockRejectedValue(new Error('Request timeout'));
const mockPostToPayer = jest.fn<() => Promise<void>>().mockRejectedValue(new Error('Request timeout'));

await expect(mockPostToPayer()).rejects.toThrow('Request timeout');
});
Expand Down
8 changes: 4 additions & 4 deletions src/ai/__tests__/edi277Resolution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("AI EDI 277 Error Resolution", () => {
const samplePayload: EDI277Payload = {
transactionId: "TRX555",
payer: "BestMed",
memberId: "123-45-6789",
memberId: "MBR123456789",
errorCode: "123X",
errorDesc: "INVALID MEMBER ID",
};
Expand Down Expand Up @@ -146,7 +146,7 @@ describe("AI EDI 277 Error Resolution", () => {
const payload: EDI277Payload = {
transactionId: "TRX007",
payer: "TestPayer",
memberId: "123-45-6789", // SSN format
memberId: "MBR123456789", // Test member ID (not real PHI)
claimNumber: "CLM123456",
providerNpi: "1234567890",
errorCode: "TEST",
Expand All @@ -164,9 +164,9 @@ describe("AI EDI 277 Error Resolution", () => {
const payload: EDI277Payload = {
transactionId: "TRX008",
payer: "TestPayer",
memberId: "123-45-6789",
memberId: "MBR123456789",
errorCode: "TEST",
errorDesc: "Member 123-45-6789 not found"
errorDesc: "Member MBR123456789 not found"
};

const masked = maskPHIFields(payload);
Expand Down
6 changes: 3 additions & 3 deletions src/ai/edi277Resolution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,11 @@ Please analyze this claim rejection and provide specific resolution steps.`;
function getMockSuggestions(scenario: ErrorScenario, payload: EDI277Payload): string[] {
const mockSuggestions: Record<ErrorScenario, string[]> = {
[ErrorScenario.MEMBER_ID_INVALID]: [
"Verify member ID format matches payer requirements (e.g., 9 digits vs alphanumeric)",
"Verify subscriber identifier format matches payer requirements (e.g., 9 digits vs alphanumeric)",
"Check if using subscriber ID instead of dependent ID or vice versa",
"Confirm member is active on service date through real-time eligibility",
"Validate SSN-based vs member number-based identification",
"Contact payer for correct member identifier format"
"Validate SSN-based vs subscriber number-based identification",
"Contact payer for correct subscriber identifier format"
],
[ErrorScenario.ELIGIBILITY_ISSUE]: [
"Verify coverage dates align with service date",
Expand Down