emr-types
Version:
Comprehensive TypeScript Types Library for Electronic Medical Record (EMR) Applications - Domain-Driven Design with Zod Validation
1,387 lines (1,386 loc) • 140 kB
TypeScript
import { z } from 'zod';
export interface ValidationResult<T = unknown> {
success: boolean;
data?: T;
errors?: string[];
details?: z.ZodError;
}
export interface ValidationError {
field: string;
message: string;
code?: string;
value?: unknown;
}
/**
* Validate data against a Zod schema with detailed error information
*/
export declare function validateSchema<T>(schema: z.ZodSchema<T>, data: unknown): ValidationResult<T>;
/**
* Safe parse that doesn't throw exceptions
*/
export declare function safeParse<T>(schema: z.ZodSchema<T>, data: unknown): ValidationResult<T>;
/**
* Validate data and return simple boolean result
*/
export declare function isValid(schema: z.ZodSchema, data: unknown): boolean;
/**
* Transform data using schema (useful for data cleaning)
*/
export declare function transform<T>(schema: z.ZodSchema<T>, data: unknown): T;
export declare const UserValidation: {
validateCreateUser: (data: unknown) => ValidationResult<{
email: string;
firstName: string;
lastName: string;
password: string;
phoneNumber?: string | undefined;
address?: {
street: string;
city: string;
country: string;
state: string;
postalCode: string;
} | undefined;
preferences?: Record<string, unknown> | undefined;
displayName?: string | undefined;
role?: import("..").UserRole | undefined;
}>;
validateUpdateUser: (data: unknown) => ValidationResult<{
status?: import("..").UserStatus | undefined;
firstName?: string | undefined;
lastName?: string | undefined;
phoneNumber?: string | undefined;
address?: {
street: string;
city: string;
country: string;
state: string;
postalCode: string;
} | undefined;
preferences?: Record<string, unknown> | undefined;
displayName?: string | undefined;
role?: import("..").UserRole | undefined;
}>;
validateLogin: (data: unknown) => ValidationResult<{
email: string;
password: string;
deviceInfo?: {
userAgent: string;
ipAddress: string;
deviceType?: "desktop" | "mobile" | "tablet" | undefined;
os?: string | undefined;
browser?: string | undefined;
} | undefined;
rememberMe?: boolean | undefined;
}>;
validateChangePassword: (data: unknown) => ValidationResult<{
currentPassword: string;
newPassword: string;
confirmPassword: string;
}>;
validateUser: (data: unknown) => ValidationResult<{
email: {
value: string;
createdAt: Date;
isVerified: boolean;
verifiedAt?: Date | undefined;
};
id: string;
createdAt: Date;
updatedAt: Date;
status: import("..").UserStatus;
password: {
value: string;
createdAt: Date;
hashedValue: string;
salt: string;
algorithm: "bcrypt" | "argon2" | "scrypt";
iterations: number;
lastChangedAt: Date;
};
role: import("..").UserRole;
profile: {
id: string;
createdAt: Date;
updatedAt: Date;
firstName: string;
lastName: string;
createdBy?: string | undefined;
updatedBy?: string | undefined;
dateOfBirth?: Date | undefined;
phoneNumber?: string | undefined;
address?: {
street: string;
city: string;
country: string;
state: string;
postalCode: string;
} | undefined;
preferences?: Record<string, unknown> | undefined;
displayName?: string | undefined;
avatar?: string | undefined;
bio?: string | undefined;
};
createdBy?: string | undefined;
updatedBy?: string | undefined;
sessions?: {
id: string;
createdAt: Date;
userId: string;
token: string;
isActive: boolean;
expiresAt: Date;
lastActivityAt: Date;
refreshToken?: string | undefined;
deviceInfo?: {
userAgent: string;
ipAddress: string;
deviceType: "desktop" | "mobile" | "tablet";
os: string;
browser: string;
} | undefined;
}[] | undefined;
permissions?: string[] | undefined;
lastLoginAt?: Date | undefined;
loginAttempts?: number | undefined;
lockedUntil?: Date | undefined;
emailVerifiedAt?: Date | undefined;
twoFactorEnabled?: boolean | undefined;
twoFactorSecret?: string | undefined;
deletedAt?: Date | undefined;
}>;
validateUserResponse: (data: unknown) => ValidationResult<{
email: string;
id: string;
createdAt: Date;
updatedAt: Date;
status: import("..").UserStatus;
role: import("..").UserRole;
profile: {
firstName: string;
lastName: string;
phoneNumber?: string | undefined;
displayName?: string | undefined;
avatar?: string | undefined;
};
twoFactorEnabled: boolean;
lastLoginAt?: Date | undefined;
emailVerifiedAt?: Date | undefined;
}>;
validateUserList: (data: unknown) => ValidationResult<{
users: {
email: string;
id: string;
createdAt: Date;
updatedAt: Date;
status: import("..").UserStatus;
role: import("..").UserRole;
profile: {
firstName: string;
lastName: string;
phoneNumber?: string | undefined;
displayName?: string | undefined;
avatar?: string | undefined;
};
twoFactorEnabled: boolean;
lastLoginAt?: Date | undefined;
emailVerifiedAt?: Date | undefined;
}[];
pagination: {
page: number;
limit: number;
total: number;
totalPages: number;
};
}>;
isValidEmail: (email: string) => boolean;
isStrongPassword: (password: string) => boolean;
validatePasswordStrength: (password: string) => {
isValid: boolean;
errors: string[];
};
};
export declare const TenantValidation: {
validateCreateTenant: (data: unknown) => ValidationResult<{
type: import("..").TenantType;
name: string;
slug: string;
domain: string;
contact: {
email: string;
phone?: string | undefined;
address?: {
street: string;
city: string;
country: string;
state: string;
postalCode: string;
} | undefined;
};
billing: {
plan: "basic" | "professional" | "enterprise" | "free";
billingCycle: "monthly" | "quarterly" | "annually";
paymentMethod?: {
type: "paypal" | "credit_card" | "bank_transfer";
token?: string | undefined;
} | undefined;
};
config?: {
features?: {
multiTenancy?: boolean | undefined;
sso?: boolean | undefined;
auditLogging?: boolean | undefined;
backup?: boolean | undefined;
customBranding?: boolean | undefined;
apiAccess?: boolean | undefined;
webhookSupport?: boolean | undefined;
advancedAnalytics?: boolean | undefined;
} | undefined;
limits?: {
maxUsers?: number | undefined;
maxStorage?: number | undefined;
maxApiCalls?: number | undefined;
maxBackups?: number | undefined;
maxCustomDomains?: number | undefined;
} | undefined;
settings?: {
security?: {
passwordPolicy?: {
minLength?: number | undefined;
requireUppercase?: boolean | undefined;
requireLowercase?: boolean | undefined;
requireNumbers?: boolean | undefined;
requireSpecialChars?: boolean | undefined;
maxAge?: number | undefined;
} | undefined;
sessionTimeout?: number | undefined;
maxLoginAttempts?: number | undefined;
twoFactorRequired?: boolean | undefined;
ipWhitelist?: string[] | undefined;
} | undefined;
currency?: string | undefined;
timezone?: string | undefined;
locale?: string | undefined;
dateFormat?: string | undefined;
timeFormat?: string | undefined;
theme?: {
primaryColor?: string | undefined;
secondaryColor?: string | undefined;
logo?: string | undefined;
favicon?: string | undefined;
} | undefined;
notifications?: {
push?: boolean | undefined;
sms?: boolean | undefined;
email?: boolean | undefined;
webhook?: boolean | undefined;
} | undefined;
} | undefined;
} | undefined;
}>;
validateUpdateTenant: (data: unknown) => ValidationResult<{
type?: import("..").TenantType | undefined;
status?: import("..").TenantStatus | undefined;
name?: string | undefined;
slug?: string | undefined;
domain?: string | undefined;
config?: {
features?: {
multiTenancy?: boolean | undefined;
sso?: boolean | undefined;
auditLogging?: boolean | undefined;
backup?: boolean | undefined;
customBranding?: boolean | undefined;
apiAccess?: boolean | undefined;
webhookSupport?: boolean | undefined;
advancedAnalytics?: boolean | undefined;
} | undefined;
limits?: {
maxUsers?: number | undefined;
maxStorage?: number | undefined;
maxApiCalls?: number | undefined;
maxBackups?: number | undefined;
maxCustomDomains?: number | undefined;
} | undefined;
settings?: {
security?: {
passwordPolicy?: {
minLength?: number | undefined;
requireUppercase?: boolean | undefined;
requireLowercase?: boolean | undefined;
requireNumbers?: boolean | undefined;
requireSpecialChars?: boolean | undefined;
maxAge?: number | undefined;
} | undefined;
sessionTimeout?: number | undefined;
maxLoginAttempts?: number | undefined;
twoFactorRequired?: boolean | undefined;
ipWhitelist?: string[] | undefined;
} | undefined;
currency?: string | undefined;
timezone?: string | undefined;
locale?: string | undefined;
dateFormat?: string | undefined;
timeFormat?: string | undefined;
theme?: {
primaryColor?: string | undefined;
secondaryColor?: string | undefined;
logo?: string | undefined;
favicon?: string | undefined;
} | undefined;
notifications?: {
push?: boolean | undefined;
sms?: boolean | undefined;
email?: boolean | undefined;
webhook?: boolean | undefined;
} | undefined;
} | undefined;
} | undefined;
contact?: {
email: string;
phone?: string | undefined;
address?: {
street: string;
city: string;
country: string;
state: string;
postalCode: string;
} | undefined;
} | undefined;
billing?: {
paymentMethod?: {
type: "paypal" | "credit_card" | "bank_transfer";
token?: string | undefined;
} | undefined;
plan?: "basic" | "professional" | "enterprise" | "free" | undefined;
billingCycle?: "monthly" | "quarterly" | "annually" | undefined;
} | undefined;
}>;
validateActivateTenant: (data: unknown) => ValidationResult<{
activationCode: string;
adminUser: {
email: string;
firstName: string;
lastName: string;
password: string;
};
}>;
validateTenant: (data: unknown) => ValidationResult<{
type: import("..").TenantType;
id: string;
createdAt: Date;
updatedAt: Date;
status: import("..").TenantStatus;
name: string;
slug: string;
domain: {
value: string;
createdAt: Date;
isVerified: boolean;
verifiedAt?: Date | undefined;
sslCertificate?: {
issuer: string;
validFrom: Date;
validTo: Date;
serialNumber: string;
} | undefined;
};
config: {
id: string;
createdAt: Date;
updatedAt: Date;
features: {
multiTenancy: boolean;
sso: boolean;
auditLogging: boolean;
backup: boolean;
customBranding: boolean;
apiAccess: boolean;
webhookSupport: boolean;
advancedAnalytics: boolean;
};
limits: {
maxUsers: number;
maxStorage: number;
maxApiCalls: number;
maxBackups: number;
maxCustomDomains: number;
};
settings: {
security: {
passwordPolicy: {
minLength: number;
requireUppercase: boolean;
requireLowercase: boolean;
requireNumbers: boolean;
requireSpecialChars: boolean;
maxAge: number;
};
sessionTimeout: number;
maxLoginAttempts: number;
twoFactorRequired: boolean;
ipWhitelist?: string[] | undefined;
};
currency: string;
timezone: string;
locale: string;
dateFormat: string;
timeFormat: string;
notifications: {
push: boolean;
sms: boolean;
email: boolean;
webhook: boolean;
};
theme?: {
primaryColor: string;
secondaryColor: string;
logo?: string | undefined;
favicon?: string | undefined;
} | undefined;
integrations?: Record<string, {
enabled: boolean;
settings?: Record<string, unknown> | undefined;
apiKey?: string | undefined;
webhookUrl?: string | undefined;
}> | undefined;
};
createdBy?: string | undefined;
updatedBy?: string | undefined;
};
contact: {
email: string;
phone?: string | undefined;
address?: {
street: string;
city: string;
country: string;
state: string;
postalCode: string;
} | undefined;
};
billing: {
plan: "basic" | "professional" | "enterprise" | "free";
currency: string;
billingCycle: "monthly" | "quarterly" | "annually";
nextBillingDate: Date;
totalAmount: number;
paymentMethod?: {
type: "paypal" | "credit_card" | "bank_transfer";
last4?: string | undefined;
expiryDate?: string | undefined;
} | undefined;
lastBillingDate?: Date | undefined;
invoices?: {
id: string;
status: "pending" | "cancelled" | "paid" | "overdue";
amount: number;
currency: string;
dueDate: Date;
paidAt?: Date | undefined;
}[] | undefined;
};
subscription: {
startDate: Date;
isActive: boolean;
autoRenew: boolean;
endDate?: Date | undefined;
trialEndsAt?: Date | undefined;
cancelledAt?: Date | undefined;
};
usage: {
activeUsers: number;
storageUsed: number;
apiCallsThisMonth: number;
lastActivityAt?: Date | undefined;
};
createdBy?: string | undefined;
updatedBy?: string | undefined;
deletedAt?: Date | undefined;
}>;
validateTenantResponse: (data: unknown) => ValidationResult<{
type: import("..").TenantType;
id: string;
createdAt: Date;
updatedAt: Date;
status: import("..").TenantStatus;
name: string;
slug: string;
domain: string;
contact: {
email: string;
phone?: string | undefined;
};
billing: {
plan: "basic" | "professional" | "enterprise" | "free";
currency: string;
billingCycle: "monthly" | "quarterly" | "annually";
nextBillingDate: Date;
totalAmount: number;
};
subscription: {
isActive: boolean;
autoRenew: boolean;
trialEndsAt?: Date | undefined;
};
usage: {
activeUsers: number;
storageUsed: number;
apiCallsThisMonth: number;
};
}>;
validateTenantList: (data: unknown) => ValidationResult<{
pagination: {
page: number;
limit: number;
total: number;
totalPages: number;
};
tenants: {
type: import("..").TenantType;
id: string;
createdAt: Date;
updatedAt: Date;
status: import("..").TenantStatus;
name: string;
slug: string;
domain: string;
contact: {
email: string;
phone?: string | undefined;
};
billing: {
plan: "basic" | "professional" | "enterprise" | "free";
currency: string;
billingCycle: "monthly" | "quarterly" | "annually";
nextBillingDate: Date;
totalAmount: number;
};
subscription: {
isActive: boolean;
autoRenew: boolean;
trialEndsAt?: Date | undefined;
};
usage: {
activeUsers: number;
storageUsed: number;
apiCallsThisMonth: number;
};
}[];
}>;
isValidDomainName: (domain: string) => boolean;
isValidSlug: (slug: string) => boolean;
isOverUsageLimit: (usage: any, limits: any) => boolean;
calculateUsagePercentage: (current: number, limit: number) => number;
};
export declare const PatientValidation: {
validateCreatePatient: (data: unknown) => ValidationResult<{
firstName: string;
lastName: string;
dateOfBirth: Date;
gender: import("..").Gender;
insurance?: {
provider: string;
relationship: string;
policyNumber: string;
subscriberName: string;
effectiveDate: Date;
expiryDate?: Date | undefined;
groupNumber?: string | undefined;
copay?: number | undefined;
deductible?: number | undefined;
} | undefined;
tags?: string[] | undefined;
middleName?: string | undefined;
bloodType?: import("..").BloodType | undefined;
height?: number | undefined;
weight?: number | undefined;
emergencyContact?: {
phoneNumber: string;
name: string;
relationship: string;
email?: string | undefined;
address?: {
street: string;
city: string;
country: string;
state: string;
postalCode: string;
} | undefined;
} | undefined;
preferences?: {
language?: string | undefined;
timezone?: string | undefined;
communicationMethod?: "sms" | "email" | "phone" | "mail" | undefined;
appointmentReminders?: boolean | undefined;
marketingConsent?: boolean | undefined;
privacyConsent?: boolean | undefined;
} | undefined;
language?: string | undefined;
education?: string | undefined;
ethnicity?: string | undefined;
nationality?: string | undefined;
occupation?: string | undefined;
maritalStatus?: "single" | "married" | "divorced" | "widowed" | "separated" | undefined;
phoneNumbers?: {
value: string;
type: "mobile" | "emergency" | "home" | "work";
isPrimary?: boolean | undefined;
}[] | undefined;
addresses?: {
type: "home" | "billing" | "work" | "mailing";
street: string;
city: string;
country: string;
state: string;
postalCode: string;
isPrimary?: boolean | undefined;
}[] | undefined;
}>;
validateUpdatePatient: (data: unknown) => ValidationResult<{
insurance?: {
provider: string;
relationship: string;
policyNumber: string;
subscriberName: string;
effectiveDate: Date;
expiryDate?: Date | undefined;
groupNumber?: string | undefined;
copay?: number | undefined;
deductible?: number | undefined;
} | undefined;
status?: import("..").PatientStatus | undefined;
tags?: string[] | undefined;
firstName?: string | undefined;
lastName?: string | undefined;
middleName?: string | undefined;
dateOfBirth?: Date | undefined;
gender?: import("..").Gender | undefined;
bloodType?: import("..").BloodType | undefined;
height?: number | undefined;
weight?: number | undefined;
emergencyContact?: {
phoneNumber: string;
name: string;
relationship: string;
email?: string | undefined;
address?: {
street: string;
city: string;
country: string;
state: string;
postalCode: string;
} | undefined;
} | undefined;
preferences?: {
language?: string | undefined;
timezone?: string | undefined;
communicationMethod?: "sms" | "email" | "phone" | "mail" | undefined;
appointmentReminders?: boolean | undefined;
marketingConsent?: boolean | undefined;
privacyConsent?: boolean | undefined;
} | undefined;
language?: string | undefined;
education?: string | undefined;
ethnicity?: string | undefined;
nationality?: string | undefined;
occupation?: string | undefined;
maritalStatus?: "single" | "married" | "divorced" | "widowed" | "separated" | undefined;
phoneNumbers?: {
value: string;
type: "mobile" | "emergency" | "home" | "work";
isPrimary?: boolean | undefined;
}[] | undefined;
addresses?: {
type: "home" | "billing" | "work" | "mailing";
street: string;
city: string;
country: string;
state: string;
postalCode: string;
isPrimary?: boolean | undefined;
}[] | undefined;
}>;
validateAddMedicalHistory: (data: unknown) => ValidationResult<{
allergies?: {
severity: "moderate" | "mild" | "severe";
allergen: string;
reaction: string;
onsetDate?: Date | undefined;
}[] | undefined;
familyHistory?: {
relationship: string;
condition: string;
notes?: string | undefined;
ageOfOnset?: number | undefined;
isDeceased?: boolean | undefined;
}[] | undefined;
immunizations?: {
date: Date;
vaccine: string;
notes?: string | undefined;
nextDueDate?: Date | undefined;
administeredBy?: string | undefined;
lotNumber?: string | undefined;
}[] | undefined;
socialHistory?: {
notes?: string | undefined;
exercise?: "light" | "none" | "moderate" | "heavy" | undefined;
occupation?: string | undefined;
smoking?: "never" | "former" | "current" | undefined;
alcohol?: "never" | "occasional" | "moderate" | "heavy" | undefined;
drugs?: "never" | "former" | "current" | undefined;
diet?: string | undefined;
livingSituation?: string | undefined;
} | undefined;
medications?: {
name: string;
dosage: string;
frequency: string;
route: "oral" | "intravenous" | "intramuscular" | "subcutaneous" | "topical" | "inhalation";
startDate: Date;
notes?: string | undefined;
endDate?: Date | undefined;
prescribedBy?: string | undefined;
}[] | undefined;
conditions?: {
name: string;
severity: "moderate" | "mild" | "severe";
diagnosisDate: Date;
notes?: string | undefined;
icd10Code?: string | undefined;
diagnosedBy?: string | undefined;
}[] | undefined;
surgeries?: {
procedure: string;
date: Date;
hospital?: string | undefined;
notes?: string | undefined;
surgeon?: string | undefined;
complications?: string | undefined;
}[] | undefined;
}>;
validatePatient: (data: unknown) => ValidationResult<{
id: string;
createdAt: Date;
updatedAt: Date;
status: import("..").PatientStatus;
code: {
value: string;
createdAt: Date;
format: "custom" | "numeric" | "alphanumeric";
sequence: number;
prefix?: string | undefined;
};
profile: {
id: string;
createdAt: Date;
updatedAt: Date;
firstName: string;
lastName: string;
dateOfBirth: Date;
gender: import("..").Gender;
insurance?: {
provider: string;
relationship: string;
policyNumber: string;
subscriberName: string;
effectiveDate: Date;
expiryDate?: Date | undefined;
groupNumber?: string | undefined;
copay?: number | undefined;
deductible?: number | undefined;
} | undefined;
createdBy?: string | undefined;
updatedBy?: string | undefined;
middleName?: string | undefined;
bloodType?: import("..").BloodType | undefined;
height?: number | undefined;
weight?: number | undefined;
bmi?: number | undefined;
emergencyContact?: {
phoneNumber: string;
name: string;
relationship: string;
email?: string | undefined;
address?: {
type: "home" | "billing" | "work" | "mailing";
street: string;
city: string;
country: string;
createdAt: Date;
isVerified: boolean;
state: string;
postalCode: string;
isPrimary: boolean;
verifiedAt?: Date | undefined;
} | undefined;
} | undefined;
preferences?: {
language?: string | undefined;
timezone?: string | undefined;
communicationMethod?: "sms" | "email" | "phone" | "mail" | undefined;
appointmentReminders?: boolean | undefined;
marketingConsent?: boolean | undefined;
privacyConsent?: boolean | undefined;
} | undefined;
language?: string | undefined;
education?: string | undefined;
ethnicity?: string | undefined;
nationality?: string | undefined;
occupation?: string | undefined;
maritalStatus?: "single" | "married" | "divorced" | "widowed" | "separated" | undefined;
};
insurance?: {
createdAt: Date;
provider: string;
isPrimary: boolean;
relationship: string;
policyNumber: string;
subscriberName: string;
effectiveDate: Date;
expiryDate?: Date | undefined;
groupNumber?: string | undefined;
copay?: number | undefined;
deductible?: number | undefined;
}[] | undefined;
createdBy?: string | undefined;
updatedBy?: string | undefined;
tags?: string[] | undefined;
notes?: {
type: "administrative" | "general" | "clinical";
id: string;
createdAt: Date;
updatedAt: Date;
createdBy: string;
content: string;
isPrivate: boolean;
}[] | undefined;
deletedAt?: Date | undefined;
medicalHistory?: {
id: string;
createdAt: Date;
updatedAt: Date;
patientId: string;
createdBy?: string | undefined;
updatedBy?: string | undefined;
allergies?: {
severity: "moderate" | "mild" | "severe";
isActive: boolean;
allergen: string;
reaction: string;
onsetDate?: Date | undefined;
}[] | undefined;
familyHistory?: {
relationship: string;
condition: string;
notes?: string | undefined;
ageOfOnset?: number | undefined;
isDeceased?: boolean | undefined;
}[] | undefined;
immunizations?: {
date: Date;
vaccine: string;
notes?: string | undefined;
nextDueDate?: Date | undefined;
administeredBy?: string | undefined;
lotNumber?: string | undefined;
}[] | undefined;
socialHistory?: {
notes?: string | undefined;
exercise?: "light" | "none" | "moderate" | "heavy" | undefined;
occupation?: string | undefined;
smoking?: "never" | "former" | "current" | undefined;
alcohol?: "never" | "occasional" | "moderate" | "heavy" | undefined;
drugs?: "never" | "former" | "current" | undefined;
diet?: string | undefined;
livingSituation?: string | undefined;
} | undefined;
medications?: {
name: string;
dosage: string;
frequency: string;
route: "oral" | "intravenous" | "intramuscular" | "subcutaneous" | "topical" | "inhalation";
startDate: Date;
isActive: boolean;
notes?: string | undefined;
endDate?: Date | undefined;
prescribedBy?: string | undefined;
}[] | undefined;
conditions?: {
name: string;
severity: "moderate" | "mild" | "severe";
isActive: boolean;
diagnosisDate: Date;
notes?: string | undefined;
icd10Code?: string | undefined;
diagnosedBy?: string | undefined;
}[] | undefined;
surgeries?: {
procedure: string;
date: Date;
hospital?: string | undefined;
notes?: string | undefined;
surgeon?: string | undefined;
complications?: string | undefined;
}[] | undefined;
} | undefined;
phoneNumbers?: {
value: string;
type: "mobile" | "emergency" | "home" | "work";
createdAt: Date;
isVerified: boolean;
isPrimary: boolean;
verifiedAt?: Date | undefined;
}[] | undefined;
addresses?: {
type: "home" | "billing" | "work" | "mailing";
street: string;
city: string;
country: string;
createdAt: Date;
isVerified: boolean;
state: string;
postalCode: string;
isPrimary: boolean;
verifiedAt?: Date | undefined;
}[] | undefined;
emergencyContacts?: {
createdAt: Date;
phoneNumber: {
value: string;
type: "mobile" | "emergency" | "home" | "work";
createdAt: Date;
isVerified: boolean;
isPrimary: boolean;
verifiedAt?: Date | undefined;
};
name: string;
isPrimary: boolean;
relationship: string;
email?: string | undefined;
address?: {
type: "home" | "billing" | "work" | "mailing";
street: string;
city: string;
country: string;
createdAt: Date;
isVerified: boolean;
state: string;
postalCode: string;
isPrimary: boolean;
verifiedAt?: Date | undefined;
} | undefined;
}[] | undefined;
documents?: {
type: "other" | "medical" | "insurance" | "id" | "consent";
id: string;
name: string;
url: string;
size: number;
mimeType: string;
uploadedAt: Date;
uploadedBy?: string | undefined;
}[] | undefined;
}>;
validatePatientResponse: (data: unknown) => ValidationResult<{
id: string;
createdAt: Date;
updatedAt: Date;
status: import("..").PatientStatus;
code: string;
profile: {
firstName: string;
lastName: string;
dateOfBirth: Date;
gender: import("..").Gender;
middleName?: string | undefined;
bloodType?: import("..").BloodType | undefined;
height?: number | undefined;
weight?: number | undefined;
bmi?: number | undefined;
language?: string | undefined;
education?: string | undefined;
ethnicity?: string | undefined;
nationality?: string | undefined;
occupation?: string | undefined;
maritalStatus?: "single" | "married" | "divorced" | "widowed" | "separated" | undefined;
};
insurance?: {
provider: string;
relationship: string;
policyNumber: string;
subscriberName: string;
effectiveDate: Date;
expiryDate?: Date | undefined;
groupNumber?: string | undefined;
} | undefined;
emergencyContact?: {
phoneNumber: string;
name: string;
relationship: string;
email?: string | undefined;
} | undefined;
phoneNumbers?: {
value: string;
type: "mobile" | "emergency" | "home" | "work";
isVerified: boolean;
isPrimary: boolean;
}[] | undefined;
addresses?: {
type: "home" | "billing" | "work" | "mailing";
street: string;
city: string;
country: string;
isVerified: boolean;
state: string;
postalCode: string;
isPrimary: boolean;
}[] | undefined;
}>;
validatePatientList: (data: unknown) => ValidationResult<{
pagination: {
page: number;
limit: number;
total: number;
totalPages: number;
};
patients: {
id: string;
createdAt: Date;
updatedAt: Date;
status: import("..").PatientStatus;
code: string;
profile: {
firstName: string;
lastName: string;
dateOfBirth: Date;
gender: import("..").Gender;
middleName?: string | undefined;
bloodType?: import("..").BloodType | undefined;
height?: number | undefined;
weight?: number | undefined;
bmi?: number | undefined;
language?: string | undefined;
education?: string | undefined;
ethnicity?: string | undefined;
nationality?: string | undefined;
occupation?: string | undefined;
maritalStatus?: "single" | "married" | "divorced" | "widowed" | "separated" | undefined;
};
insurance?: {
provider: string;
relationship: string;
policyNumber: string;
subscriberName: string;
effectiveDate: Date;
expiryDate?: Date | undefined;
groupNumber?: string | undefined;
} | undefined;
emergencyContact?: {
phoneNumber: string;
name: string;
relationship: string;
email?: string | undefined;
} | undefined;
phoneNumbers?: {
value: string;
type: "mobile" | "emergency" | "home" | "work";
isVerified: boolean;
isPrimary: boolean;
}[] | undefined;
addresses?: {
type: "home" | "billing" | "work" | "mailing";
street: string;
city: string;
country: string;
isVerified: boolean;
state: string;
postalCode: string;
isPrimary: boolean;
}[] | undefined;
}[];
}>;
isValidPhoneNumber: (phone: string) => boolean;
calculateAge: (dateOfBirth: Date) => number;
calculateBMI: (height: number, weight: number) => number;
getBMICategory: (bmi: number) => string;
};
export declare const AppointmentValidation: {
validateCreateAppointment: (data: unknown) => ValidationResult<{
type: import("..").AppointmentType;
patientId: string;
startTime: Date;
endTime: Date;
providerId: string;
reason: string;
tags?: string[] | undefined;
notes?: string | undefined;
symptoms?: string[] | undefined;
recurringPattern?: {
frequency: "daily" | "weekly" | "monthly" | "yearly";
interval: number;
endDate?: Date | undefined;
maxOccurrences?: number | undefined;
daysOfWeek?: number[] | undefined;
dayOfMonth?: number | undefined;
monthOfYear?: number | undefined;
} | undefined;
reminders?: {
type: "push" | "sms" | "email" | "phone";
minutesBefore: number;
message?: string | undefined;
}[] | undefined;
isRecurring?: boolean | undefined;
}>;
validateUpdateAppointment: (data: unknown) => ValidationResult<{
type?: import("..").AppointmentType | undefined;
status?: import("..").AppointmentStatus | undefined;
tags?: string[] | undefined;
notes?: string | undefined;
startTime?: Date | undefined;
endTime?: Date | undefined;
symptoms?: string[] | undefined;
diagnosis?: {
severity: "moderate" | "mild" | "severe";
condition: string;
notes?: string | undefined;
icd10Code?: string | undefined;
}[] | undefined;
prescriptions?: {
duration: string;
medication: string;
dosage: string;
frequency: string;
instructions?: string | undefined;
}[] | undefined;
procedures?: {
name: string;
notes?: string | undefined;
description?: string | undefined;
cptCode?: string | undefined;
}[] | undefined;
reason?: string | undefined;
labOrders?: {
testName: string;
labName: string;
loincCode?: string | undefined;
}[] | undefined;
imagingOrders?: {
facility: string;
studyName: string;
modality: "other" | "x-ray" | "ct" | "mri" | "ultrasound" | "mammography";
bodyPart: string;
}[] | undefined;
referrals?: {
specialist: string;
reason: string;
specialty: string;
urgency: "urgent" | "emergency" | "routine";
notes?: string | undefined;
}[] | undefined;
followUp?: {
isRequired: boolean;
type?: import("..").AppointmentType | undefined;
notes?: string | undefined;
reason?: string | undefined;
recommendedDate?: Date | undefined;
} | undefined;
}>;
validateCancelAppointment: (data: unknown) => ValidationResult<{
reason: string;
sendNotification?: boolean | undefined;
}>;
validateRescheduleAppointment: (data: unknown) => ValidationResult<{
newStartTime: Date;
newEndTime: Date;
reason?: string | undefined;
sendNotification?: boolean | undefined;
}>;
validateAppointment: (data: unknown) => ValidationResult<{
type: import("..").AppointmentType;
id: string;
createdAt: Date;
updatedAt: Date;
status: import("..").AppointmentStatus;
patientId: string;
duration: {
value: {
minutes: number;
hours: number;
days: number;
};
createdAt: Date;
isStandard: boolean;
isCustom: boolean;
};
providerId: string;
reason: string;
timeSlot: {
value: {
startTime: Date;
endTime: Date;
};
createdAt: Date;
isAvailable: boolean;
isBooked: boolean;
isBlocked: boolean;
blockReason?: string | undefined;
};
createdBy?: string | undefined;
updatedBy?: string | undefined;
tags?: string[] | undefined;
notes?: string | undefined;
attachments?: {
type: "document" | "image" | "video" | "audio";
id: string;
name: string;
url: string;
size: number;
mimeType: string;
uploadedAt: Date;
uploadedBy: string;
}[] | undefined;
symptoms?: string[] | undefined;
diagnosis?: {
severity: "moderate" | "mild" | "severe";
condition: string;
notes?: string | undefined;
icd10Code?: string | undefined;
}[] | undefined;
prescriptions?: {
duration: string;
medication: string;
dosage: string;
frequency: string;
prescribedBy: string;
prescribedAt: Date;
instructions?: string | undefined;
}[] | undefined;
procedures?: {
name: string;
performedBy: string;
notes?: string | undefined;
description?: string | undefined;
cptCode?: string | undefined;
performedAt?: Date | undefined;
}[] | undefined;
billing?: {
status: "pending" | "billed" | "paid" | "denied" | "appealed";
totalAmount: number;
copay: number;
deductible: number;
insuranceAmount: number;
patientAmount: number;
paidAt?: Date | undefined;
invoiceNumber?: string | undefined;
billedAt?: Date | undefined;
} | undefined;
cancelledAt?: Date | undefined;
labOrders?: {
testName: string;
labName: string;
orderedBy: string;
orderedAt: Date;
loincCode?: string | undefined;
results?: {
value: string;
testName: string;
isAbnormal: boolean;
reportedAt: Date;
notes?: string | undefined;
unit?: string | undefined;
referenceRange?: string | undefined;
}[] | undefined;
}[] | undefined;
imagingOrders?: {
facility: string;
orderedBy: string;
orderedAt: Date;
studyName: string;
modality: "other" | "x-ray" | "ct" | "mri" | "ultrasound" | "mammography";
bodyPart: string;
results?: {
report: string;
reportedAt: Date;
images: string[];
radiologist?: string | undefined;
} | undefined;
}[] | undefined;
referrals?: {
specialist: string;
reason: string;
specialty: string;
urgency: "urgent" | "emergency" | "routine";
referredBy: string;
referredAt: Date;
notes?: string | undefined;
}[] | undefined;
followUp?: {
isRequired: boolean;
type?: import("..").AppointmentType | undefined;
notes?: string | undefined;
reason?: string | undefined;
recommendedDate?: Date | undefined;
} | undefined;
reminders?: {
type: "push" | "sms" | "email" | "phone";
status: "cancelled" | "scheduled" | "sent" | "failed";
scheduledAt: Date;
message?: string | undefined;
sentAt?: Date | undefined;
}[] | undefined;
cancelledBy?: string | undefined;
cancellationReason?: string | undefined;
}>;
validateAppointmentResponse: (data: unknown) => ValidationResult<{
type: import("..").AppointmentType;
id: string;
createdAt: Date;
updatedAt: Date;
status: import("..").AppointmentStatus;
patientId: string;
startTime: Date;
endTime: Date;
providerId: string;
reason: string;
notes?: string | undefined;
symptoms?: string[] | undefined;
diagnosis?: {
severity: "moderate" | "mild" | "severe";
condition: string;
notes?: string | undefined;
icd10Code?: string | undefined;
}[] | undefined;
prescriptions?: {
duration: string;
medication: string;
dosage: string;
frequency: string;
instructions?: string | undefined;
}[] | undefined;
procedures?: {
name: string;
description?: string | undefined;
cptCode?: string | undefined;
performedAt?: Date | undefined;
}[] | undefined;
billing?: {
status: "pending" | "billed" | "paid" | "denied" | "appealed";
totalAmount: number;
insuranceAmount: number;
patientAmount: number;
} | undefined;
cancelledAt?: Date | undefined;
labOrders?: {
status: "cancelled" | "completed" | "ordered" | "in-progress";
testName: string;
labName: string;
loincCode?: string | undefined;
}[] | undefined;
imagingOrders?: {
status: "cancelled" | "completed" | "ordered" | "in-progress";
facility: string;
studyName: string;
modality: "other" | "x-ray" | "ct" | "mri" | "ultrasound" | "mammography";
bodyPart: string;