2026-02-18 07:12:58 +07:00
|
|
|
// 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' }
|
|
|
|
|
];
|
|
|
|
|
|
2026-02-19 16:30:41 +07:00
|
|
|
export const refTypeOptions = [
|
|
|
|
|
{ value: 'REF', label: 'REF', description: 'Reference Range' },
|
|
|
|
|
{ value: 'CRTC', label: 'CRTC', description: 'Critical Range' },
|
|
|
|
|
{ value: 'VAL', label: 'VAL', description: 'Validation Range' },
|
|
|
|
|
{ value: 'RERUN', label: 'RERUN', description: 'Rerun Range' },
|
|
|
|
|
{ value: 'THOLD', label: 'THOLD', description: 'Threshold Range' }
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export const textRefTypeOptions = [
|
|
|
|
|
{ value: 'TEXT', label: 'TEXT', description: 'Text Reference' },
|
|
|
|
|
{ value: 'VSET', label: 'VSET', description: 'Value Set Reference' }
|
|
|
|
|
];
|
|
|
|
|
|
2026-02-18 07:12:58 +07:00
|
|
|
export const sexOptions = [
|
|
|
|
|
{ value: '2', label: 'Male' },
|
|
|
|
|
{ value: '1', label: 'Female' },
|
|
|
|
|
{ value: '0', label: 'Any' }
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export function createNumRef() {
|
|
|
|
|
return {
|
2026-02-19 16:30:41 +07:00
|
|
|
RefType: 'REF',
|
|
|
|
|
Sex: '0',
|
2026-02-18 07:12:58 +07:00
|
|
|
LowSign: 'GE',
|
|
|
|
|
HighSign: 'LE',
|
|
|
|
|
Low: null,
|
|
|
|
|
High: null,
|
|
|
|
|
AgeStart: 0,
|
|
|
|
|
AgeEnd: 120,
|
|
|
|
|
Flag: 'N',
|
2026-02-19 16:30:41 +07:00
|
|
|
Interpretation: '',
|
refactor(tests): Move TestModal to route folder and add technical config support
- Move TestModal from lib/components to routes/(app)/master-data/tests
- Add technical configuration form (ResultType, RefType, SpcType, units, etc.)
- Add GroupMembersTab for managing group test members
- Enhance reference ranges with refvset and refthold support
- Update API to handle new test fields (ReqQty, Factor, Decimal, TAT, etc.)
- Add database schema documentation (DBML format)
- Remove old test-types-reference.md documentation
- UI improvements: compact design, updated sidebar, modal sizing
- Update DataTable, Modal, SelectDropdown components for compact style
- Enhance patient and visit modals with compact layout
2026-02-18 16:31:20 +07:00
|
|
|
SpcType: '',
|
|
|
|
|
Criteria: ''
|
2026-02-18 07:12:58 +07:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createTholdRef() {
|
|
|
|
|
return {
|
2026-02-19 16:30:41 +07:00
|
|
|
RefType: 'THOLD',
|
|
|
|
|
Sex: '0',
|
2026-02-18 07:12:58 +07:00
|
|
|
LowSign: 'GE',
|
|
|
|
|
HighSign: 'LE',
|
|
|
|
|
Low: null,
|
|
|
|
|
High: null,
|
|
|
|
|
AgeStart: 0,
|
|
|
|
|
AgeEnd: 120,
|
|
|
|
|
Flag: 'N',
|
2026-02-19 16:30:41 +07:00
|
|
|
Interpretation: '',
|
refactor(tests): Move TestModal to route folder and add technical config support
- Move TestModal from lib/components to routes/(app)/master-data/tests
- Add technical configuration form (ResultType, RefType, SpcType, units, etc.)
- Add GroupMembersTab for managing group test members
- Enhance reference ranges with refvset and refthold support
- Update API to handle new test fields (ReqQty, Factor, Decimal, TAT, etc.)
- Add database schema documentation (DBML format)
- Remove old test-types-reference.md documentation
- UI improvements: compact design, updated sidebar, modal sizing
- Update DataTable, Modal, SelectDropdown components for compact style
- Enhance patient and visit modals with compact layout
2026-02-18 16:31:20 +07:00
|
|
|
SpcType: '',
|
|
|
|
|
Criteria: ''
|
2026-02-18 07:12:58 +07:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createTextRef() {
|
|
|
|
|
return {
|
2026-02-19 16:30:41 +07:00
|
|
|
RefType: 'TEXT',
|
|
|
|
|
Sex: '0',
|
2026-02-18 07:12:58 +07:00
|
|
|
AgeStart: 0,
|
|
|
|
|
AgeEnd: 120,
|
|
|
|
|
RefTxt: '',
|
refactor(tests): Move TestModal to route folder and add technical config support
- Move TestModal from lib/components to routes/(app)/master-data/tests
- Add technical configuration form (ResultType, RefType, SpcType, units, etc.)
- Add GroupMembersTab for managing group test members
- Enhance reference ranges with refvset and refthold support
- Update API to handle new test fields (ReqQty, Factor, Decimal, TAT, etc.)
- Add database schema documentation (DBML format)
- Remove old test-types-reference.md documentation
- UI improvements: compact design, updated sidebar, modal sizing
- Update DataTable, Modal, SelectDropdown components for compact style
- Enhance patient and visit modals with compact layout
2026-02-18 16:31:20 +07:00
|
|
|
Flag: 'N',
|
|
|
|
|
SpcType: '',
|
|
|
|
|
Criteria: ''
|
2026-02-18 07:12:58 +07:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createVsetRef() {
|
|
|
|
|
return {
|
2026-02-19 16:30:41 +07:00
|
|
|
RefType: 'VSET',
|
|
|
|
|
Sex: '0',
|
2026-02-18 07:12:58 +07:00
|
|
|
AgeStart: 0,
|
|
|
|
|
AgeEnd: 120,
|
refactor(tests): Move TestModal to route folder and add technical config support
- Move TestModal from lib/components to routes/(app)/master-data/tests
- Add technical configuration form (ResultType, RefType, SpcType, units, etc.)
- Add GroupMembersTab for managing group test members
- Enhance reference ranges with refvset and refthold support
- Update API to handle new test fields (ReqQty, Factor, Decimal, TAT, etc.)
- Add database schema documentation (DBML format)
- Remove old test-types-reference.md documentation
- UI improvements: compact design, updated sidebar, modal sizing
- Update DataTable, Modal, SelectDropdown components for compact style
- Enhance patient and visit modals with compact layout
2026-02-18 16:31:20 +07:00
|
|
|
RefTxt: '',
|
|
|
|
|
Flag: 'N',
|
|
|
|
|
SpcType: '',
|
|
|
|
|
Criteria: ''
|
2026-02-18 07:12:58 +07:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-19 16:30:41 +07:00
|
|
|
// Alias for threshold validation (same logic)
|
|
|
|
|
export const validateTholdRange = validateNumericRange;
|
2026-02-18 07:12:58 +07:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-19 16:30:41 +07:00
|
|
|
// Alias for value set validation (same logic)
|
|
|
|
|
export const validateVsetRange = validateTextRange;
|