@blackcode_sa/metaestetics-api 1.12.31 → 1.12.32

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/index.d.mts CHANGED
@@ -3235,44 +3235,56 @@ interface UpdateMedicationData extends Partial<AddMedicationData> {
3235
3235
  declare const DEFAULT_MEDICAL_INFO: Omit<PatientMedicalInfo, "patientId" | "lastUpdated" | "updatedBy">;
3236
3236
 
3237
3237
  declare const AESTHETIC_ANALYSIS_COLLECTION = "aesthetic-analysis";
3238
- interface ClinicalFinding {
3239
- concernCategory: string;
3240
- concernName: string;
3241
- severityLevel?: string;
3242
- impactLevel?: string;
3243
- clinicalNotes?: string;
3244
- }
3245
- interface AssessmentScale {
3246
- scaleName: string;
3247
- scaleValue: string;
3248
- category: string;
3238
+ type AestheticAnalysisStatus = 'incomplete' | 'ready_for_planning' | 'treatment_planned';
3239
+ interface ClinicalFindingDetail {
3240
+ severity: string;
3241
+ impact: string;
3242
+ notes?: string;
3243
+ }
3244
+ interface ClinicalFindings {
3245
+ [category: string]: {
3246
+ [concern: string]: ClinicalFindingDetail;
3247
+ };
3249
3248
  }
3250
3249
  interface PatientGoals {
3251
- treatmentTimeline?: string;
3252
- budgetRange?: string;
3253
- naturalnessPreference: number;
3254
- selectedGoalTemplate?: string;
3250
+ timeline?: string;
3251
+ budget?: string;
3252
+ naturalness: number;
3255
3253
  priorities: string[];
3254
+ selectedTemplate?: string;
3255
+ }
3256
+ interface AssessmentScales {
3257
+ [scaleName: string]: string;
3256
3258
  }
3257
3259
  interface AestheticAnalysis {
3260
+ id: string;
3258
3261
  patientId: string;
3262
+ appointmentId?: string;
3263
+ selectedConcerns: string[];
3264
+ clinicalFindings: ClinicalFindings;
3265
+ patientGoals: PatientGoals;
3266
+ assessmentScales: AssessmentScales;
3267
+ completionPercentage: number;
3268
+ status: AestheticAnalysisStatus;
3259
3269
  lastUpdatedBy: string;
3260
3270
  lastUpdatedByRole: 'PATIENT' | 'PRACTITIONER';
3261
- patientGoals: PatientGoals;
3262
- clinicalFindings: ClinicalFinding[];
3263
- assessmentScales: AssessmentScale[];
3264
3271
  createdAt?: Timestamp | any;
3265
3272
  updatedAt?: Timestamp | any;
3266
3273
  }
3267
3274
  interface CreateAestheticAnalysisData {
3275
+ patientId: string;
3276
+ appointmentId?: string;
3277
+ selectedConcerns: string[];
3278
+ clinicalFindings: ClinicalFindings;
3268
3279
  patientGoals: PatientGoals;
3269
- clinicalFindings: ClinicalFinding[];
3270
- assessmentScales: AssessmentScale[];
3280
+ assessmentScales?: AssessmentScales;
3271
3281
  }
3272
3282
  interface UpdateAestheticAnalysisData {
3283
+ appointmentId?: string;
3284
+ selectedConcerns?: string[];
3285
+ clinicalFindings?: ClinicalFindings;
3273
3286
  patientGoals?: PatientGoals;
3274
- clinicalFindings?: ClinicalFinding[];
3275
- assessmentScales?: AssessmentScale[];
3287
+ assessmentScales?: AssessmentScales;
3276
3288
  }
3277
3289
 
3278
3290
  declare const PATIENTS_COLLECTION = "patients";
@@ -7010,4 +7022,4 @@ declare const getFirebaseApp: () => Promise<FirebaseApp>;
7010
7022
  declare const getFirebaseStorage: () => Promise<FirebaseStorage>;
7011
7023
  declare const getFirebaseFunctions: () => Promise<Functions>;
7012
7024
 
7013
- export { AESTHETIC_ANALYSIS_COLLECTION, APPOINTMENTS_COLLECTION, type AddAllergyData, type AddBlockingConditionData, type AddContraindicationData, type AddMedicationData, type AddressData, type AdminInfo, type AdminToken, AdminTokenStatus, type AestheticAnalysis, type Allergy, type AllergySubtype, AllergyType, type AllergyTypeWithSubtype, type Appointment, type AppointmentCancelledNotification, type AppointmentMediaItem, type AppointmentMetadata, type AppointmentReminderNotification, type AppointmentRescheduledProposalNotification, AppointmentService, AppointmentStatus, type AppointmentStatusChangeNotification, type AssessmentScale, AuthService, type BaseDocumentElement, type BaseNotification, BaseService, type BeforeAfterPerZone, type BillingInfo, type BillingPerZone, type BillingTransaction, BillingTransactionType, BillingTransactionsService, type BinaryChoiceElement, BlockingCondition, type Brand, BrandService, CALENDAR_COLLECTION, CLINICS_COLLECTION, CLINIC_ADMINS_COLLECTION, CLINIC_GROUPS_COLLECTION, type CalendarEvent, CalendarEventStatus, type CalendarEventTime, CalendarEventType, CalendarServiceV2, CalendarServiceV3, CalendarSyncStatus, type Category, CategoryService, CertificationLevel, CertificationSpecialty, type Clinic, type ClinicAdmin, ClinicAdminService, type ClinicAdminSignupData, type ClinicBranchSetupData, type ClinicContactInfo, type ClinicGroup, ClinicGroupService, type ClinicGroupSetupData, type ClinicInfo, type ClinicLocation, ClinicPhotoTag, type ClinicReview, type ClinicReviewInfo, ClinicService, ClinicTag, type ClinicTags, type ClinicalFinding, ConstantsService, type ContactPerson, Contraindication, type ContraindicationDynamic, CosmeticAllergySubtype, type CreateAdminTokenData, type CreateAestheticAnalysisData, type CreateAppointmentData, type CreateAppointmentHttpData, type CreateAppointmentParams, type CreateBillingTransactionData, type CreateBlockingEventParams, type CreateCalendarEventData, type CreateClinicAdminData, type CreateClinicData, type CreateClinicGroupData, type CreateDefaultClinicGroupData, type CreateDocumentTemplateData, type CreateDraftPractitionerData, type CreateManualPatientData, type CreatePatientLocationInfoData, type CreatePatientMedicalInfoData, type CreatePatientProfileData, type CreatePatientSensitiveInfoData, type CreatePatientTokenData, type CreatePractitionerData, type CreatePractitionerInviteData, type CreatePractitionerTokenData, type CreateProcedureData, type CreateSyncedCalendarData, type CreateUserData, Currency, DEFAULT_MEDICAL_INFO, DOCTOR_FORMS_SUBCOLLECTION, DOCUMENTATION_TEMPLATES_COLLECTION, type DatePickerElement, type DateRange, type DigitalSignatureElement, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, type DynamicTextElement, DynamicVariable, type EmergencyContact, EnvironmentalAllergySubtype, ExternalCalendarService, FILLED_DOCUMENTS_COLLECTION, type FileUploadElement, type FilledDocument, type FilledDocumentFileValue, FilledDocumentService, FilledDocumentStatus, type FinalBilling, type FirebaseUser, FoodAllergySubtype, type FormReminderNotification, type FormSubmissionConfirmationNotification, type GamificationInfo, Gender, type GeneralMessageNotification, type HeadingElement, HeadingLevel, INVITE_TOKENS_COLLECTION, Language, type LinkedFormInfo, type ListElement, ListType, type LocationData, MEDIA_METADATA_COLLECTION, MediaAccessLevel, type MediaMetadata, type MediaResource, MediaService, MediaType, MedicationAllergySubtype, type MultipleChoiceElement, NOTIFICATIONS_COLLECTION, type Notification, NotificationService, NotificationStatus, NotificationType, PATIENTS_COLLECTION, PATIENT_APPOINTMENTS_COLLECTION, PATIENT_LOCATION_INFO_COLLECTION, PATIENT_MEDICAL_HISTORY_COLLECTION, PATIENT_MEDICAL_INFO_COLLECTION, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, PATIENT_SENSITIVE_INFO_COLLECTION, PRACTITIONERS_COLLECTION, PRACTITIONER_INVITES_COLLECTION, PROCEDURES_COLLECTION, type ParagraphElement, type PatientClinic, type PatientDoctor, type PatientGoals, PatientInstructionStatus, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileForDoctor, type PatientProfileInfo, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, type PatientRequirementsFilters, PatientRequirementsService, type PatientReviewInfo, type PatientSensitiveInfo, PatientService, type PatientToken, PatientTokenStatus, type PaymentConfirmationNotification, PaymentStatus, type PlanDetails, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerInvite, type PractitionerInviteFilters, PractitionerInviteService, PractitionerInviteStatus, type PractitionerProfileInfo, type PractitionerReview, type PractitionerReviewInfo, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, PricingMeasure, type Procedure, type ProcedureCategorization, type ProcedureExtendedInfo, ProcedureFamily, type ProcedureInfo, type ProcedureProduct, type ProcedureReview, type ProcedureReviewInfo, ProcedureService, type ProcedureSummaryInfo, type Product, ProductService, type ProposedWorkingHours, REGISTER_TOKENS_COLLECTION, REVIEWS_COLLECTION, type RatingScaleElement, type RequesterInfo, type Requirement, type RequirementInstructionDueNotification, RequirementType, type Review, type ReviewRequestNotification, ReviewService, SYNCED_CALENDARS_COLLECTION, type SearchAppointmentsParams, type SearchCalendarEventsParams, SearchLocationEnum, type SearchPatientsParams, type SignatureElement, type SingleChoiceElement, type StripeTransactionData, type Subcategory, SubcategoryService, SubscriptionModel, SubscriptionStatus, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, type Technology, type TechnologyDocumentationTemplate, TechnologyService, type TextInputElement, type TimeSlot, TimeUnit, TreatmentBenefit, type TreatmentBenefitDynamic, USERS_COLLECTION, USER_FORMS_SUBCOLLECTION, type UpdateAestheticAnalysisData, type UpdateAllergyData, type UpdateAppointmentData, type UpdateAppointmentParams, type UpdateBlockingConditionData, type UpdateBlockingEventParams, type UpdateCalendarEventData, type UpdateClinicAdminData, type UpdateClinicData, type UpdateClinicGroupData, type UpdateContraindicationData, type UpdateDocumentTemplateData, type UpdateMedicationData, type UpdatePatientLocationInfoData, type UpdatePatientMedicalInfoData, type UpdatePatientProfileData, type UpdatePatientSensitiveInfoData, type UpdatePractitionerData, type UpdatePractitionerInviteData, type UpdateProcedureData, type UpdateSyncedCalendarData, type UpdateVitalStatsData, type User, UserRole, UserService, type VitalStats, type WorkingHours, type ZonePhotoUploadData, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseFunctions, getFirebaseInstance, getFirebaseStorage, initializeFirebase };
7025
+ export { AESTHETIC_ANALYSIS_COLLECTION, APPOINTMENTS_COLLECTION, type AddAllergyData, type AddBlockingConditionData, type AddContraindicationData, type AddMedicationData, type AddressData, type AdminInfo, type AdminToken, AdminTokenStatus, type AestheticAnalysis, type AestheticAnalysisStatus, type Allergy, type AllergySubtype, AllergyType, type AllergyTypeWithSubtype, type Appointment, type AppointmentCancelledNotification, type AppointmentMediaItem, type AppointmentMetadata, type AppointmentReminderNotification, type AppointmentRescheduledProposalNotification, AppointmentService, AppointmentStatus, type AppointmentStatusChangeNotification, type AssessmentScales, AuthService, type BaseDocumentElement, type BaseNotification, BaseService, type BeforeAfterPerZone, type BillingInfo, type BillingPerZone, type BillingTransaction, BillingTransactionType, BillingTransactionsService, type BinaryChoiceElement, BlockingCondition, type Brand, BrandService, CALENDAR_COLLECTION, CLINICS_COLLECTION, CLINIC_ADMINS_COLLECTION, CLINIC_GROUPS_COLLECTION, type CalendarEvent, CalendarEventStatus, type CalendarEventTime, CalendarEventType, CalendarServiceV2, CalendarServiceV3, CalendarSyncStatus, type Category, CategoryService, CertificationLevel, CertificationSpecialty, type Clinic, type ClinicAdmin, ClinicAdminService, type ClinicAdminSignupData, type ClinicBranchSetupData, type ClinicContactInfo, type ClinicGroup, ClinicGroupService, type ClinicGroupSetupData, type ClinicInfo, type ClinicLocation, ClinicPhotoTag, type ClinicReview, type ClinicReviewInfo, ClinicService, ClinicTag, type ClinicTags, type ClinicalFindingDetail, type ClinicalFindings, ConstantsService, type ContactPerson, Contraindication, type ContraindicationDynamic, CosmeticAllergySubtype, type CreateAdminTokenData, type CreateAestheticAnalysisData, type CreateAppointmentData, type CreateAppointmentHttpData, type CreateAppointmentParams, type CreateBillingTransactionData, type CreateBlockingEventParams, type CreateCalendarEventData, type CreateClinicAdminData, type CreateClinicData, type CreateClinicGroupData, type CreateDefaultClinicGroupData, type CreateDocumentTemplateData, type CreateDraftPractitionerData, type CreateManualPatientData, type CreatePatientLocationInfoData, type CreatePatientMedicalInfoData, type CreatePatientProfileData, type CreatePatientSensitiveInfoData, type CreatePatientTokenData, type CreatePractitionerData, type CreatePractitionerInviteData, type CreatePractitionerTokenData, type CreateProcedureData, type CreateSyncedCalendarData, type CreateUserData, Currency, DEFAULT_MEDICAL_INFO, DOCTOR_FORMS_SUBCOLLECTION, DOCUMENTATION_TEMPLATES_COLLECTION, type DatePickerElement, type DateRange, type DigitalSignatureElement, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, type DynamicTextElement, DynamicVariable, type EmergencyContact, EnvironmentalAllergySubtype, ExternalCalendarService, FILLED_DOCUMENTS_COLLECTION, type FileUploadElement, type FilledDocument, type FilledDocumentFileValue, FilledDocumentService, FilledDocumentStatus, type FinalBilling, type FirebaseUser, FoodAllergySubtype, type FormReminderNotification, type FormSubmissionConfirmationNotification, type GamificationInfo, Gender, type GeneralMessageNotification, type HeadingElement, HeadingLevel, INVITE_TOKENS_COLLECTION, Language, type LinkedFormInfo, type ListElement, ListType, type LocationData, MEDIA_METADATA_COLLECTION, MediaAccessLevel, type MediaMetadata, type MediaResource, MediaService, MediaType, MedicationAllergySubtype, type MultipleChoiceElement, NOTIFICATIONS_COLLECTION, type Notification, NotificationService, NotificationStatus, NotificationType, PATIENTS_COLLECTION, PATIENT_APPOINTMENTS_COLLECTION, PATIENT_LOCATION_INFO_COLLECTION, PATIENT_MEDICAL_HISTORY_COLLECTION, PATIENT_MEDICAL_INFO_COLLECTION, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, PATIENT_SENSITIVE_INFO_COLLECTION, PRACTITIONERS_COLLECTION, PRACTITIONER_INVITES_COLLECTION, PROCEDURES_COLLECTION, type ParagraphElement, type PatientClinic, type PatientDoctor, type PatientGoals, PatientInstructionStatus, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileForDoctor, type PatientProfileInfo, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, type PatientRequirementsFilters, PatientRequirementsService, type PatientReviewInfo, type PatientSensitiveInfo, PatientService, type PatientToken, PatientTokenStatus, type PaymentConfirmationNotification, PaymentStatus, type PlanDetails, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerInvite, type PractitionerInviteFilters, PractitionerInviteService, PractitionerInviteStatus, type PractitionerProfileInfo, type PractitionerReview, type PractitionerReviewInfo, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, PricingMeasure, type Procedure, type ProcedureCategorization, type ProcedureExtendedInfo, ProcedureFamily, type ProcedureInfo, type ProcedureProduct, type ProcedureReview, type ProcedureReviewInfo, ProcedureService, type ProcedureSummaryInfo, type Product, ProductService, type ProposedWorkingHours, REGISTER_TOKENS_COLLECTION, REVIEWS_COLLECTION, type RatingScaleElement, type RequesterInfo, type Requirement, type RequirementInstructionDueNotification, RequirementType, type Review, type ReviewRequestNotification, ReviewService, SYNCED_CALENDARS_COLLECTION, type SearchAppointmentsParams, type SearchCalendarEventsParams, SearchLocationEnum, type SearchPatientsParams, type SignatureElement, type SingleChoiceElement, type StripeTransactionData, type Subcategory, SubcategoryService, SubscriptionModel, SubscriptionStatus, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, type Technology, type TechnologyDocumentationTemplate, TechnologyService, type TextInputElement, type TimeSlot, TimeUnit, TreatmentBenefit, type TreatmentBenefitDynamic, USERS_COLLECTION, USER_FORMS_SUBCOLLECTION, type UpdateAestheticAnalysisData, type UpdateAllergyData, type UpdateAppointmentData, type UpdateAppointmentParams, type UpdateBlockingConditionData, type UpdateBlockingEventParams, type UpdateCalendarEventData, type UpdateClinicAdminData, type UpdateClinicData, type UpdateClinicGroupData, type UpdateContraindicationData, type UpdateDocumentTemplateData, type UpdateMedicationData, type UpdatePatientLocationInfoData, type UpdatePatientMedicalInfoData, type UpdatePatientProfileData, type UpdatePatientSensitiveInfoData, type UpdatePractitionerData, type UpdatePractitionerInviteData, type UpdateProcedureData, type UpdateSyncedCalendarData, type UpdateVitalStatsData, type User, UserRole, UserService, type VitalStats, type WorkingHours, type ZonePhotoUploadData, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseFunctions, getFirebaseInstance, getFirebaseStorage, initializeFirebase };
package/dist/index.d.ts CHANGED
@@ -3235,44 +3235,56 @@ interface UpdateMedicationData extends Partial<AddMedicationData> {
3235
3235
  declare const DEFAULT_MEDICAL_INFO: Omit<PatientMedicalInfo, "patientId" | "lastUpdated" | "updatedBy">;
3236
3236
 
3237
3237
  declare const AESTHETIC_ANALYSIS_COLLECTION = "aesthetic-analysis";
3238
- interface ClinicalFinding {
3239
- concernCategory: string;
3240
- concernName: string;
3241
- severityLevel?: string;
3242
- impactLevel?: string;
3243
- clinicalNotes?: string;
3244
- }
3245
- interface AssessmentScale {
3246
- scaleName: string;
3247
- scaleValue: string;
3248
- category: string;
3238
+ type AestheticAnalysisStatus = 'incomplete' | 'ready_for_planning' | 'treatment_planned';
3239
+ interface ClinicalFindingDetail {
3240
+ severity: string;
3241
+ impact: string;
3242
+ notes?: string;
3243
+ }
3244
+ interface ClinicalFindings {
3245
+ [category: string]: {
3246
+ [concern: string]: ClinicalFindingDetail;
3247
+ };
3249
3248
  }
3250
3249
  interface PatientGoals {
3251
- treatmentTimeline?: string;
3252
- budgetRange?: string;
3253
- naturalnessPreference: number;
3254
- selectedGoalTemplate?: string;
3250
+ timeline?: string;
3251
+ budget?: string;
3252
+ naturalness: number;
3255
3253
  priorities: string[];
3254
+ selectedTemplate?: string;
3255
+ }
3256
+ interface AssessmentScales {
3257
+ [scaleName: string]: string;
3256
3258
  }
3257
3259
  interface AestheticAnalysis {
3260
+ id: string;
3258
3261
  patientId: string;
3262
+ appointmentId?: string;
3263
+ selectedConcerns: string[];
3264
+ clinicalFindings: ClinicalFindings;
3265
+ patientGoals: PatientGoals;
3266
+ assessmentScales: AssessmentScales;
3267
+ completionPercentage: number;
3268
+ status: AestheticAnalysisStatus;
3259
3269
  lastUpdatedBy: string;
3260
3270
  lastUpdatedByRole: 'PATIENT' | 'PRACTITIONER';
3261
- patientGoals: PatientGoals;
3262
- clinicalFindings: ClinicalFinding[];
3263
- assessmentScales: AssessmentScale[];
3264
3271
  createdAt?: Timestamp | any;
3265
3272
  updatedAt?: Timestamp | any;
3266
3273
  }
3267
3274
  interface CreateAestheticAnalysisData {
3275
+ patientId: string;
3276
+ appointmentId?: string;
3277
+ selectedConcerns: string[];
3278
+ clinicalFindings: ClinicalFindings;
3268
3279
  patientGoals: PatientGoals;
3269
- clinicalFindings: ClinicalFinding[];
3270
- assessmentScales: AssessmentScale[];
3280
+ assessmentScales?: AssessmentScales;
3271
3281
  }
3272
3282
  interface UpdateAestheticAnalysisData {
3283
+ appointmentId?: string;
3284
+ selectedConcerns?: string[];
3285
+ clinicalFindings?: ClinicalFindings;
3273
3286
  patientGoals?: PatientGoals;
3274
- clinicalFindings?: ClinicalFinding[];
3275
- assessmentScales?: AssessmentScale[];
3287
+ assessmentScales?: AssessmentScales;
3276
3288
  }
3277
3289
 
3278
3290
  declare const PATIENTS_COLLECTION = "patients";
@@ -7010,4 +7022,4 @@ declare const getFirebaseApp: () => Promise<FirebaseApp>;
7010
7022
  declare const getFirebaseStorage: () => Promise<FirebaseStorage>;
7011
7023
  declare const getFirebaseFunctions: () => Promise<Functions>;
7012
7024
 
7013
- export { AESTHETIC_ANALYSIS_COLLECTION, APPOINTMENTS_COLLECTION, type AddAllergyData, type AddBlockingConditionData, type AddContraindicationData, type AddMedicationData, type AddressData, type AdminInfo, type AdminToken, AdminTokenStatus, type AestheticAnalysis, type Allergy, type AllergySubtype, AllergyType, type AllergyTypeWithSubtype, type Appointment, type AppointmentCancelledNotification, type AppointmentMediaItem, type AppointmentMetadata, type AppointmentReminderNotification, type AppointmentRescheduledProposalNotification, AppointmentService, AppointmentStatus, type AppointmentStatusChangeNotification, type AssessmentScale, AuthService, type BaseDocumentElement, type BaseNotification, BaseService, type BeforeAfterPerZone, type BillingInfo, type BillingPerZone, type BillingTransaction, BillingTransactionType, BillingTransactionsService, type BinaryChoiceElement, BlockingCondition, type Brand, BrandService, CALENDAR_COLLECTION, CLINICS_COLLECTION, CLINIC_ADMINS_COLLECTION, CLINIC_GROUPS_COLLECTION, type CalendarEvent, CalendarEventStatus, type CalendarEventTime, CalendarEventType, CalendarServiceV2, CalendarServiceV3, CalendarSyncStatus, type Category, CategoryService, CertificationLevel, CertificationSpecialty, type Clinic, type ClinicAdmin, ClinicAdminService, type ClinicAdminSignupData, type ClinicBranchSetupData, type ClinicContactInfo, type ClinicGroup, ClinicGroupService, type ClinicGroupSetupData, type ClinicInfo, type ClinicLocation, ClinicPhotoTag, type ClinicReview, type ClinicReviewInfo, ClinicService, ClinicTag, type ClinicTags, type ClinicalFinding, ConstantsService, type ContactPerson, Contraindication, type ContraindicationDynamic, CosmeticAllergySubtype, type CreateAdminTokenData, type CreateAestheticAnalysisData, type CreateAppointmentData, type CreateAppointmentHttpData, type CreateAppointmentParams, type CreateBillingTransactionData, type CreateBlockingEventParams, type CreateCalendarEventData, type CreateClinicAdminData, type CreateClinicData, type CreateClinicGroupData, type CreateDefaultClinicGroupData, type CreateDocumentTemplateData, type CreateDraftPractitionerData, type CreateManualPatientData, type CreatePatientLocationInfoData, type CreatePatientMedicalInfoData, type CreatePatientProfileData, type CreatePatientSensitiveInfoData, type CreatePatientTokenData, type CreatePractitionerData, type CreatePractitionerInviteData, type CreatePractitionerTokenData, type CreateProcedureData, type CreateSyncedCalendarData, type CreateUserData, Currency, DEFAULT_MEDICAL_INFO, DOCTOR_FORMS_SUBCOLLECTION, DOCUMENTATION_TEMPLATES_COLLECTION, type DatePickerElement, type DateRange, type DigitalSignatureElement, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, type DynamicTextElement, DynamicVariable, type EmergencyContact, EnvironmentalAllergySubtype, ExternalCalendarService, FILLED_DOCUMENTS_COLLECTION, type FileUploadElement, type FilledDocument, type FilledDocumentFileValue, FilledDocumentService, FilledDocumentStatus, type FinalBilling, type FirebaseUser, FoodAllergySubtype, type FormReminderNotification, type FormSubmissionConfirmationNotification, type GamificationInfo, Gender, type GeneralMessageNotification, type HeadingElement, HeadingLevel, INVITE_TOKENS_COLLECTION, Language, type LinkedFormInfo, type ListElement, ListType, type LocationData, MEDIA_METADATA_COLLECTION, MediaAccessLevel, type MediaMetadata, type MediaResource, MediaService, MediaType, MedicationAllergySubtype, type MultipleChoiceElement, NOTIFICATIONS_COLLECTION, type Notification, NotificationService, NotificationStatus, NotificationType, PATIENTS_COLLECTION, PATIENT_APPOINTMENTS_COLLECTION, PATIENT_LOCATION_INFO_COLLECTION, PATIENT_MEDICAL_HISTORY_COLLECTION, PATIENT_MEDICAL_INFO_COLLECTION, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, PATIENT_SENSITIVE_INFO_COLLECTION, PRACTITIONERS_COLLECTION, PRACTITIONER_INVITES_COLLECTION, PROCEDURES_COLLECTION, type ParagraphElement, type PatientClinic, type PatientDoctor, type PatientGoals, PatientInstructionStatus, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileForDoctor, type PatientProfileInfo, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, type PatientRequirementsFilters, PatientRequirementsService, type PatientReviewInfo, type PatientSensitiveInfo, PatientService, type PatientToken, PatientTokenStatus, type PaymentConfirmationNotification, PaymentStatus, type PlanDetails, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerInvite, type PractitionerInviteFilters, PractitionerInviteService, PractitionerInviteStatus, type PractitionerProfileInfo, type PractitionerReview, type PractitionerReviewInfo, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, PricingMeasure, type Procedure, type ProcedureCategorization, type ProcedureExtendedInfo, ProcedureFamily, type ProcedureInfo, type ProcedureProduct, type ProcedureReview, type ProcedureReviewInfo, ProcedureService, type ProcedureSummaryInfo, type Product, ProductService, type ProposedWorkingHours, REGISTER_TOKENS_COLLECTION, REVIEWS_COLLECTION, type RatingScaleElement, type RequesterInfo, type Requirement, type RequirementInstructionDueNotification, RequirementType, type Review, type ReviewRequestNotification, ReviewService, SYNCED_CALENDARS_COLLECTION, type SearchAppointmentsParams, type SearchCalendarEventsParams, SearchLocationEnum, type SearchPatientsParams, type SignatureElement, type SingleChoiceElement, type StripeTransactionData, type Subcategory, SubcategoryService, SubscriptionModel, SubscriptionStatus, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, type Technology, type TechnologyDocumentationTemplate, TechnologyService, type TextInputElement, type TimeSlot, TimeUnit, TreatmentBenefit, type TreatmentBenefitDynamic, USERS_COLLECTION, USER_FORMS_SUBCOLLECTION, type UpdateAestheticAnalysisData, type UpdateAllergyData, type UpdateAppointmentData, type UpdateAppointmentParams, type UpdateBlockingConditionData, type UpdateBlockingEventParams, type UpdateCalendarEventData, type UpdateClinicAdminData, type UpdateClinicData, type UpdateClinicGroupData, type UpdateContraindicationData, type UpdateDocumentTemplateData, type UpdateMedicationData, type UpdatePatientLocationInfoData, type UpdatePatientMedicalInfoData, type UpdatePatientProfileData, type UpdatePatientSensitiveInfoData, type UpdatePractitionerData, type UpdatePractitionerInviteData, type UpdateProcedureData, type UpdateSyncedCalendarData, type UpdateVitalStatsData, type User, UserRole, UserService, type VitalStats, type WorkingHours, type ZonePhotoUploadData, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseFunctions, getFirebaseInstance, getFirebaseStorage, initializeFirebase };
7025
+ export { AESTHETIC_ANALYSIS_COLLECTION, APPOINTMENTS_COLLECTION, type AddAllergyData, type AddBlockingConditionData, type AddContraindicationData, type AddMedicationData, type AddressData, type AdminInfo, type AdminToken, AdminTokenStatus, type AestheticAnalysis, type AestheticAnalysisStatus, type Allergy, type AllergySubtype, AllergyType, type AllergyTypeWithSubtype, type Appointment, type AppointmentCancelledNotification, type AppointmentMediaItem, type AppointmentMetadata, type AppointmentReminderNotification, type AppointmentRescheduledProposalNotification, AppointmentService, AppointmentStatus, type AppointmentStatusChangeNotification, type AssessmentScales, AuthService, type BaseDocumentElement, type BaseNotification, BaseService, type BeforeAfterPerZone, type BillingInfo, type BillingPerZone, type BillingTransaction, BillingTransactionType, BillingTransactionsService, type BinaryChoiceElement, BlockingCondition, type Brand, BrandService, CALENDAR_COLLECTION, CLINICS_COLLECTION, CLINIC_ADMINS_COLLECTION, CLINIC_GROUPS_COLLECTION, type CalendarEvent, CalendarEventStatus, type CalendarEventTime, CalendarEventType, CalendarServiceV2, CalendarServiceV3, CalendarSyncStatus, type Category, CategoryService, CertificationLevel, CertificationSpecialty, type Clinic, type ClinicAdmin, ClinicAdminService, type ClinicAdminSignupData, type ClinicBranchSetupData, type ClinicContactInfo, type ClinicGroup, ClinicGroupService, type ClinicGroupSetupData, type ClinicInfo, type ClinicLocation, ClinicPhotoTag, type ClinicReview, type ClinicReviewInfo, ClinicService, ClinicTag, type ClinicTags, type ClinicalFindingDetail, type ClinicalFindings, ConstantsService, type ContactPerson, Contraindication, type ContraindicationDynamic, CosmeticAllergySubtype, type CreateAdminTokenData, type CreateAestheticAnalysisData, type CreateAppointmentData, type CreateAppointmentHttpData, type CreateAppointmentParams, type CreateBillingTransactionData, type CreateBlockingEventParams, type CreateCalendarEventData, type CreateClinicAdminData, type CreateClinicData, type CreateClinicGroupData, type CreateDefaultClinicGroupData, type CreateDocumentTemplateData, type CreateDraftPractitionerData, type CreateManualPatientData, type CreatePatientLocationInfoData, type CreatePatientMedicalInfoData, type CreatePatientProfileData, type CreatePatientSensitiveInfoData, type CreatePatientTokenData, type CreatePractitionerData, type CreatePractitionerInviteData, type CreatePractitionerTokenData, type CreateProcedureData, type CreateSyncedCalendarData, type CreateUserData, Currency, DEFAULT_MEDICAL_INFO, DOCTOR_FORMS_SUBCOLLECTION, DOCUMENTATION_TEMPLATES_COLLECTION, type DatePickerElement, type DateRange, type DigitalSignatureElement, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, type DynamicTextElement, DynamicVariable, type EmergencyContact, EnvironmentalAllergySubtype, ExternalCalendarService, FILLED_DOCUMENTS_COLLECTION, type FileUploadElement, type FilledDocument, type FilledDocumentFileValue, FilledDocumentService, FilledDocumentStatus, type FinalBilling, type FirebaseUser, FoodAllergySubtype, type FormReminderNotification, type FormSubmissionConfirmationNotification, type GamificationInfo, Gender, type GeneralMessageNotification, type HeadingElement, HeadingLevel, INVITE_TOKENS_COLLECTION, Language, type LinkedFormInfo, type ListElement, ListType, type LocationData, MEDIA_METADATA_COLLECTION, MediaAccessLevel, type MediaMetadata, type MediaResource, MediaService, MediaType, MedicationAllergySubtype, type MultipleChoiceElement, NOTIFICATIONS_COLLECTION, type Notification, NotificationService, NotificationStatus, NotificationType, PATIENTS_COLLECTION, PATIENT_APPOINTMENTS_COLLECTION, PATIENT_LOCATION_INFO_COLLECTION, PATIENT_MEDICAL_HISTORY_COLLECTION, PATIENT_MEDICAL_INFO_COLLECTION, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, PATIENT_SENSITIVE_INFO_COLLECTION, PRACTITIONERS_COLLECTION, PRACTITIONER_INVITES_COLLECTION, PROCEDURES_COLLECTION, type ParagraphElement, type PatientClinic, type PatientDoctor, type PatientGoals, PatientInstructionStatus, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileForDoctor, type PatientProfileInfo, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, type PatientRequirementsFilters, PatientRequirementsService, type PatientReviewInfo, type PatientSensitiveInfo, PatientService, type PatientToken, PatientTokenStatus, type PaymentConfirmationNotification, PaymentStatus, type PlanDetails, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerInvite, type PractitionerInviteFilters, PractitionerInviteService, PractitionerInviteStatus, type PractitionerProfileInfo, type PractitionerReview, type PractitionerReviewInfo, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, PricingMeasure, type Procedure, type ProcedureCategorization, type ProcedureExtendedInfo, ProcedureFamily, type ProcedureInfo, type ProcedureProduct, type ProcedureReview, type ProcedureReviewInfo, ProcedureService, type ProcedureSummaryInfo, type Product, ProductService, type ProposedWorkingHours, REGISTER_TOKENS_COLLECTION, REVIEWS_COLLECTION, type RatingScaleElement, type RequesterInfo, type Requirement, type RequirementInstructionDueNotification, RequirementType, type Review, type ReviewRequestNotification, ReviewService, SYNCED_CALENDARS_COLLECTION, type SearchAppointmentsParams, type SearchCalendarEventsParams, SearchLocationEnum, type SearchPatientsParams, type SignatureElement, type SingleChoiceElement, type StripeTransactionData, type Subcategory, SubcategoryService, SubscriptionModel, SubscriptionStatus, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, type Technology, type TechnologyDocumentationTemplate, TechnologyService, type TextInputElement, type TimeSlot, TimeUnit, TreatmentBenefit, type TreatmentBenefitDynamic, USERS_COLLECTION, USER_FORMS_SUBCOLLECTION, type UpdateAestheticAnalysisData, type UpdateAllergyData, type UpdateAppointmentData, type UpdateAppointmentParams, type UpdateBlockingConditionData, type UpdateBlockingEventParams, type UpdateCalendarEventData, type UpdateClinicAdminData, type UpdateClinicData, type UpdateClinicGroupData, type UpdateContraindicationData, type UpdateDocumentTemplateData, type UpdateMedicationData, type UpdatePatientLocationInfoData, type UpdatePatientMedicalInfoData, type UpdatePatientProfileData, type UpdatePatientSensitiveInfoData, type UpdatePractitionerData, type UpdatePractitionerInviteData, type UpdateProcedureData, type UpdateSyncedCalendarData, type UpdateVitalStatsData, type User, UserRole, UserService, type VitalStats, type WorkingHours, type ZonePhotoUploadData, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseFunctions, getFirebaseInstance, getFirebaseStorage, initializeFirebase };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blackcode_sa/metaestetics-api",
3
3
  "private": false,
4
- "version": "1.12.31",
4
+ "version": "1.12.32",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -5,6 +5,7 @@ import {
5
5
  UpdateAestheticAnalysisData,
6
6
  AESTHETIC_ANALYSIS_COLLECTION,
7
7
  PATIENTS_COLLECTION,
8
+ AestheticAnalysisStatus,
8
9
  } from '../../../types/patient';
9
10
  import { UserRole } from '../../../types';
10
11
  import {
@@ -63,6 +64,37 @@ const checkAestheticAnalysisAccessUtil = async (
63
64
  );
64
65
  };
65
66
 
67
+ export const calculateCompletionPercentage = (data: Partial<AestheticAnalysis>): number => {
68
+ let completed = 0;
69
+ const total = 4;
70
+
71
+ if (data.selectedConcerns && data.selectedConcerns.length > 0) completed++;
72
+
73
+ if (data.patientGoals && (
74
+ data.patientGoals.timeline ||
75
+ data.patientGoals.budget ||
76
+ data.patientGoals.selectedTemplate
77
+ )) completed++;
78
+
79
+ if (data.assessmentScales && Object.keys(data.assessmentScales).length > 0) completed++;
80
+
81
+ if (data.clinicalFindings && Object.keys(data.clinicalFindings).length > 0) completed++;
82
+
83
+ return Math.round((completed / total) * 100);
84
+ };
85
+
86
+ export const determineStatus = (completionPercentage: number, selectedConcerns: string[]): AestheticAnalysisStatus => {
87
+ if (completionPercentage < 50) {
88
+ return 'incomplete';
89
+ }
90
+
91
+ if (completionPercentage >= 50 && selectedConcerns.length > 0) {
92
+ return 'ready_for_planning';
93
+ }
94
+
95
+ return 'incomplete';
96
+ };
97
+
66
98
  export const getAestheticAnalysisUtil = async (
67
99
  db: Firestore,
68
100
  patientId: string,
@@ -78,7 +110,11 @@ export const getAestheticAnalysisUtil = async (
78
110
  return null;
79
111
  }
80
112
 
81
- return aestheticAnalysisSchema.parse(snapshot.data());
113
+ const data = snapshot.data();
114
+ return aestheticAnalysisSchema.parse({
115
+ ...data,
116
+ id: patientId,
117
+ });
82
118
  };
83
119
 
84
120
  export const createOrUpdateAestheticAnalysisUtil = async (
@@ -100,10 +136,28 @@ export const createOrUpdateAestheticAnalysisUtil = async (
100
136
 
101
137
  const requesterRole = requesterRoles.includes(UserRole.PRACTITIONER) ? 'PRACTITIONER' : 'PATIENT';
102
138
 
139
+ const existingData = snapshot.exists() ? snapshot.data() : null;
140
+ const mergedData: any = {
141
+ ...(existingData || {}),
142
+ ...validatedData,
143
+ };
144
+
145
+ const completionPercentage = calculateCompletionPercentage(mergedData);
146
+ const status = determineStatus(
147
+ completionPercentage,
148
+ mergedData.selectedConcerns || []
149
+ );
150
+
103
151
  if (!snapshot.exists()) {
104
152
  await setDoc(docRef, {
153
+ id: patientId,
105
154
  patientId,
155
+ selectedConcerns: [],
156
+ clinicalFindings: {},
157
+ assessmentScales: {},
106
158
  ...validatedData,
159
+ completionPercentage,
160
+ status,
107
161
  lastUpdatedBy: requesterId,
108
162
  lastUpdatedByRole: requesterRole,
109
163
  createdAt: serverTimestamp(),
@@ -112,10 +166,11 @@ export const createOrUpdateAestheticAnalysisUtil = async (
112
166
  } else {
113
167
  await updateDoc(docRef, {
114
168
  ...validatedData,
169
+ completionPercentage,
170
+ status,
115
171
  lastUpdatedBy: requesterId,
116
172
  lastUpdatedByRole: requesterRole,
117
173
  updatedAt: serverTimestamp(),
118
174
  });
119
175
  }
120
176
  };
121
-
@@ -2,51 +2,65 @@ import { Timestamp } from 'firebase/firestore';
2
2
 
3
3
  export const AESTHETIC_ANALYSIS_COLLECTION = 'aesthetic-analysis';
4
4
 
5
- export interface ClinicalFinding {
6
- concernCategory: string;
7
- concernName: string;
8
- severityLevel?: string;
9
- impactLevel?: string;
10
- clinicalNotes?: string;
5
+ export type AestheticAnalysisStatus = 'incomplete' | 'ready_for_planning' | 'treatment_planned';
6
+
7
+ export interface ClinicalFindingDetail {
8
+ severity: string;
9
+ impact: string;
10
+ notes?: string;
11
11
  }
12
12
 
13
- export interface AssessmentScale {
14
- scaleName: string;
15
- scaleValue: string;
16
- category: string;
13
+ export interface ClinicalFindings {
14
+ [category: string]: {
15
+ [concern: string]: ClinicalFindingDetail;
16
+ };
17
17
  }
18
18
 
19
19
  export interface PatientGoals {
20
- treatmentTimeline?: string;
21
- budgetRange?: string;
22
- naturalnessPreference: number;
23
- selectedGoalTemplate?: string;
20
+ timeline?: string;
21
+ budget?: string;
22
+ naturalness: number;
24
23
  priorities: string[];
24
+ selectedTemplate?: string;
25
+ }
26
+
27
+ export interface AssessmentScales {
28
+ [scaleName: string]: string;
25
29
  }
26
30
 
27
31
  export interface AestheticAnalysis {
32
+ id: string;
28
33
  patientId: string;
34
+ appointmentId?: string;
35
+
36
+ selectedConcerns: string[];
37
+ clinicalFindings: ClinicalFindings;
38
+ patientGoals: PatientGoals;
39
+ assessmentScales: AssessmentScales;
40
+
41
+ completionPercentage: number;
42
+ status: AestheticAnalysisStatus;
29
43
 
30
44
  lastUpdatedBy: string;
31
45
  lastUpdatedByRole: 'PATIENT' | 'PRACTITIONER';
32
46
 
33
- patientGoals: PatientGoals;
34
- clinicalFindings: ClinicalFinding[];
35
- assessmentScales: AssessmentScale[];
36
-
37
47
  createdAt?: Timestamp | any;
38
48
  updatedAt?: Timestamp | any;
39
49
  }
40
50
 
41
51
  export interface CreateAestheticAnalysisData {
52
+ patientId: string;
53
+ appointmentId?: string;
54
+ selectedConcerns: string[];
55
+ clinicalFindings: ClinicalFindings;
42
56
  patientGoals: PatientGoals;
43
- clinicalFindings: ClinicalFinding[];
44
- assessmentScales: AssessmentScale[];
57
+ assessmentScales?: AssessmentScales;
45
58
  }
46
59
 
47
60
  export interface UpdateAestheticAnalysisData {
61
+ appointmentId?: string;
62
+ selectedConcerns?: string[];
63
+ clinicalFindings?: ClinicalFindings;
48
64
  patientGoals?: PatientGoals;
49
- clinicalFindings?: ClinicalFinding[];
50
- assessmentScales?: AssessmentScale[];
65
+ assessmentScales?: AssessmentScales;
51
66
  }
52
-
@@ -1,47 +1,55 @@
1
1
  import { z } from 'zod';
2
2
 
3
- export const clinicalFindingSchema = z.object({
4
- concernCategory: z.string().min(1, 'Concern category is required'),
5
- concernName: z.string().min(1, 'Concern name is required'),
6
- severityLevel: z.string().optional(),
7
- impactLevel: z.string().optional(),
8
- clinicalNotes: z.string().optional(),
3
+ export const clinicalFindingDetailSchema = z.object({
4
+ severity: z.string().min(1, 'Severity is required'),
5
+ impact: z.string().min(1, 'Impact is required'),
6
+ notes: z.string().optional(),
9
7
  });
10
8
 
11
- export const assessmentScaleSchema = z.object({
12
- scaleName: z.string().min(1, 'Scale name is required'),
13
- scaleValue: z.string().min(1, 'Scale value is required'),
14
- category: z.string().min(1, 'Category is required'),
15
- });
9
+ export const clinicalFindingsSchema = z.record(
10
+ z.string(),
11
+ z.record(z.string(), clinicalFindingDetailSchema)
12
+ );
16
13
 
17
14
  export const patientGoalsSchema = z.object({
18
- treatmentTimeline: z.string().optional(),
19
- budgetRange: z.string().optional(),
20
- naturalnessPreference: z.number().min(0).max(100),
21
- selectedGoalTemplate: z.string().optional(),
22
- priorities: z.array(z.string()).default([]),
15
+ timeline: z.string().optional(),
16
+ budget: z.string().optional(),
17
+ naturalness: z.number().min(0).max(100, 'Naturalness must be between 0 and 100'),
18
+ priorities: z.array(z.string()),
19
+ selectedTemplate: z.string().optional(),
23
20
  });
24
21
 
25
- export const aestheticAnalysisSchema = z.object({
26
- patientId: z.string().min(1, 'Patient ID is required'),
27
- lastUpdatedBy: z.string().min(1, 'Last updated by is required'),
28
- lastUpdatedByRole: z.enum(['PATIENT', 'PRACTITIONER']),
29
- patientGoals: patientGoalsSchema,
30
- clinicalFindings: z.array(clinicalFindingSchema).default([]),
31
- assessmentScales: z.array(assessmentScaleSchema).default([]),
32
- createdAt: z.any(),
33
- updatedAt: z.any(),
34
- });
22
+ export const assessmentScalesSchema = z.record(z.string(), z.string());
35
23
 
36
24
  export const createAestheticAnalysisSchema = z.object({
25
+ patientId: z.string().min(1, 'Patient ID is required'),
26
+ appointmentId: z.string().optional(),
27
+ selectedConcerns: z.array(z.string()),
28
+ clinicalFindings: clinicalFindingsSchema,
37
29
  patientGoals: patientGoalsSchema,
38
- clinicalFindings: z.array(clinicalFindingSchema).default([]),
39
- assessmentScales: z.array(assessmentScaleSchema).default([]),
30
+ assessmentScales: assessmentScalesSchema.optional(),
40
31
  });
41
32
 
42
33
  export const updateAestheticAnalysisSchema = z.object({
43
- patientGoals: patientGoalsSchema.optional(),
44
- clinicalFindings: z.array(clinicalFindingSchema).optional(),
45
- assessmentScales: z.array(assessmentScaleSchema).optional(),
46
- });
34
+ appointmentId: z.string().optional(),
35
+ selectedConcerns: z.array(z.string()).optional(),
36
+ clinicalFindings: clinicalFindingsSchema.optional(),
37
+ patientGoals: patientGoalsSchema.partial().optional(),
38
+ assessmentScales: assessmentScalesSchema.optional(),
39
+ }).partial();
47
40
 
41
+ export const aestheticAnalysisSchema = z.object({
42
+ id: z.string(),
43
+ patientId: z.string(),
44
+ appointmentId: z.string().optional(),
45
+ selectedConcerns: z.array(z.string()),
46
+ clinicalFindings: clinicalFindingsSchema,
47
+ patientGoals: patientGoalsSchema,
48
+ assessmentScales: assessmentScalesSchema,
49
+ completionPercentage: z.number().min(0).max(100),
50
+ status: z.enum(['incomplete', 'ready_for_planning', 'treatment_planned']),
51
+ lastUpdatedBy: z.string(),
52
+ lastUpdatedByRole: z.enum(['PATIENT', 'PRACTITIONER']),
53
+ createdAt: z.any(),
54
+ updatedAt: z.any(),
55
+ });