@blackcode_sa/metaestetics-api 1.14.78 → 1.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/index.d.mts +5 -0
- package/dist/admin/index.d.ts +5 -0
- package/dist/admin/index.js +47 -5
- package/dist/admin/index.mjs +47 -5
- package/dist/index.d.mts +302 -1
- package/dist/index.d.ts +302 -1
- package/dist/index.js +2655 -1754
- package/dist/index.mjs +1880 -983
- package/package.json +1 -1
- package/src/admin/aggregation/appointment/appointment.aggregation.service.ts +59 -6
- package/src/services/__tests__/auth/auth.mock.test.ts +2 -2
- package/src/services/__tests__/auth/auth.setup.ts +6 -1
- package/src/services/__tests__/auth.service.test.ts +8 -44
- package/src/services/__tests__/base.service.test.ts +4 -45
- package/src/services/__tests__/user.service.test.ts +6 -4
- package/src/services/appointment/utils/appointment.utils.ts +0 -3
- package/src/services/appointment/utils/extended-procedure.utils.ts +1 -0
- package/src/services/auth/auth.v2.service.ts +7 -7
- package/src/services/clinic/__tests__/clinic-admin.service.test.ts +11 -33
- package/src/services/clinic/__tests__/clinic-group.service.test.ts +21 -151
- package/src/services/clinic/__tests__/clinic.service.test.ts +17 -69
- package/src/services/clinic/utils/clinic-group.utils.ts +2 -2
- package/src/services/clinic/utils/clinic.utils.ts +28 -22
- package/src/services/clinic/utils/index.ts +0 -1
- package/src/services/notifications/__tests__/notification.service.test.ts +5 -5
- package/src/services/patient/__tests__/patient.service.test.ts +17 -25
- package/src/services/patient/patient.service.ts +136 -0
- package/src/services/patient/utils/body-assessment.utils.ts +159 -0
- package/src/services/patient/utils/docs.utils.ts +1 -1
- package/src/services/patient/utils/hair-scalp-assessment.utils.ts +158 -0
- package/src/services/patient/utils/pre-surgical-assessment.utils.ts +161 -0
- package/src/services/patient/utils/skin-quality-assessment.utils.ts +160 -0
- package/src/services/user/user.v2.service.ts +4 -3
- package/src/types/patient/body-assessment.types.ts +93 -0
- package/src/types/patient/hair-scalp-assessment.types.ts +98 -0
- package/src/types/patient/index.ts +4 -0
- package/src/types/patient/pre-surgical-assessment.types.ts +95 -0
- package/src/types/patient/skin-quality-assessment.types.ts +105 -0
- package/src/validations/patient/body-assessment.schema.ts +82 -0
- package/src/validations/patient/hair-scalp-assessment.schema.ts +70 -0
- package/src/validations/patient/pre-surgical-assessment.schema.ts +78 -0
- package/src/validations/patient/skin-quality-assessment.schema.ts +70 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const hairLossPatternSchema = z.object({
|
|
4
|
+
type: z.enum(['androgenetic', 'diffuse', 'areata', 'traction', 'scarring', 'telogen_effluvium']),
|
|
5
|
+
norwoodStage: z.enum(['I', 'II', 'IIa', 'III', 'IIIa', 'III_vertex', 'IV', 'IVa', 'V', 'Va', 'VI', 'VII']).optional(),
|
|
6
|
+
ludwigStage: z.enum(['I', 'II', 'III']).optional(),
|
|
7
|
+
onsetDuration: z.string().optional(),
|
|
8
|
+
familyHistory: z.boolean().optional(),
|
|
9
|
+
notes: z.string().optional(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const hairCharacteristicsSchema = z.object({
|
|
13
|
+
type: z.enum(['straight', 'wavy', 'curly', 'coily']),
|
|
14
|
+
density: z.enum(['high', 'medium', 'low', 'very_low']),
|
|
15
|
+
color: z.enum(['black', 'dark_brown', 'brown', 'light_brown', 'blonde', 'red', 'grey', 'white']),
|
|
16
|
+
texture: z.enum(['fine', 'medium', 'coarse']),
|
|
17
|
+
diameter: z.enum(['thin', 'medium', 'thick']).optional(),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const scalpConditionSchema = z.object({
|
|
21
|
+
scaliness: z.enum(['none', 'mild', 'moderate', 'severe']),
|
|
22
|
+
redness: z.enum(['none', 'mild', 'moderate', 'severe']),
|
|
23
|
+
sebum: z.enum(['dry', 'normal', 'oily', 'very_oily']),
|
|
24
|
+
folliculitis: z.boolean(),
|
|
25
|
+
scarring: z.boolean(),
|
|
26
|
+
notes: z.string().optional(),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const hairLossZoneAssessmentSchema = z.object({
|
|
30
|
+
zone: z.enum([
|
|
31
|
+
'frontal', 'temporal_left', 'temporal_right', 'mid_scalp',
|
|
32
|
+
'vertex', 'occipital', 'parietal_left', 'parietal_right',
|
|
33
|
+
]),
|
|
34
|
+
miniaturization: z.enum(['none', 'mild', 'moderate', 'severe']),
|
|
35
|
+
density: z.enum(['high', 'medium', 'low', 'very_low']),
|
|
36
|
+
notes: z.string().optional(),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const createHairScalpAssessmentSchema = z.object({
|
|
40
|
+
patientId: z.string().min(1, 'Patient ID is required'),
|
|
41
|
+
appointmentId: z.string().optional(),
|
|
42
|
+
hairLossPattern: hairLossPatternSchema.optional(),
|
|
43
|
+
hairCharacteristics: hairCharacteristicsSchema.optional(),
|
|
44
|
+
scalpCondition: scalpConditionSchema.optional(),
|
|
45
|
+
zoneAssessments: z.array(hairLossZoneAssessmentSchema).optional(),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const updateHairScalpAssessmentSchema = z.object({
|
|
49
|
+
appointmentId: z.string().optional(),
|
|
50
|
+
hairLossPattern: hairLossPatternSchema.optional(),
|
|
51
|
+
hairCharacteristics: hairCharacteristicsSchema.optional(),
|
|
52
|
+
scalpCondition: scalpConditionSchema.optional(),
|
|
53
|
+
zoneAssessments: z.array(hairLossZoneAssessmentSchema).optional(),
|
|
54
|
+
}).partial();
|
|
55
|
+
|
|
56
|
+
export const hairScalpAssessmentSchema = z.object({
|
|
57
|
+
id: z.string(),
|
|
58
|
+
patientId: z.string(),
|
|
59
|
+
appointmentId: z.string().optional(),
|
|
60
|
+
hairLossPattern: hairLossPatternSchema.optional(),
|
|
61
|
+
hairCharacteristics: hairCharacteristicsSchema.optional(),
|
|
62
|
+
scalpCondition: scalpConditionSchema.optional(),
|
|
63
|
+
zoneAssessments: z.array(hairLossZoneAssessmentSchema),
|
|
64
|
+
completionPercentage: z.number().min(0).max(100),
|
|
65
|
+
status: z.enum(['incomplete', 'ready_for_planning', 'treatment_planned']),
|
|
66
|
+
lastUpdatedBy: z.string(),
|
|
67
|
+
lastUpdatedByRole: z.enum(['PATIENT', 'PRACTITIONER']),
|
|
68
|
+
createdAt: z.any(),
|
|
69
|
+
updatedAt: z.any(),
|
|
70
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const anesthesiaHistorySchema = z.object({
|
|
4
|
+
previousAnesthesia: z.boolean(),
|
|
5
|
+
adverseReactions: z.boolean().optional(),
|
|
6
|
+
reactionDetails: z.string().optional(),
|
|
7
|
+
preferredType: z.enum(['local', 'regional', 'general', 'sedation']).optional(),
|
|
8
|
+
malignantHyperthermiaRisk: z.boolean().optional(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const bleedingRiskSchema = z.object({
|
|
12
|
+
level: z.enum(['low', 'moderate', 'high']),
|
|
13
|
+
anticoagulantUse: z.boolean(),
|
|
14
|
+
anticoagulantDetails: z.string().optional(),
|
|
15
|
+
bleedingDisorderHistory: z.boolean(),
|
|
16
|
+
bleedingDisorderDetails: z.string().optional(),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const surgicalSiteAssessmentSchema = z.object({
|
|
20
|
+
site: z.string().min(1),
|
|
21
|
+
skinQuality: z.enum(['excellent', 'good', 'fair', 'poor']),
|
|
22
|
+
scarringHistory: z.enum(['none', 'normal', 'hypertrophic', 'keloid']),
|
|
23
|
+
tissueQuality: z.enum(['excellent', 'good', 'fair', 'poor']),
|
|
24
|
+
previousSurgery: z.boolean(),
|
|
25
|
+
previousSurgeryDetails: z.string().optional(),
|
|
26
|
+
notes: z.string().optional(),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const labResultSchema = z.object({
|
|
30
|
+
name: z.string().min(1),
|
|
31
|
+
value: z.string().min(1),
|
|
32
|
+
unit: z.string().optional(),
|
|
33
|
+
date: z.string().optional(),
|
|
34
|
+
isNormal: z.boolean().optional(),
|
|
35
|
+
notes: z.string().optional(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const createPreSurgicalAssessmentSchema = z.object({
|
|
39
|
+
patientId: z.string().min(1, 'Patient ID is required'),
|
|
40
|
+
appointmentId: z.string().optional(),
|
|
41
|
+
asaClassification: z.enum(['I', 'II', 'III', 'IV']).optional(),
|
|
42
|
+
anesthesiaHistory: anesthesiaHistorySchema.optional(),
|
|
43
|
+
bleedingRisk: bleedingRiskSchema.optional(),
|
|
44
|
+
surgicalSiteAssessments: z.array(surgicalSiteAssessmentSchema).optional(),
|
|
45
|
+
labResults: z.array(labResultSchema).optional(),
|
|
46
|
+
smokingStatus: z.enum(['never', 'former', 'current', 'quit_recently']).optional(),
|
|
47
|
+
clearance: z.enum(['not_required', 'pending', 'obtained', 'denied']).optional(),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export const updatePreSurgicalAssessmentSchema = z.object({
|
|
51
|
+
appointmentId: z.string().optional(),
|
|
52
|
+
asaClassification: z.enum(['I', 'II', 'III', 'IV']).optional(),
|
|
53
|
+
anesthesiaHistory: anesthesiaHistorySchema.optional(),
|
|
54
|
+
bleedingRisk: bleedingRiskSchema.optional(),
|
|
55
|
+
surgicalSiteAssessments: z.array(surgicalSiteAssessmentSchema).optional(),
|
|
56
|
+
labResults: z.array(labResultSchema).optional(),
|
|
57
|
+
smokingStatus: z.enum(['never', 'former', 'current', 'quit_recently']).optional(),
|
|
58
|
+
clearance: z.enum(['not_required', 'pending', 'obtained', 'denied']).optional(),
|
|
59
|
+
}).partial();
|
|
60
|
+
|
|
61
|
+
export const preSurgicalAssessmentSchema = z.object({
|
|
62
|
+
id: z.string(),
|
|
63
|
+
patientId: z.string(),
|
|
64
|
+
appointmentId: z.string().optional(),
|
|
65
|
+
asaClassification: z.enum(['I', 'II', 'III', 'IV']).optional(),
|
|
66
|
+
anesthesiaHistory: anesthesiaHistorySchema.optional(),
|
|
67
|
+
bleedingRisk: bleedingRiskSchema.optional(),
|
|
68
|
+
surgicalSiteAssessments: z.array(surgicalSiteAssessmentSchema),
|
|
69
|
+
labResults: z.array(labResultSchema),
|
|
70
|
+
smokingStatus: z.enum(['never', 'former', 'current', 'quit_recently']).optional(),
|
|
71
|
+
clearance: z.enum(['not_required', 'pending', 'obtained', 'denied']),
|
|
72
|
+
completionPercentage: z.number().min(0).max(100),
|
|
73
|
+
status: z.enum(['incomplete', 'ready_for_planning', 'treatment_planned']),
|
|
74
|
+
lastUpdatedBy: z.string(),
|
|
75
|
+
lastUpdatedByRole: z.enum(['PATIENT', 'PRACTITIONER']),
|
|
76
|
+
createdAt: z.any(),
|
|
77
|
+
updatedAt: z.any(),
|
|
78
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const skinCharacteristicsSchema = z.object({
|
|
4
|
+
hydration: z.enum(['very_dry', 'dry', 'normal', 'oily', 'very_oily']),
|
|
5
|
+
oiliness: z.enum(['very_dry', 'dry', 'normal', 'oily', 'very_oily']),
|
|
6
|
+
sensitivity: z.enum(['none', 'mild', 'moderate', 'severe']),
|
|
7
|
+
elasticity: z.enum(['excellent', 'good', 'fair', 'poor']),
|
|
8
|
+
poreSize: z.enum(['fine', 'small', 'medium', 'large', 'very_large']),
|
|
9
|
+
texture: z.enum(['smooth', 'slightly_rough', 'rough', 'very_rough']),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const skinConditionEntrySchema = z.object({
|
|
13
|
+
type: z.enum([
|
|
14
|
+
'acne', 'rosacea', 'melasma', 'hyperpigmentation', 'hypopigmentation',
|
|
15
|
+
'eczema', 'psoriasis', 'sun_damage', 'scarring', 'keratosis',
|
|
16
|
+
]),
|
|
17
|
+
severity: z.string().min(1),
|
|
18
|
+
location: z.string().optional(),
|
|
19
|
+
notes: z.string().optional(),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const skinZoneAssessmentSchema = z.object({
|
|
23
|
+
zone: z.enum([
|
|
24
|
+
'forehead', 'periorbital', 'cheeks', 'nose', 'perioral', 'chin', 'neck', 'decolletage',
|
|
25
|
+
]),
|
|
26
|
+
pigmentation: z.string().min(1),
|
|
27
|
+
texture: z.string().min(1),
|
|
28
|
+
vascularity: z.string().min(1),
|
|
29
|
+
photoaging: z.string().min(1),
|
|
30
|
+
notes: z.string().optional(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const skinQualityScalesSchema = z.object({
|
|
34
|
+
fitzpatrick: z.enum(['I', 'II', 'III', 'IV', 'V', 'VI']).optional(),
|
|
35
|
+
glogau: z.enum(['I', 'II', 'III', 'IV']).optional(),
|
|
36
|
+
elastosis: z.enum(['none', 'mild', 'moderate', 'severe']).optional(),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const createSkinQualityAssessmentSchema = z.object({
|
|
40
|
+
patientId: z.string().min(1, 'Patient ID is required'),
|
|
41
|
+
appointmentId: z.string().optional(),
|
|
42
|
+
characteristics: skinCharacteristicsSchema.optional(),
|
|
43
|
+
conditions: z.array(skinConditionEntrySchema).optional(),
|
|
44
|
+
zoneAssessments: z.array(skinZoneAssessmentSchema).optional(),
|
|
45
|
+
scales: skinQualityScalesSchema.optional(),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const updateSkinQualityAssessmentSchema = z.object({
|
|
49
|
+
appointmentId: z.string().optional(),
|
|
50
|
+
characteristics: skinCharacteristicsSchema.optional(),
|
|
51
|
+
conditions: z.array(skinConditionEntrySchema).optional(),
|
|
52
|
+
zoneAssessments: z.array(skinZoneAssessmentSchema).optional(),
|
|
53
|
+
scales: skinQualityScalesSchema.optional(),
|
|
54
|
+
}).partial();
|
|
55
|
+
|
|
56
|
+
export const skinQualityAssessmentSchema = z.object({
|
|
57
|
+
id: z.string(),
|
|
58
|
+
patientId: z.string(),
|
|
59
|
+
appointmentId: z.string().optional(),
|
|
60
|
+
characteristics: skinCharacteristicsSchema.optional(),
|
|
61
|
+
conditions: z.array(skinConditionEntrySchema),
|
|
62
|
+
zoneAssessments: z.array(skinZoneAssessmentSchema),
|
|
63
|
+
scales: skinQualityScalesSchema,
|
|
64
|
+
completionPercentage: z.number().min(0).max(100),
|
|
65
|
+
status: z.enum(['incomplete', 'ready_for_planning', 'treatment_planned']),
|
|
66
|
+
lastUpdatedBy: z.string(),
|
|
67
|
+
lastUpdatedByRole: z.enum(['PATIENT', 'PRACTITIONER']),
|
|
68
|
+
createdAt: z.any(),
|
|
69
|
+
updatedAt: z.any(),
|
|
70
|
+
});
|