emr-types
Version:
Comprehensive TypeScript Types Library for Electronic Medical Record (EMR) Applications - Domain-Driven Design with Zod Validation
133 lines • 3.19 kB
TypeScript
import { Id } from '../../shared/value-objects/Id';
/**
* Branded type for Patient ID to ensure type safety
*/
export type PatientId = Id & {
readonly __brand: 'PatientId';
};
/**
* Factory for creating PatientId instances
*/
export declare const PatientIdFactory: {
/**
* Create a new PatientId with a random UUID
*/
create(): PatientId;
/**
* Create a PatientId from a string value
*/
fromString(value: string): PatientId;
/**
* Create a PatientId from a UUID string
*/
fromUuid(uuid: string): PatientId;
/**
* Create a PatientId from a ULID string
*/
fromUlid(ulid: string): PatientId;
/**
* Create a custom PatientId with specific format
*/
createCustom(value: string, format?: string): PatientId;
};
/**
* Validator for PatientId instances
*/
export declare const PatientIdValidator: {
/**
* Check if a PatientId is valid
*/
isValid(id: PatientId): boolean;
/**
* Validate the format of a PatientId string
*/
validateFormat(value: string): boolean;
/**
* Check if a PatientId is empty
*/
isEmpty(id: PatientId): boolean;
/**
* Compare two PatientId instances for equality
*/
areEqual(id1: PatientId, id2: PatientId): boolean;
};
/**
* Utility functions for PatientId
*/
export declare const PatientIdUtils: {
/**
* Convert PatientId to string
*/
toString(id: PatientId): string;
/**
* Get the type of PatientId
*/
getType(id: PatientId): string;
/**
* Check if PatientId is a UUID
*/
isUuid(id: PatientId): boolean;
/**
* Check if PatientId is a ULID
*/
isUlid(id: PatientId): boolean;
/**
* Check if PatientId is a custom ID
*/
isCustom(id: PatientId): boolean;
/**
* Check if PatientId is an auto-increment ID
*/
isAutoIncrement(id: PatientId): boolean;
};
/**
* Type guard to check if a value is a PatientId
*/
export declare function isPatientId(value: unknown): value is PatientId;
/**
* Type guard to check if a string can be converted to a PatientId
*/
export declare function isValidPatientIdString(value: string): boolean;
/**
* Common PatientId formats
*/
export declare const PATIENT_ID_FORMATS: {
readonly UUID: "uuid";
readonly ULID: "ulid";
readonly CUSTOM: "custom";
readonly AUTO_INCREMENT: "auto_increment";
};
/**
* Default PatientId format
*/
export declare const DEFAULT_PATIENT_ID_FORMAT: "uuid";
/**
* Example usage of PatientId
*/
export declare const PatientIdExamples: {
/**
* Create a new PatientId
*/
createNew: () => PatientId;
/**
* Create from UUID string
*/
fromUuid: (uuid: string) => PatientId;
/**
* Create from ULID string
*/
fromUlid: (ulid: string) => PatientId;
/**
* Create custom PatientId
*/
createCustom: (value: string, format?: string) => PatientId;
/**
* Validate PatientId
*/
validate: (id: PatientId) => boolean;
/**
* Convert to string
*/
toString: (id: PatientId) => string;
};
//# sourceMappingURL=PatientId.d.ts.map