@rinse-dental/open-dental 2.4.8 → 2.4.9

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.
@@ -1 +1 @@
1
- {"version":3,"file":"visit.d.ts","sourceRoot":"","sources":["../../src/transformers/visit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAKvD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,KAAK,CAiD1D"}
1
+ {"version":3,"file":"visit.d.ts","sourceRoot":"","sources":["../../src/transformers/visit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAKvD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,KAAK,CAkD1D"}
@@ -20,6 +20,7 @@ function appointmentToVisit(apt) {
20
20
  const duration = (apt.Pattern?.length || 0) * 5;
21
21
  const location = 'NF6YVFAXyRVXGi5nItqV';
22
22
  const display_ProvNum = apt.IsHygiene == 'true' ? apt.ProvHyg : apt.ProvNum;
23
+ const AptTypeNum = apt.AppointmentTypeNum == 0 ? updateAptTypeNum(apt.ProcDescript ?? '') : apt.AppointmentTypeNum;
23
24
  return {
24
25
  docRef: db.doc(`/patients/${apt.PatNum}/patientVisits/${apt.AptNum}`),
25
26
  ...apt,
@@ -31,7 +32,7 @@ function appointmentToVisit(apt) {
31
32
  duration: duration,
32
33
  ProvNum: display_ProvNum,
33
34
  ProviderDocRef: display_ProvNum != 0 ? db.doc(`/providers/${display_ProvNum}`) : undefined,
34
- VisitTypeDocRef: apt.AppointmentTypeNum != 0 ? db.doc(`/lookups/lookup_definitions/lookup_visitType/${apt.AppointmentTypeNum}`) : undefined,
35
+ VisitTypeDocRef: db.doc(`/lookups/lookup_definitions/lookup_visitType/${AptTypeNum}`),
35
36
  OpDocRef: apt.Op != 0 ? db.doc(`/locations/${location}/locationOperatories/${apt.Op}`) : undefined,
36
37
  date: moment_aptDateTime.format('YYYY-MM-DD'),
37
38
  dateTime: moment_aptDateTime.format(),
@@ -74,3 +75,25 @@ function normalizeStatus(status) {
74
75
  return 'Scheduled';
75
76
  return status;
76
77
  }
78
+ function updateAptTypeNum(ProcDescript) {
79
+ let aptTypeNum = 11; // Default: Treatment
80
+ if (ProcDescript.includes('PeriodicX') && ProcDescript.includes('Free White')) {
81
+ aptTypeNum = 23;
82
+ }
83
+ else if (ProcDescript.includes('PeriodicX')) {
84
+ aptTypeNum = 12;
85
+ }
86
+ else if ((ProcDescript.includes('Prophy') || ProcDescript.includes('ProChild')) && ProcDescript.includes('Free White')) {
87
+ aptTypeNum = 13;
88
+ }
89
+ else if ((ProcDescript.includes('Prophy') || ProcDescript.includes('ProChild'))) {
90
+ aptTypeNum = 3;
91
+ }
92
+ else if (ProcDescript.includes('SPT') && ProcDescript.includes('Free White')) {
93
+ aptTypeNum = 24;
94
+ }
95
+ else if (ProcDescript.includes('SPT')) {
96
+ aptTypeNum = 14;
97
+ }
98
+ return aptTypeNum;
99
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rinse-dental/open-dental",
3
- "version": "2.4.8",
3
+ "version": "2.4.9",
4
4
  "description": "A TypeScript library for easily accessing Open Dental APIs.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,6 +19,7 @@ export function appointmentToVisit(apt: Appointment): Visit {
19
19
  const duration = (apt.Pattern?.length || 0) * 5;
20
20
  const location = 'NF6YVFAXyRVXGi5nItqV';
21
21
  const display_ProvNum = apt.IsHygiene == 'true' ? apt.ProvHyg : apt.ProvNum;
22
+ const AptTypeNum = apt.AppointmentTypeNum == 0 ? updateAptTypeNum(apt.ProcDescript ?? '') : apt.AppointmentTypeNum;
22
23
 
23
24
  return {
24
25
  docRef: db.doc(`/patients/${apt.PatNum}/patientVisits/${apt.AptNum}`),
@@ -31,7 +32,7 @@ export function appointmentToVisit(apt: Appointment): Visit {
31
32
  duration: duration,
32
33
  ProvNum: display_ProvNum,
33
34
  ProviderDocRef: display_ProvNum != 0 ? db.doc(`/providers/${display_ProvNum}`) : undefined,
34
- VisitTypeDocRef: apt.AppointmentTypeNum != 0 ? db.doc(`/lookups/lookup_definitions/lookup_visitType/${apt.AppointmentTypeNum}`) : undefined,
35
+ VisitTypeDocRef: db.doc(`/lookups/lookup_definitions/lookup_visitType/${AptTypeNum}`),
35
36
  OpDocRef: apt.Op != 0 ? db.doc(`/locations/${location}/locationOperatories/${apt.Op}`) : undefined,
36
37
  date: moment_aptDateTime.format('YYYY-MM-DD'),
37
38
  dateTime: moment_aptDateTime.format(),
@@ -72,4 +73,25 @@ function normalizeStatus(status: string): string {
72
73
  if (['UnschedList', 'Broken'].includes(status)) return 'Canceled';
73
74
  if (['Scheduled', 'ASAP'].includes(status)) return 'Scheduled';
74
75
  return status;
76
+ }
77
+
78
+ function updateAptTypeNum(ProcDescript: string): number {
79
+
80
+ let aptTypeNum = 11 // Default: Treatment
81
+
82
+ if (ProcDescript.includes('PeriodicX') && ProcDescript.includes('Free White')) {
83
+ aptTypeNum = 23;
84
+ } else if (ProcDescript.includes('PeriodicX')) {
85
+ aptTypeNum = 12;
86
+ } else if ((ProcDescript.includes('Prophy') || ProcDescript.includes('ProChild')) && ProcDescript.includes('Free White')) {
87
+ aptTypeNum = 13;
88
+ } else if ((ProcDescript.includes('Prophy') || ProcDescript.includes('ProChild'))) {
89
+ aptTypeNum = 3;
90
+ } else if (ProcDescript.includes('SPT') && ProcDescript.includes('Free White')) {
91
+ aptTypeNum = 24;
92
+ } else if (ProcDescript.includes('SPT')) {
93
+ aptTypeNum = 14;
94
+ }
95
+
96
+ return aptTypeNum;
75
97
  }