// Reference Range Management Functions export const signOptions = [ { value: 'GE', label: '≥', description: 'Greater than or equal to' }, { value: 'GT', label: '>', description: 'Greater than' }, { value: 'LE', label: '≤', description: 'Less than or equal to' }, { value: 'LT', label: '<', description: 'Less than' } ]; export const flagOptions = [ { value: 'N', label: 'N', description: 'Normal' }, { value: 'L', label: 'L', description: 'Low' }, { value: 'H', label: 'H', description: 'High' }, { value: 'C', label: 'C', description: 'Critical' } ]; export const sexOptions = [ { value: '2', label: 'Male' }, { value: '1', label: 'Female' }, { value: '0', label: 'Any' } ]; export function createNumRef() { return { Sex: '2', LowSign: 'GE', HighSign: 'LE', Low: null, High: null, AgeStart: 0, AgeEnd: 120, Flag: 'N', Interpretation: 'Normal', SpcType: '', Criteria: '' }; } export function createTholdRef() { return { Sex: '2', LowSign: 'GE', HighSign: 'LE', Low: null, High: null, AgeStart: 0, AgeEnd: 120, Flag: 'N', Interpretation: 'Normal', SpcType: '', Criteria: '' }; } export function createTextRef() { return { Sex: '2', AgeStart: 0, AgeEnd: 120, RefTxt: '', Flag: 'N', SpcType: '', Criteria: '' }; } export function createVsetRef() { return { Sex: '2', AgeStart: 0, AgeEnd: 120, RefTxt: '', Flag: 'N', SpcType: '', Criteria: '' }; } export function validateNumericRange(ref, index) { const errors = []; if (ref.Low !== null && ref.High !== null && ref.Low > ref.High) { errors.push(`Range ${index + 1}: Low value cannot be greater than High value`); } if (ref.AgeStart !== null && ref.AgeEnd !== null && ref.AgeStart > ref.AgeEnd) { errors.push(`Range ${index + 1}: Age start cannot be greater than Age end`); } return errors; } export function validateTholdRange(ref, index) { const errors = []; if (ref.Low !== null && ref.High !== null && ref.Low > ref.High) { errors.push(`Range ${index + 1}: Low value cannot be greater than High value`); } if (ref.AgeStart !== null && ref.AgeEnd !== null && ref.AgeStart > ref.AgeEnd) { errors.push(`Range ${index + 1}: Age start cannot be greater than Age end`); } return errors; } export function validateTextRange(ref, index) { const errors = []; if (ref.AgeStart !== null && ref.AgeEnd !== null && ref.AgeStart > ref.AgeEnd) { errors.push(`Range ${index + 1}: Age start cannot be greater than Age end`); } return errors; } export function validateVsetRange(ref, index) { const errors = []; if (ref.AgeStart !== null && ref.AgeEnd !== null && ref.AgeStart > ref.AgeEnd) { errors.push(`Range ${index + 1}: Age start cannot be greater than Age end`); } return errors; }