UNPKG

@eka-care/patient-ts-sdk

Version:

TypeScript SDK for Trinity Patient Profile Management System

98 lines (97 loc) 2.81 kB
/** * Utility methods for patient profile management */ import { HttpClient } from '../client'; import { ApiResponse, RemoveFieldsData, Patient } from '../types'; /** * Utility methods for patient management */ export declare class UtilsMethods { private client; private readonly basePath; constructor(client: HttpClient); /** * Remove specific fields from a patient profile * * @param id Patient OID * @param fields Array of field names to remove * @returns Success response * * @example * ```typescript * await sdk.utils.removeFields('patient-oid', ['email', 'mobile']); * // or * await sdk.utils.removeFields('patient-oid', { fields: ['email', 'mobile'] }); * ``` */ removeFields(id: string, fields: string[] | RemoveFieldsData): Promise<ApiResponse>; /** * Unarchive a patient profile * * @param id Patient OID * @returns Updated patient profile or success response * * @example * ```typescript * const result = await sdk.utils.unarchive('patient-oid'); * ``` */ unarchive(id: string): Promise<Patient | ApiResponse>; /** * Archive a patient profile (soft delete) * Note: This is typically done via the update method by setting arc: true * * @param id Patient OID * @returns Updated patient profile * * @example * ```typescript * const archivedPatient = await sdk.utils.archive('patient-oid'); * ``` */ archive(id: string): Promise<Patient>; /** * Validate patient data before creation/update * This method performs client-side validation to catch common errors early * * @param data Patient data to validate * @param isUpdate Whether this is for an update operation (less strict validation) * @returns Validation result * * @example * ```typescript * const validation = sdk.utils.validatePatientData({ * gen: 'M', * dob: '1990-01-01', * fn: 'John' * }); * * if (!validation.isValid) { * console.log('Validation errors:', validation.errors); * } * ``` */ validatePatientData(data: any, isUpdate?: boolean): { isValid: boolean; errors: string[]; }; /** * Format patient data for display * * @param patient Patient data * @returns Formatted display data * * @example * ```typescript * const formatted = sdk.utils.formatPatientDisplay(patient); * console.log(`Name: ${formatted.fullName}`); * console.log(`Contact: ${formatted.contact}`); * ``` */ formatPatientDisplay(patient: Patient): { fullName: string; contact: string; age?: number; displayId: string; }; }