@blackcode_sa/metaestetics-api 1.12.72 → 1.13.1
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 +872 -1
- package/dist/admin/index.d.ts +872 -1
- package/dist/admin/index.js +3604 -356
- package/dist/admin/index.mjs +3594 -357
- package/dist/index.d.mts +1349 -1
- package/dist/index.d.ts +1349 -1
- package/dist/index.js +5325 -2141
- package/dist/index.mjs +4939 -1767
- package/package.json +1 -1
- package/src/admin/analytics/analytics.admin.service.ts +278 -0
- package/src/admin/analytics/index.ts +2 -0
- package/src/admin/index.ts +6 -0
- package/src/backoffice/services/analytics.service.proposal.md +4 -0
- package/src/services/analytics/ARCHITECTURE.md +199 -0
- package/src/services/analytics/CLOUD_FUNCTIONS.md +225 -0
- package/src/services/analytics/GROUPED_ANALYTICS.md +501 -0
- package/src/services/analytics/QUICK_START.md +393 -0
- package/src/services/analytics/README.md +304 -0
- package/src/services/analytics/SUMMARY.md +141 -0
- package/src/services/analytics/TRENDS.md +380 -0
- package/src/services/analytics/USAGE_GUIDE.md +518 -0
- package/src/services/analytics/analytics-cloud.service.ts +222 -0
- package/src/services/analytics/analytics.service.ts +2142 -0
- package/src/services/analytics/index.ts +4 -0
- package/src/services/analytics/review-analytics.service.ts +941 -0
- package/src/services/analytics/utils/appointment-filtering.utils.ts +138 -0
- package/src/services/analytics/utils/cost-calculation.utils.ts +182 -0
- package/src/services/analytics/utils/grouping.utils.ts +434 -0
- package/src/services/analytics/utils/stored-analytics.utils.ts +347 -0
- package/src/services/analytics/utils/time-calculation.utils.ts +186 -0
- package/src/services/analytics/utils/trend-calculation.utils.ts +200 -0
- package/src/services/index.ts +1 -0
- package/src/types/analytics/analytics.types.ts +597 -0
- package/src/types/analytics/grouped-analytics.types.ts +173 -0
- package/src/types/analytics/index.ts +4 -0
- package/src/types/analytics/stored-analytics.types.ts +137 -0
- package/src/types/index.ts +3 -0
package/dist/admin/index.d.mts
CHANGED
|
@@ -977,6 +977,8 @@ interface PractitionerInvite {
|
|
|
977
977
|
cancelledAt?: Timestamp | null;
|
|
978
978
|
}
|
|
979
979
|
|
|
980
|
+
declare const CLINICS_COLLECTION = "clinics";
|
|
981
|
+
|
|
980
982
|
/**
|
|
981
983
|
* Interface for clinic contact information
|
|
982
984
|
*/
|
|
@@ -2039,6 +2041,837 @@ interface PatientRequirementInstance {
|
|
|
2039
2041
|
*/
|
|
2040
2042
|
declare const PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME = "patientRequirements";
|
|
2041
2043
|
|
|
2044
|
+
/**
|
|
2045
|
+
* Base metrics interface with common properties
|
|
2046
|
+
*/
|
|
2047
|
+
interface BaseMetrics {
|
|
2048
|
+
total: number;
|
|
2049
|
+
dateRange?: {
|
|
2050
|
+
start: Date;
|
|
2051
|
+
end: Date;
|
|
2052
|
+
};
|
|
2053
|
+
}
|
|
2054
|
+
/**
|
|
2055
|
+
* Date range filter for analytics queries
|
|
2056
|
+
*/
|
|
2057
|
+
interface AnalyticsDateRange {
|
|
2058
|
+
start: Date;
|
|
2059
|
+
end: Date;
|
|
2060
|
+
}
|
|
2061
|
+
/**
|
|
2062
|
+
* Common filters for analytics queries
|
|
2063
|
+
*/
|
|
2064
|
+
interface AnalyticsFilters {
|
|
2065
|
+
clinicBranchId?: string;
|
|
2066
|
+
practitionerId?: string;
|
|
2067
|
+
procedureId?: string;
|
|
2068
|
+
patientId?: string;
|
|
2069
|
+
}
|
|
2070
|
+
/**
|
|
2071
|
+
* Grouping period for trend analysis
|
|
2072
|
+
*/
|
|
2073
|
+
type GroupingPeriod = 'day' | 'week' | 'month';
|
|
2074
|
+
/**
|
|
2075
|
+
* Trend period type (only predefined periods, no custom)
|
|
2076
|
+
*/
|
|
2077
|
+
type TrendPeriod = 'week' | 'month' | 'quarter' | 'year';
|
|
2078
|
+
/**
|
|
2079
|
+
* Entity type for grouping analytics
|
|
2080
|
+
*/
|
|
2081
|
+
type EntityType = 'clinic' | 'practitioner' | 'patient' | 'procedure' | 'technology';
|
|
2082
|
+
/**
|
|
2083
|
+
* Practitioner Analytics
|
|
2084
|
+
* Comprehensive metrics for a practitioner's performance
|
|
2085
|
+
*/
|
|
2086
|
+
interface PractitionerAnalytics extends BaseMetrics {
|
|
2087
|
+
practitionerId: string;
|
|
2088
|
+
practitionerName: string;
|
|
2089
|
+
totalAppointments: number;
|
|
2090
|
+
completedAppointments: number;
|
|
2091
|
+
canceledAppointments: number;
|
|
2092
|
+
noShowAppointments: number;
|
|
2093
|
+
pendingAppointments: number;
|
|
2094
|
+
confirmedAppointments: number;
|
|
2095
|
+
cancellationRate: number;
|
|
2096
|
+
noShowRate: number;
|
|
2097
|
+
averageBookedTime: number;
|
|
2098
|
+
averageActualTime: number;
|
|
2099
|
+
timeEfficiency: number;
|
|
2100
|
+
totalRevenue: number;
|
|
2101
|
+
averageRevenuePerAppointment: number;
|
|
2102
|
+
currency: string;
|
|
2103
|
+
topProcedures: Array<{
|
|
2104
|
+
procedureId: string;
|
|
2105
|
+
procedureName: string;
|
|
2106
|
+
count: number;
|
|
2107
|
+
revenue: number;
|
|
2108
|
+
}>;
|
|
2109
|
+
patientRetentionRate: number;
|
|
2110
|
+
uniquePatients: number;
|
|
2111
|
+
}
|
|
2112
|
+
/**
|
|
2113
|
+
* Procedure Analytics
|
|
2114
|
+
* Comprehensive metrics for procedure performance
|
|
2115
|
+
*/
|
|
2116
|
+
interface ProcedureAnalytics extends BaseMetrics {
|
|
2117
|
+
procedureId: string;
|
|
2118
|
+
procedureName: string;
|
|
2119
|
+
procedureFamily: string;
|
|
2120
|
+
categoryName: string;
|
|
2121
|
+
subcategoryName: string;
|
|
2122
|
+
technologyName: string;
|
|
2123
|
+
totalAppointments: number;
|
|
2124
|
+
completedAppointments: number;
|
|
2125
|
+
canceledAppointments: number;
|
|
2126
|
+
noShowAppointments: number;
|
|
2127
|
+
cancellationRate: number;
|
|
2128
|
+
noShowRate: number;
|
|
2129
|
+
averageCost: number;
|
|
2130
|
+
totalRevenue: number;
|
|
2131
|
+
averageRevenuePerAppointment: number;
|
|
2132
|
+
currency: string;
|
|
2133
|
+
averageBookedDuration: number;
|
|
2134
|
+
averageActualDuration: number;
|
|
2135
|
+
productUsage: Array<{
|
|
2136
|
+
productId: string;
|
|
2137
|
+
productName: string;
|
|
2138
|
+
brandName: string;
|
|
2139
|
+
totalQuantity: number;
|
|
2140
|
+
totalRevenue: number;
|
|
2141
|
+
usageCount: number;
|
|
2142
|
+
}>;
|
|
2143
|
+
}
|
|
2144
|
+
/**
|
|
2145
|
+
* Time Efficiency Metrics
|
|
2146
|
+
* Analysis of booked time vs actual time spent
|
|
2147
|
+
*/
|
|
2148
|
+
interface TimeEfficiencyMetrics {
|
|
2149
|
+
totalAppointments: number;
|
|
2150
|
+
appointmentsWithActualTime: number;
|
|
2151
|
+
averageBookedDuration: number;
|
|
2152
|
+
averageActualDuration: number;
|
|
2153
|
+
averageEfficiency: number;
|
|
2154
|
+
totalOverrun: number;
|
|
2155
|
+
totalUnderutilization: number;
|
|
2156
|
+
averageOverrun: number;
|
|
2157
|
+
averageUnderutilization: number;
|
|
2158
|
+
efficiencyDistribution: Array<{
|
|
2159
|
+
range: string;
|
|
2160
|
+
count: number;
|
|
2161
|
+
percentage: number;
|
|
2162
|
+
}>;
|
|
2163
|
+
}
|
|
2164
|
+
/**
|
|
2165
|
+
* Cancellation Metrics
|
|
2166
|
+
* Analysis of appointment cancellations
|
|
2167
|
+
*/
|
|
2168
|
+
interface CancellationMetrics {
|
|
2169
|
+
entityId: string;
|
|
2170
|
+
entityName: string;
|
|
2171
|
+
entityType: EntityType;
|
|
2172
|
+
totalAppointments: number;
|
|
2173
|
+
canceledAppointments: number;
|
|
2174
|
+
cancellationRate: number;
|
|
2175
|
+
canceledByPatient: number;
|
|
2176
|
+
canceledByClinic: number;
|
|
2177
|
+
canceledByPractitioner: number;
|
|
2178
|
+
canceledRescheduled: number;
|
|
2179
|
+
averageCancellationLeadTime: number;
|
|
2180
|
+
cancellationReasons: Array<{
|
|
2181
|
+
reason: string;
|
|
2182
|
+
count: number;
|
|
2183
|
+
percentage: number;
|
|
2184
|
+
}>;
|
|
2185
|
+
practitionerId?: string;
|
|
2186
|
+
practitionerName?: string;
|
|
2187
|
+
}
|
|
2188
|
+
/**
|
|
2189
|
+
* No-Show Metrics
|
|
2190
|
+
* Analysis of appointment no-shows
|
|
2191
|
+
*/
|
|
2192
|
+
interface NoShowMetrics {
|
|
2193
|
+
entityId: string;
|
|
2194
|
+
entityName: string;
|
|
2195
|
+
entityType: EntityType;
|
|
2196
|
+
totalAppointments: number;
|
|
2197
|
+
noShowAppointments: number;
|
|
2198
|
+
noShowRate: number;
|
|
2199
|
+
practitionerId?: string;
|
|
2200
|
+
practitionerName?: string;
|
|
2201
|
+
}
|
|
2202
|
+
/**
|
|
2203
|
+
* Revenue Metrics
|
|
2204
|
+
* Financial analysis and revenue tracking
|
|
2205
|
+
*/
|
|
2206
|
+
interface RevenueMetrics {
|
|
2207
|
+
totalRevenue: number;
|
|
2208
|
+
averageRevenuePerAppointment: number;
|
|
2209
|
+
totalAppointments: number;
|
|
2210
|
+
completedAppointments: number;
|
|
2211
|
+
currency: string;
|
|
2212
|
+
revenueByStatus: Partial<Record<AppointmentStatus, number>>;
|
|
2213
|
+
revenueByPaymentStatus: Partial<Record<PaymentStatus, number>>;
|
|
2214
|
+
unpaidRevenue: number;
|
|
2215
|
+
refundedRevenue: number;
|
|
2216
|
+
totalTax: number;
|
|
2217
|
+
totalSubtotal: number;
|
|
2218
|
+
}
|
|
2219
|
+
/**
|
|
2220
|
+
* Revenue Trend
|
|
2221
|
+
* Revenue data over time
|
|
2222
|
+
*/
|
|
2223
|
+
interface RevenueTrend {
|
|
2224
|
+
period: string;
|
|
2225
|
+
startDate: Date;
|
|
2226
|
+
endDate: Date;
|
|
2227
|
+
revenue: number;
|
|
2228
|
+
appointmentCount: number;
|
|
2229
|
+
averageRevenue: number;
|
|
2230
|
+
currency?: string;
|
|
2231
|
+
previousPeriod?: {
|
|
2232
|
+
revenue: number;
|
|
2233
|
+
appointmentCount: number;
|
|
2234
|
+
percentageChange: number;
|
|
2235
|
+
direction: 'up' | 'down' | 'stable';
|
|
2236
|
+
};
|
|
2237
|
+
}
|
|
2238
|
+
/**
|
|
2239
|
+
* Duration Trend
|
|
2240
|
+
* Appointment duration trends over time
|
|
2241
|
+
*/
|
|
2242
|
+
interface DurationTrend {
|
|
2243
|
+
period: string;
|
|
2244
|
+
startDate: Date;
|
|
2245
|
+
endDate: Date;
|
|
2246
|
+
averageBookedDuration: number;
|
|
2247
|
+
averageActualDuration: number;
|
|
2248
|
+
averageEfficiency: number;
|
|
2249
|
+
appointmentCount: number;
|
|
2250
|
+
previousPeriod?: {
|
|
2251
|
+
averageBookedDuration: number;
|
|
2252
|
+
averageActualDuration: number;
|
|
2253
|
+
averageEfficiency: number;
|
|
2254
|
+
efficiencyPercentageChange: number;
|
|
2255
|
+
direction: 'up' | 'down' | 'stable';
|
|
2256
|
+
};
|
|
2257
|
+
}
|
|
2258
|
+
/**
|
|
2259
|
+
* Appointment Count Trend
|
|
2260
|
+
* Appointment count trends over time
|
|
2261
|
+
*/
|
|
2262
|
+
interface AppointmentTrend {
|
|
2263
|
+
period: string;
|
|
2264
|
+
startDate: Date;
|
|
2265
|
+
endDate: Date;
|
|
2266
|
+
totalAppointments: number;
|
|
2267
|
+
completedAppointments: number;
|
|
2268
|
+
canceledAppointments: number;
|
|
2269
|
+
noShowAppointments: number;
|
|
2270
|
+
pendingAppointments: number;
|
|
2271
|
+
confirmedAppointments: number;
|
|
2272
|
+
previousPeriod?: {
|
|
2273
|
+
totalAppointments: number;
|
|
2274
|
+
completedAppointments: number;
|
|
2275
|
+
percentageChange: number;
|
|
2276
|
+
direction: 'up' | 'down' | 'stable';
|
|
2277
|
+
};
|
|
2278
|
+
}
|
|
2279
|
+
/**
|
|
2280
|
+
* Cancellation Rate Trend
|
|
2281
|
+
* Cancellation and no-show rate trends over time
|
|
2282
|
+
*/
|
|
2283
|
+
interface CancellationRateTrend {
|
|
2284
|
+
period: string;
|
|
2285
|
+
startDate: Date;
|
|
2286
|
+
endDate: Date;
|
|
2287
|
+
cancellationRate: number;
|
|
2288
|
+
noShowRate: number;
|
|
2289
|
+
totalAppointments: number;
|
|
2290
|
+
canceledAppointments: number;
|
|
2291
|
+
noShowAppointments: number;
|
|
2292
|
+
previousPeriod?: {
|
|
2293
|
+
cancellationRate: number;
|
|
2294
|
+
noShowRate: number;
|
|
2295
|
+
cancellationRateChange: number;
|
|
2296
|
+
noShowRateChange: number;
|
|
2297
|
+
direction: 'up' | 'down' | 'stable';
|
|
2298
|
+
};
|
|
2299
|
+
}
|
|
2300
|
+
/**
|
|
2301
|
+
* Review Trend
|
|
2302
|
+
* Review rating and recommendation trends over time
|
|
2303
|
+
*/
|
|
2304
|
+
interface ReviewTrend {
|
|
2305
|
+
period: string;
|
|
2306
|
+
startDate: Date;
|
|
2307
|
+
endDate: Date;
|
|
2308
|
+
averageRating: number;
|
|
2309
|
+
recommendationRate: number;
|
|
2310
|
+
totalReviews: number;
|
|
2311
|
+
practitionerAverage?: number;
|
|
2312
|
+
procedureAverage?: number;
|
|
2313
|
+
previousPeriod?: {
|
|
2314
|
+
averageRating: number;
|
|
2315
|
+
recommendationRate: number;
|
|
2316
|
+
percentageChange: number;
|
|
2317
|
+
direction: 'up' | 'down' | 'stable';
|
|
2318
|
+
};
|
|
2319
|
+
entityId?: string;
|
|
2320
|
+
entityName?: string;
|
|
2321
|
+
}
|
|
2322
|
+
/**
|
|
2323
|
+
* Product Usage Metrics
|
|
2324
|
+
* Analysis of product usage in appointments
|
|
2325
|
+
*/
|
|
2326
|
+
interface ProductUsageMetrics {
|
|
2327
|
+
productId: string;
|
|
2328
|
+
productName: string;
|
|
2329
|
+
brandId: string;
|
|
2330
|
+
brandName: string;
|
|
2331
|
+
totalQuantity: number;
|
|
2332
|
+
totalRevenue: number;
|
|
2333
|
+
averagePrice: number;
|
|
2334
|
+
currency: string;
|
|
2335
|
+
usageCount: number;
|
|
2336
|
+
averageQuantityPerAppointment: number;
|
|
2337
|
+
usageByProcedure: Array<{
|
|
2338
|
+
procedureId: string;
|
|
2339
|
+
procedureName: string;
|
|
2340
|
+
count: number;
|
|
2341
|
+
totalQuantity: number;
|
|
2342
|
+
}>;
|
|
2343
|
+
}
|
|
2344
|
+
/**
|
|
2345
|
+
* Product Revenue Metrics
|
|
2346
|
+
* Revenue contribution by product
|
|
2347
|
+
*/
|
|
2348
|
+
interface ProductRevenueMetrics {
|
|
2349
|
+
productId: string;
|
|
2350
|
+
productName: string;
|
|
2351
|
+
brandName: string;
|
|
2352
|
+
totalRevenue: number;
|
|
2353
|
+
currency: string;
|
|
2354
|
+
usageCount: number;
|
|
2355
|
+
averageRevenuePerUsage: number;
|
|
2356
|
+
}
|
|
2357
|
+
/**
|
|
2358
|
+
* Product Usage by Procedure
|
|
2359
|
+
* Product usage patterns for specific procedures
|
|
2360
|
+
*/
|
|
2361
|
+
interface ProductUsageByProcedure {
|
|
2362
|
+
procedureId: string;
|
|
2363
|
+
procedureName: string;
|
|
2364
|
+
products: Array<{
|
|
2365
|
+
productId: string;
|
|
2366
|
+
productName: string;
|
|
2367
|
+
brandName: string;
|
|
2368
|
+
totalQuantity: number;
|
|
2369
|
+
totalRevenue: number;
|
|
2370
|
+
usageCount: number;
|
|
2371
|
+
}>;
|
|
2372
|
+
}
|
|
2373
|
+
/**
|
|
2374
|
+
* Patient Analytics
|
|
2375
|
+
* Comprehensive patient metrics
|
|
2376
|
+
*/
|
|
2377
|
+
interface PatientAnalytics {
|
|
2378
|
+
patientId: string;
|
|
2379
|
+
patientName: string;
|
|
2380
|
+
totalAppointments: number;
|
|
2381
|
+
completedAppointments: number;
|
|
2382
|
+
canceledAppointments: number;
|
|
2383
|
+
noShowAppointments: number;
|
|
2384
|
+
cancellationRate: number;
|
|
2385
|
+
noShowRate: number;
|
|
2386
|
+
totalRevenue: number;
|
|
2387
|
+
averageRevenuePerAppointment: number;
|
|
2388
|
+
currency: string;
|
|
2389
|
+
lifetimeValue: number;
|
|
2390
|
+
firstAppointmentDate: Date | null;
|
|
2391
|
+
lastAppointmentDate: Date | null;
|
|
2392
|
+
averageDaysBetweenAppointments: number | null;
|
|
2393
|
+
uniquePractitioners: number;
|
|
2394
|
+
uniqueClinics: number;
|
|
2395
|
+
favoriteProcedures: Array<{
|
|
2396
|
+
procedureId: string;
|
|
2397
|
+
procedureName: string;
|
|
2398
|
+
count: number;
|
|
2399
|
+
}>;
|
|
2400
|
+
}
|
|
2401
|
+
/**
|
|
2402
|
+
* Patient Lifetime Value Metrics
|
|
2403
|
+
* Patient value analysis
|
|
2404
|
+
*/
|
|
2405
|
+
interface PatientLifetimeValueMetrics {
|
|
2406
|
+
totalPatients: number;
|
|
2407
|
+
averageLifetimeValue: number;
|
|
2408
|
+
currency: string;
|
|
2409
|
+
topPatients: Array<{
|
|
2410
|
+
patientId: string;
|
|
2411
|
+
patientName: string;
|
|
2412
|
+
lifetimeValue: number;
|
|
2413
|
+
appointmentCount: number;
|
|
2414
|
+
}>;
|
|
2415
|
+
valueDistribution: Array<{
|
|
2416
|
+
range: string;
|
|
2417
|
+
count: number;
|
|
2418
|
+
percentage: number;
|
|
2419
|
+
}>;
|
|
2420
|
+
}
|
|
2421
|
+
/**
|
|
2422
|
+
* Patient Retention Metrics
|
|
2423
|
+
* Patient retention and return analysis
|
|
2424
|
+
*/
|
|
2425
|
+
interface PatientRetentionMetrics {
|
|
2426
|
+
totalPatients: number;
|
|
2427
|
+
newPatients: number;
|
|
2428
|
+
returningPatients: number;
|
|
2429
|
+
retentionRate: number;
|
|
2430
|
+
averageAppointmentsPerPatient: number;
|
|
2431
|
+
patientsByAppointmentCount: Array<{
|
|
2432
|
+
appointmentCount: number;
|
|
2433
|
+
patientCount: number;
|
|
2434
|
+
percentage: number;
|
|
2435
|
+
}>;
|
|
2436
|
+
}
|
|
2437
|
+
/**
|
|
2438
|
+
* Cost Per Patient Metrics
|
|
2439
|
+
* Cost analysis per patient
|
|
2440
|
+
*/
|
|
2441
|
+
interface CostPerPatientMetrics {
|
|
2442
|
+
totalPatients: number;
|
|
2443
|
+
totalRevenue: number;
|
|
2444
|
+
averageCostPerPatient: number;
|
|
2445
|
+
currency: string;
|
|
2446
|
+
costDistribution: Array<{
|
|
2447
|
+
range: string;
|
|
2448
|
+
patientCount: number;
|
|
2449
|
+
percentage: number;
|
|
2450
|
+
}>;
|
|
2451
|
+
patientCosts?: Array<{
|
|
2452
|
+
patientId: string;
|
|
2453
|
+
patientName: string;
|
|
2454
|
+
totalCost: number;
|
|
2455
|
+
appointmentCount: number;
|
|
2456
|
+
averageCost: number;
|
|
2457
|
+
}>;
|
|
2458
|
+
}
|
|
2459
|
+
/**
|
|
2460
|
+
* Payment Status Breakdown
|
|
2461
|
+
* Analysis of payment statuses
|
|
2462
|
+
*/
|
|
2463
|
+
interface PaymentStatusBreakdown {
|
|
2464
|
+
totalAppointments: number;
|
|
2465
|
+
byStatus: Partial<Record<PaymentStatus, {
|
|
2466
|
+
count: number;
|
|
2467
|
+
percentage: number;
|
|
2468
|
+
totalRevenue: number;
|
|
2469
|
+
}>>;
|
|
2470
|
+
unpaidCount: number;
|
|
2471
|
+
unpaidRevenue: number;
|
|
2472
|
+
paidCount: number;
|
|
2473
|
+
paidRevenue: number;
|
|
2474
|
+
partiallyPaidCount: number;
|
|
2475
|
+
partiallyPaidRevenue: number;
|
|
2476
|
+
refundedCount: number;
|
|
2477
|
+
refundedRevenue: number;
|
|
2478
|
+
}
|
|
2479
|
+
/**
|
|
2480
|
+
* Clinic Analytics
|
|
2481
|
+
* Comprehensive clinic performance metrics
|
|
2482
|
+
*/
|
|
2483
|
+
interface ClinicAnalytics {
|
|
2484
|
+
clinicBranchId: string;
|
|
2485
|
+
clinicName: string;
|
|
2486
|
+
totalAppointments: number;
|
|
2487
|
+
completedAppointments: number;
|
|
2488
|
+
canceledAppointments: number;
|
|
2489
|
+
noShowAppointments: number;
|
|
2490
|
+
cancellationRate: number;
|
|
2491
|
+
noShowRate: number;
|
|
2492
|
+
totalRevenue: number;
|
|
2493
|
+
averageRevenuePerAppointment: number;
|
|
2494
|
+
currency: string;
|
|
2495
|
+
practitionerCount: number;
|
|
2496
|
+
patientCount: number;
|
|
2497
|
+
procedureCount: number;
|
|
2498
|
+
topPractitioners: Array<{
|
|
2499
|
+
practitionerId: string;
|
|
2500
|
+
practitionerName: string;
|
|
2501
|
+
appointmentCount: number;
|
|
2502
|
+
revenue: number;
|
|
2503
|
+
}>;
|
|
2504
|
+
topProcedures: Array<{
|
|
2505
|
+
procedureId: string;
|
|
2506
|
+
procedureName: string;
|
|
2507
|
+
appointmentCount: number;
|
|
2508
|
+
revenue: number;
|
|
2509
|
+
}>;
|
|
2510
|
+
}
|
|
2511
|
+
/**
|
|
2512
|
+
* Clinic Comparison Metrics
|
|
2513
|
+
* Comparison data for multiple clinics
|
|
2514
|
+
*/
|
|
2515
|
+
interface ClinicComparisonMetrics {
|
|
2516
|
+
clinicBranchId: string;
|
|
2517
|
+
clinicName: string;
|
|
2518
|
+
totalAppointments: number;
|
|
2519
|
+
completedAppointments: number;
|
|
2520
|
+
cancellationRate: number;
|
|
2521
|
+
noShowRate: number;
|
|
2522
|
+
totalRevenue: number;
|
|
2523
|
+
averageRevenuePerAppointment: number;
|
|
2524
|
+
practitionerCount: number;
|
|
2525
|
+
patientCount: number;
|
|
2526
|
+
efficiency: number;
|
|
2527
|
+
}
|
|
2528
|
+
/**
|
|
2529
|
+
* Procedure Popularity
|
|
2530
|
+
* Popularity metrics for procedures
|
|
2531
|
+
*/
|
|
2532
|
+
interface ProcedurePopularity {
|
|
2533
|
+
procedureId: string;
|
|
2534
|
+
procedureName: string;
|
|
2535
|
+
categoryName: string;
|
|
2536
|
+
subcategoryName: string;
|
|
2537
|
+
technologyName: string;
|
|
2538
|
+
appointmentCount: number;
|
|
2539
|
+
completedCount: number;
|
|
2540
|
+
rank: number;
|
|
2541
|
+
}
|
|
2542
|
+
/**
|
|
2543
|
+
* Procedure Profitability
|
|
2544
|
+
* Profitability metrics for procedures
|
|
2545
|
+
*/
|
|
2546
|
+
interface ProcedureProfitability {
|
|
2547
|
+
procedureId: string;
|
|
2548
|
+
procedureName: string;
|
|
2549
|
+
categoryName: string;
|
|
2550
|
+
subcategoryName: string;
|
|
2551
|
+
technologyName: string;
|
|
2552
|
+
totalRevenue: number;
|
|
2553
|
+
averageRevenue: number;
|
|
2554
|
+
appointmentCount: number;
|
|
2555
|
+
rank: number;
|
|
2556
|
+
}
|
|
2557
|
+
/**
|
|
2558
|
+
* Cancellation Reason Statistics
|
|
2559
|
+
* Breakdown of cancellation reasons
|
|
2560
|
+
*/
|
|
2561
|
+
interface CancellationReasonStats {
|
|
2562
|
+
reason: string;
|
|
2563
|
+
count: number;
|
|
2564
|
+
percentage: number;
|
|
2565
|
+
averageLeadTime: number;
|
|
2566
|
+
}
|
|
2567
|
+
/**
|
|
2568
|
+
* Dashboard Analytics
|
|
2569
|
+
* Comprehensive dashboard data aggregation
|
|
2570
|
+
*/
|
|
2571
|
+
interface DashboardAnalytics {
|
|
2572
|
+
overview: {
|
|
2573
|
+
totalAppointments: number;
|
|
2574
|
+
completedAppointments: number;
|
|
2575
|
+
canceledAppointments: number;
|
|
2576
|
+
noShowAppointments: number;
|
|
2577
|
+
pendingAppointments: number;
|
|
2578
|
+
confirmedAppointments: number;
|
|
2579
|
+
totalRevenue: number;
|
|
2580
|
+
averageRevenuePerAppointment: number;
|
|
2581
|
+
currency: string;
|
|
2582
|
+
uniquePatients: number;
|
|
2583
|
+
uniquePractitioners: number;
|
|
2584
|
+
uniqueProcedures: number;
|
|
2585
|
+
cancellationRate: number;
|
|
2586
|
+
noShowRate: number;
|
|
2587
|
+
};
|
|
2588
|
+
practitionerMetrics: PractitionerAnalytics[];
|
|
2589
|
+
procedureMetrics: ProcedureAnalytics[];
|
|
2590
|
+
cancellationMetrics: CancellationMetrics;
|
|
2591
|
+
noShowMetrics: NoShowMetrics;
|
|
2592
|
+
revenueTrends: RevenueTrend[];
|
|
2593
|
+
timeEfficiency: TimeEfficiencyMetrics;
|
|
2594
|
+
topProducts: ProductUsageMetrics[];
|
|
2595
|
+
recentActivity: Array<{
|
|
2596
|
+
type: 'appointment' | 'cancellation' | 'completion' | 'no_show';
|
|
2597
|
+
date: Date;
|
|
2598
|
+
description: string;
|
|
2599
|
+
entityId?: string;
|
|
2600
|
+
entityName?: string;
|
|
2601
|
+
}>;
|
|
2602
|
+
}
|
|
2603
|
+
|
|
2604
|
+
/**
|
|
2605
|
+
* Period type for analytics snapshots
|
|
2606
|
+
*/
|
|
2607
|
+
type AnalyticsPeriod = 'daily' | 'weekly' | 'monthly' | 'yearly' | 'all_time';
|
|
2608
|
+
/**
|
|
2609
|
+
* Analytics document metadata
|
|
2610
|
+
*/
|
|
2611
|
+
interface AnalyticsMetadata {
|
|
2612
|
+
clinicBranchId: string;
|
|
2613
|
+
period: AnalyticsPeriod;
|
|
2614
|
+
periodStart: Date;
|
|
2615
|
+
periodEnd: Date;
|
|
2616
|
+
computedAt: Timestamp;
|
|
2617
|
+
computedBy: 'cloud_function' | 'manual';
|
|
2618
|
+
version: string;
|
|
2619
|
+
}
|
|
2620
|
+
/**
|
|
2621
|
+
* Stored Practitioner Analytics
|
|
2622
|
+
* Stored in: clinics/{clinicBranchId}/analytics/practitioners/{practitionerId}/{period}
|
|
2623
|
+
*/
|
|
2624
|
+
interface StoredPractitionerAnalytics extends PractitionerAnalytics {
|
|
2625
|
+
metadata: AnalyticsMetadata;
|
|
2626
|
+
}
|
|
2627
|
+
/**
|
|
2628
|
+
* Stored Procedure Analytics
|
|
2629
|
+
* Stored in: clinics/{clinicBranchId}/analytics/procedures/{procedureId}/{period}
|
|
2630
|
+
*/
|
|
2631
|
+
interface StoredProcedureAnalytics extends ProcedureAnalytics {
|
|
2632
|
+
metadata: AnalyticsMetadata;
|
|
2633
|
+
}
|
|
2634
|
+
/**
|
|
2635
|
+
* Stored Clinic Analytics
|
|
2636
|
+
* Stored in: clinics/{clinicBranchId}/analytics/clinic/{period}
|
|
2637
|
+
*/
|
|
2638
|
+
interface StoredClinicAnalytics extends ClinicAnalytics {
|
|
2639
|
+
metadata: AnalyticsMetadata;
|
|
2640
|
+
}
|
|
2641
|
+
/**
|
|
2642
|
+
* Stored Dashboard Analytics
|
|
2643
|
+
* Stored in: clinics/{clinicBranchId}/analytics/dashboard/{period}
|
|
2644
|
+
*/
|
|
2645
|
+
interface StoredDashboardAnalytics extends DashboardAnalytics {
|
|
2646
|
+
metadata: AnalyticsMetadata;
|
|
2647
|
+
}
|
|
2648
|
+
/**
|
|
2649
|
+
* Stored Time Efficiency Metrics
|
|
2650
|
+
* Stored in: clinics/{clinicBranchId}/analytics/time_efficiency/{period}
|
|
2651
|
+
*/
|
|
2652
|
+
interface StoredTimeEfficiencyMetrics extends TimeEfficiencyMetrics {
|
|
2653
|
+
metadata: AnalyticsMetadata;
|
|
2654
|
+
}
|
|
2655
|
+
/**
|
|
2656
|
+
* Stored Cancellation Metrics
|
|
2657
|
+
* Stored in: clinics/{clinicBranchId}/analytics/cancellations/{entityType}/{period}
|
|
2658
|
+
*/
|
|
2659
|
+
interface StoredCancellationMetrics extends CancellationMetrics {
|
|
2660
|
+
metadata: AnalyticsMetadata;
|
|
2661
|
+
}
|
|
2662
|
+
/**
|
|
2663
|
+
* Stored No-Show Metrics
|
|
2664
|
+
* Stored in: clinics/{clinicBranchId}/analytics/no_shows/{entityType}/{period}
|
|
2665
|
+
*/
|
|
2666
|
+
interface StoredNoShowMetrics extends NoShowMetrics {
|
|
2667
|
+
metadata: AnalyticsMetadata;
|
|
2668
|
+
}
|
|
2669
|
+
/**
|
|
2670
|
+
* Stored Revenue Metrics
|
|
2671
|
+
* Stored in: clinics/{clinicBranchId}/analytics/revenue/{period}
|
|
2672
|
+
*/
|
|
2673
|
+
interface StoredRevenueMetrics extends RevenueMetrics {
|
|
2674
|
+
metadata: AnalyticsMetadata;
|
|
2675
|
+
}
|
|
2676
|
+
/**
|
|
2677
|
+
* Collection names for stored analytics
|
|
2678
|
+
*/
|
|
2679
|
+
declare const ANALYTICS_COLLECTION = "analytics";
|
|
2680
|
+
declare const PRACTITIONER_ANALYTICS_SUBCOLLECTION = "practitioners";
|
|
2681
|
+
declare const PROCEDURE_ANALYTICS_SUBCOLLECTION = "procedures";
|
|
2682
|
+
declare const CLINIC_ANALYTICS_SUBCOLLECTION = "clinic";
|
|
2683
|
+
declare const DASHBOARD_ANALYTICS_SUBCOLLECTION = "dashboard";
|
|
2684
|
+
declare const TIME_EFFICIENCY_ANALYTICS_SUBCOLLECTION = "time_efficiency";
|
|
2685
|
+
declare const CANCELLATION_ANALYTICS_SUBCOLLECTION = "cancellations";
|
|
2686
|
+
declare const NO_SHOW_ANALYTICS_SUBCOLLECTION = "no_shows";
|
|
2687
|
+
declare const REVENUE_ANALYTICS_SUBCOLLECTION = "revenue";
|
|
2688
|
+
/**
|
|
2689
|
+
* Options for reading stored analytics
|
|
2690
|
+
*/
|
|
2691
|
+
interface ReadStoredAnalyticsOptions {
|
|
2692
|
+
/**
|
|
2693
|
+
* Whether to use cached/pre-computed data
|
|
2694
|
+
* @default true
|
|
2695
|
+
*/
|
|
2696
|
+
useCache?: boolean;
|
|
2697
|
+
/**
|
|
2698
|
+
* Maximum age of cached data in hours before recalculating
|
|
2699
|
+
* @default 12
|
|
2700
|
+
*/
|
|
2701
|
+
maxCacheAgeHours?: number;
|
|
2702
|
+
/**
|
|
2703
|
+
* Period to read
|
|
2704
|
+
* @default 'all_time'
|
|
2705
|
+
*/
|
|
2706
|
+
period?: AnalyticsPeriod;
|
|
2707
|
+
/**
|
|
2708
|
+
* Date range for the period (calculated if not provided)
|
|
2709
|
+
*/
|
|
2710
|
+
dateRange?: AnalyticsDateRange;
|
|
2711
|
+
/**
|
|
2712
|
+
* Clinic branch ID (required for reading stored analytics)
|
|
2713
|
+
*/
|
|
2714
|
+
clinicBranchId?: string;
|
|
2715
|
+
}
|
|
2716
|
+
|
|
2717
|
+
/**
|
|
2718
|
+
* Base interface for grouped analytics results
|
|
2719
|
+
* All grouped analytics share common entity identification
|
|
2720
|
+
*/
|
|
2721
|
+
interface GroupedAnalyticsBase {
|
|
2722
|
+
entityId: string;
|
|
2723
|
+
entityName: string;
|
|
2724
|
+
entityType: EntityType;
|
|
2725
|
+
}
|
|
2726
|
+
/**
|
|
2727
|
+
* Review metrics for grouped analytics
|
|
2728
|
+
* Note: This is a simplified version for grouped analytics.
|
|
2729
|
+
* For full review analytics, see ReviewAnalyticsService.ReviewMetrics
|
|
2730
|
+
*/
|
|
2731
|
+
interface ReviewMetrics {
|
|
2732
|
+
totalReviews: number;
|
|
2733
|
+
averageRating: number;
|
|
2734
|
+
recommendationRate: number;
|
|
2735
|
+
ratingDifference?: number;
|
|
2736
|
+
recommendationDifference?: number;
|
|
2737
|
+
}
|
|
2738
|
+
/**
|
|
2739
|
+
* Grouped Revenue Metrics
|
|
2740
|
+
* Revenue analytics grouped by clinic, practitioner, procedure, or patient
|
|
2741
|
+
*/
|
|
2742
|
+
interface GroupedRevenueMetrics extends GroupedAnalyticsBase {
|
|
2743
|
+
totalRevenue: number;
|
|
2744
|
+
averageRevenuePerAppointment: number;
|
|
2745
|
+
totalAppointments: number;
|
|
2746
|
+
completedAppointments: number;
|
|
2747
|
+
currency: string;
|
|
2748
|
+
unpaidRevenue: number;
|
|
2749
|
+
refundedRevenue: number;
|
|
2750
|
+
totalTax: number;
|
|
2751
|
+
totalSubtotal: number;
|
|
2752
|
+
practitionerId?: string;
|
|
2753
|
+
practitionerName?: string;
|
|
2754
|
+
reviewMetrics?: ReviewMetrics;
|
|
2755
|
+
}
|
|
2756
|
+
/**
|
|
2757
|
+
* Grouped Product Usage Metrics
|
|
2758
|
+
* Product usage analytics grouped by clinic, practitioner, procedure, or patient
|
|
2759
|
+
*/
|
|
2760
|
+
interface GroupedProductUsageMetrics extends GroupedAnalyticsBase {
|
|
2761
|
+
totalProductsUsed: number;
|
|
2762
|
+
uniqueProducts: number;
|
|
2763
|
+
totalProductRevenue: number;
|
|
2764
|
+
totalProductQuantity: number;
|
|
2765
|
+
averageProductsPerAppointment: number;
|
|
2766
|
+
topProducts: Array<{
|
|
2767
|
+
productId: string;
|
|
2768
|
+
productName: string;
|
|
2769
|
+
brandName: string;
|
|
2770
|
+
totalQuantity: number;
|
|
2771
|
+
totalRevenue: number;
|
|
2772
|
+
usageCount: number;
|
|
2773
|
+
}>;
|
|
2774
|
+
practitionerId?: string;
|
|
2775
|
+
practitionerName?: string;
|
|
2776
|
+
}
|
|
2777
|
+
/**
|
|
2778
|
+
* Grouped Patient Retention Metrics
|
|
2779
|
+
* Patient retention analytics grouped by clinic, practitioner, or procedure
|
|
2780
|
+
*/
|
|
2781
|
+
interface GroupedPatientRetentionMetrics extends GroupedAnalyticsBase {
|
|
2782
|
+
totalPatients: number;
|
|
2783
|
+
newPatients: number;
|
|
2784
|
+
returningPatients: number;
|
|
2785
|
+
retentionRate: number;
|
|
2786
|
+
averageAppointmentsPerPatient: number;
|
|
2787
|
+
patientsByAppointmentCount: Array<{
|
|
2788
|
+
appointmentCount: number;
|
|
2789
|
+
patientCount: number;
|
|
2790
|
+
percentage: number;
|
|
2791
|
+
}>;
|
|
2792
|
+
}
|
|
2793
|
+
/**
|
|
2794
|
+
* Grouped Time Efficiency Metrics
|
|
2795
|
+
* Time efficiency analytics grouped by clinic, practitioner, procedure, or patient
|
|
2796
|
+
*/
|
|
2797
|
+
interface GroupedTimeEfficiencyMetrics extends GroupedAnalyticsBase {
|
|
2798
|
+
totalAppointments: number;
|
|
2799
|
+
appointmentsWithActualTime: number;
|
|
2800
|
+
averageBookedDuration: number;
|
|
2801
|
+
averageActualDuration: number;
|
|
2802
|
+
averageEfficiency: number;
|
|
2803
|
+
totalOverrun: number;
|
|
2804
|
+
totalUnderutilization: number;
|
|
2805
|
+
averageOverrun: number;
|
|
2806
|
+
averageUnderutilization: number;
|
|
2807
|
+
practitionerId?: string;
|
|
2808
|
+
practitionerName?: string;
|
|
2809
|
+
}
|
|
2810
|
+
/**
|
|
2811
|
+
* Grouped Patient Behavior Metrics
|
|
2812
|
+
* Patient behavior (no-show, cancellation) grouped by clinic, practitioner, or procedure
|
|
2813
|
+
*/
|
|
2814
|
+
interface GroupedPatientBehaviorMetrics extends GroupedAnalyticsBase {
|
|
2815
|
+
totalPatients: number;
|
|
2816
|
+
patientsWithNoShows: number;
|
|
2817
|
+
patientsWithCancellations: number;
|
|
2818
|
+
averageNoShowRate: number;
|
|
2819
|
+
averageCancellationRate: number;
|
|
2820
|
+
topNoShowPatients: Array<{
|
|
2821
|
+
patientId: string;
|
|
2822
|
+
patientName: string;
|
|
2823
|
+
noShowCount: number;
|
|
2824
|
+
totalAppointments: number;
|
|
2825
|
+
noShowRate: number;
|
|
2826
|
+
}>;
|
|
2827
|
+
topCancellationPatients: Array<{
|
|
2828
|
+
patientId: string;
|
|
2829
|
+
patientName: string;
|
|
2830
|
+
cancellationCount: number;
|
|
2831
|
+
totalAppointments: number;
|
|
2832
|
+
cancellationRate: number;
|
|
2833
|
+
}>;
|
|
2834
|
+
}
|
|
2835
|
+
/**
|
|
2836
|
+
* Grouped Procedure Performance Metrics
|
|
2837
|
+
* Procedure performance grouped by clinic or practitioner
|
|
2838
|
+
*/
|
|
2839
|
+
interface GroupedProcedurePerformanceMetrics extends GroupedAnalyticsBase {
|
|
2840
|
+
totalProcedures: number;
|
|
2841
|
+
totalAppointments: number;
|
|
2842
|
+
completedAppointments: number;
|
|
2843
|
+
totalRevenue: number;
|
|
2844
|
+
averageRevenuePerProcedure: number;
|
|
2845
|
+
topProcedures: Array<{
|
|
2846
|
+
procedureId: string;
|
|
2847
|
+
procedureName: string;
|
|
2848
|
+
appointmentCount: number;
|
|
2849
|
+
revenue: number;
|
|
2850
|
+
cancellationRate: number;
|
|
2851
|
+
noShowRate: number;
|
|
2852
|
+
}>;
|
|
2853
|
+
}
|
|
2854
|
+
/**
|
|
2855
|
+
* Grouped Practitioner Performance Metrics
|
|
2856
|
+
* Practitioner performance grouped by clinic
|
|
2857
|
+
*/
|
|
2858
|
+
interface GroupedPractitionerPerformanceMetrics extends GroupedAnalyticsBase {
|
|
2859
|
+
totalPractitioners: number;
|
|
2860
|
+
totalAppointments: number;
|
|
2861
|
+
completedAppointments: number;
|
|
2862
|
+
totalRevenue: number;
|
|
2863
|
+
averageRevenuePerPractitioner: number;
|
|
2864
|
+
topPractitioners: Array<{
|
|
2865
|
+
practitionerId: string;
|
|
2866
|
+
practitionerName: string;
|
|
2867
|
+
appointmentCount: number;
|
|
2868
|
+
revenue: number;
|
|
2869
|
+
cancellationRate: number;
|
|
2870
|
+
noShowRate: number;
|
|
2871
|
+
timeEfficiency: number;
|
|
2872
|
+
}>;
|
|
2873
|
+
}
|
|
2874
|
+
|
|
2042
2875
|
/**
|
|
2043
2876
|
* Enumeracija koja definiše sve moguće tipove notifikacija
|
|
2044
2877
|
*/
|
|
@@ -3208,6 +4041,44 @@ declare class ReviewsAggregationService {
|
|
|
3208
4041
|
calculateEntityReviewInfo(entityId: string, entityType: "clinic" | "practitioner" | "procedure"): Promise<ClinicReviewInfo | PractitionerReviewInfo | ProcedureReviewInfo>;
|
|
3209
4042
|
}
|
|
3210
4043
|
|
|
4044
|
+
/**
|
|
4045
|
+
* Admin version of AnalyticsService that uses Firebase Admin SDK
|
|
4046
|
+
* This is intended for use in Cloud Functions and server-side code
|
|
4047
|
+
*/
|
|
4048
|
+
declare class AnalyticsAdminService {
|
|
4049
|
+
private analyticsService;
|
|
4050
|
+
private db;
|
|
4051
|
+
/**
|
|
4052
|
+
* Creates a new AnalyticsAdminService instance
|
|
4053
|
+
*
|
|
4054
|
+
* @param firestore - Admin Firestore instance (optional, defaults to admin.firestore())
|
|
4055
|
+
*/
|
|
4056
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
4057
|
+
/**
|
|
4058
|
+
* Creates an adapter for AppointmentService to work with admin SDK
|
|
4059
|
+
*/
|
|
4060
|
+
private createAppointmentServiceAdapter;
|
|
4061
|
+
getPractitionerAnalytics(practitionerId: string, dateRange?: AnalyticsDateRange, options?: any): Promise<PractitionerAnalytics>;
|
|
4062
|
+
getProcedureAnalytics(procedureId?: string, dateRange?: AnalyticsDateRange, options?: any): Promise<ProcedureAnalytics | ProcedureAnalytics[]>;
|
|
4063
|
+
getTimeEfficiencyMetrics(filters?: AnalyticsFilters, dateRange?: AnalyticsDateRange, options?: any): Promise<TimeEfficiencyMetrics>;
|
|
4064
|
+
getTimeEfficiencyMetricsByEntity(groupBy: EntityType, dateRange?: AnalyticsDateRange, filters?: AnalyticsFilters): Promise<GroupedTimeEfficiencyMetrics[]>;
|
|
4065
|
+
getCancellationMetrics(groupBy: EntityType, dateRange?: AnalyticsDateRange, options?: any): Promise<CancellationMetrics | CancellationMetrics[]>;
|
|
4066
|
+
getNoShowMetrics(groupBy: EntityType, dateRange?: AnalyticsDateRange, options?: any): Promise<NoShowMetrics | NoShowMetrics[]>;
|
|
4067
|
+
getRevenueMetrics(filters?: AnalyticsFilters, dateRange?: AnalyticsDateRange, options?: any): Promise<RevenueMetrics>;
|
|
4068
|
+
getRevenueMetricsByEntity(groupBy: EntityType, dateRange?: AnalyticsDateRange, filters?: AnalyticsFilters): Promise<GroupedRevenueMetrics[]>;
|
|
4069
|
+
getProductUsageMetrics(productId?: string, dateRange?: AnalyticsDateRange): Promise<ProductUsageMetrics | ProductUsageMetrics[]>;
|
|
4070
|
+
getProductUsageMetricsByEntity(groupBy: EntityType, dateRange?: AnalyticsDateRange, filters?: AnalyticsFilters): Promise<GroupedProductUsageMetrics[]>;
|
|
4071
|
+
getPatientAnalytics(patientId?: string, dateRange?: AnalyticsDateRange): Promise<PatientAnalytics | PatientAnalytics[]>;
|
|
4072
|
+
getPatientBehaviorMetricsByEntity(groupBy: 'clinic' | 'practitioner' | 'procedure' | 'technology', dateRange?: AnalyticsDateRange, filters?: AnalyticsFilters): Promise<GroupedPatientBehaviorMetrics[]>;
|
|
4073
|
+
getClinicAnalytics(clinicBranchId: string, dateRange?: AnalyticsDateRange): Promise<ClinicAnalytics | ClinicAnalytics[]>;
|
|
4074
|
+
getDashboardData(filters?: AnalyticsFilters, dateRange?: AnalyticsDateRange, options?: any): Promise<DashboardAnalytics>;
|
|
4075
|
+
/**
|
|
4076
|
+
* Expose fetchAppointments for direct access if needed
|
|
4077
|
+
* This method is used internally by AnalyticsService
|
|
4078
|
+
*/
|
|
4079
|
+
fetchAppointments(filters?: AnalyticsFilters, dateRange?: AnalyticsDateRange): Promise<any[]>;
|
|
4080
|
+
}
|
|
4081
|
+
|
|
3211
4082
|
/**
|
|
3212
4083
|
* Request parameters for calculating available booking slots
|
|
3213
4084
|
*/
|
|
@@ -3799,4 +4670,4 @@ declare class UserProfileAdminService {
|
|
|
3799
4670
|
initializePractitionerRole(userId: string): Promise<User>;
|
|
3800
4671
|
}
|
|
3801
4672
|
|
|
3802
|
-
export { type Appointment, AppointmentAggregationService, type AppointmentCancellationEmailData, type AppointmentConfirmationEmailData, type AppointmentEmailDataBase, AppointmentMailingService, type AppointmentReminderNotification, type AppointmentRequestedEmailData, type AppointmentRescheduledProposalEmailData, AppointmentStatus, type AvailableSlot, BaseMailingService, type BaseNotification, type BillingInfo, type BillingTransaction, BillingTransactionType, BookingAdmin, BookingAvailabilityCalculator, type BookingAvailabilityRequest, type BookingAvailabilityResponse, CalendarAdminService, type Clinic, type ClinicAdminNotificationData, ClinicAggregationService, type ClinicInfo, type ClinicLocation, type CreateBillingTransactionData, type DoctorInfo, DocumentManagerAdminService, type ExistingPractitionerInviteEmailData, ExistingPractitionerInviteMailingService, type FilledDocument, FilledFormsAggregationService, type InitializeAppointmentFormsResult, Logger, NOTIFICATIONS_COLLECTION, type NewMailgunClient$2 as NewMailgunClient, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, type OrchestrateAppointmentCreationData, PATIENTS_COLLECTION, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, PATIENT_SENSITIVE_INFO_COLLECTION, type PatientProfile as Patient, PatientAggregationService, PatientInstructionStatus, type PatientProfile, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsAdminService, type PatientSensitiveInfo, type PlanDetails, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, type PractitionerInvite, PractitionerInviteAggregationService, type PractitionerInviteEmailData, PractitionerInviteMailingService, PractitionerInviteStatus, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureSummaryInfo, type RequirementSourceProcedure, type Review, type ReviewAddedEmailData, type ReviewRequestEmailData, ReviewsAggregationService, type StripeTransactionData, SubscriptionStatus, type TimeInterval, UserProfileAdminService, UserRole, freeConsultationInfrastructure };
|
|
4673
|
+
export { ANALYTICS_COLLECTION, AnalyticsAdminService, type AnalyticsDateRange, type AnalyticsFilters, type AnalyticsMetadata, type AnalyticsPeriod, type Appointment, AppointmentAggregationService, type AppointmentCancellationEmailData, type AppointmentConfirmationEmailData, type AppointmentEmailDataBase, AppointmentMailingService, type AppointmentReminderNotification, type AppointmentRequestedEmailData, type AppointmentRescheduledProposalEmailData, AppointmentStatus, type AppointmentTrend, type AvailableSlot, BaseMailingService, type BaseMetrics, type BaseNotification, type BillingInfo, type BillingTransaction, BillingTransactionType, BookingAdmin, BookingAvailabilityCalculator, type BookingAvailabilityRequest, type BookingAvailabilityResponse, CANCELLATION_ANALYTICS_SUBCOLLECTION, CLINICS_COLLECTION, CLINIC_ANALYTICS_SUBCOLLECTION, CalendarAdminService, type CancellationMetrics, type CancellationRateTrend, type CancellationReasonStats, type Clinic, type ClinicAdminNotificationData, ClinicAggregationService, type ClinicAnalytics, type ClinicComparisonMetrics, type ClinicInfo, type ClinicLocation, type CostPerPatientMetrics, type CreateBillingTransactionData, DASHBOARD_ANALYTICS_SUBCOLLECTION, type DashboardAnalytics, type DoctorInfo, DocumentManagerAdminService, type DurationTrend, type EntityType, type ExistingPractitionerInviteEmailData, ExistingPractitionerInviteMailingService, type FilledDocument, FilledFormsAggregationService, type GroupedAnalyticsBase, type GroupedPatientBehaviorMetrics, type GroupedPatientRetentionMetrics, type GroupedPractitionerPerformanceMetrics, type GroupedProcedurePerformanceMetrics, type GroupedProductUsageMetrics, type GroupedRevenueMetrics, type GroupedTimeEfficiencyMetrics, type GroupingPeriod, type InitializeAppointmentFormsResult, Logger, NOTIFICATIONS_COLLECTION, NO_SHOW_ANALYTICS_SUBCOLLECTION, type NewMailgunClient$2 as NewMailgunClient, type NoShowMetrics, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, type OrchestrateAppointmentCreationData, PATIENTS_COLLECTION, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, PATIENT_SENSITIVE_INFO_COLLECTION, PRACTITIONER_ANALYTICS_SUBCOLLECTION, PROCEDURE_ANALYTICS_SUBCOLLECTION, type PatientProfile as Patient, PatientAggregationService, type PatientAnalytics, PatientInstructionStatus, type PatientLifetimeValueMetrics, type PatientProfile, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsAdminService, type PatientRetentionMetrics, type PatientSensitiveInfo, type PaymentStatusBreakdown, type PlanDetails, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, type PractitionerAnalytics, type PractitionerInvite, PractitionerInviteAggregationService, type PractitionerInviteEmailData, PractitionerInviteMailingService, PractitionerInviteStatus, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureAnalytics, type ProcedurePopularity, type ProcedureProfitability, type ProcedureSummaryInfo, type ProductRevenueMetrics, type ProductUsageByProcedure, type ProductUsageMetrics, REVENUE_ANALYTICS_SUBCOLLECTION, type ReadStoredAnalyticsOptions, type RequirementSourceProcedure, type RevenueMetrics, type RevenueTrend, type Review, type ReviewAddedEmailData, type ReviewMetrics, type ReviewRequestEmailData, type ReviewTrend, ReviewsAggregationService, type StoredCancellationMetrics, type StoredClinicAnalytics, type StoredDashboardAnalytics, type StoredNoShowMetrics, type StoredPractitionerAnalytics, type StoredProcedureAnalytics, type StoredRevenueMetrics, type StoredTimeEfficiencyMetrics, type StripeTransactionData, SubscriptionStatus, TIME_EFFICIENCY_ANALYTICS_SUBCOLLECTION, type TimeEfficiencyMetrics, type TimeInterval, type TrendPeriod, UserProfileAdminService, UserRole, freeConsultationInfrastructure };
|