diff --git a/README.md b/README.md index 127a56ee..24361718 100644 --- a/README.md +++ b/README.md @@ -313,6 +313,8 @@ In this section, we describe all user-related data to be stored. The security ru |dateOfEnrollment|Date|-|The date when the invitation code was used to create this user.| |dateOfBirth|optional Date|-|The date when the user was born.| |genderIdentity|optional string|"female","male","transgender","nonBinary","preferNotToState"|The gender identity chosen when a patient redeemed the invitation.| +|clinician|optional string|The identifier of the clinician assigned to a patient. For all other users, this property either is nonexistant or null.| +|providerName|optional string|Text description of the provider of a patient. This value takes precedence over the `clinician` property during health summary generation. For all other users, this property either is nonexistant or null.| |organization|optional string|-|The id of the organization a clinician, patient or owner is associated with.| |invitationCode|string|-|The invitationCode to be used when logging in to the app for the first time.| |language|optional string|e.g. "en"|Following IETF BCP-47 / [FHIR ValueSet languages](https://hl7.org/fhir/R4B/valueset-languages.html).| diff --git a/functions/models/src/types/userRegistration.ts b/functions/models/src/types/userRegistration.ts index ae23cc55..b9480591 100644 --- a/functions/models/src/types/userRegistration.ts +++ b/functions/models/src/types/userRegistration.ts @@ -21,6 +21,7 @@ export const userRegistrationInputConverter = new Lazy( organization: optionalish(z.string()), dateOfBirth: optionalish(dateConverter.schema), clinician: optionalish(z.string()), + providerName: optionalish(z.string()), receivesAppointmentReminders: optionalishDefault(z.boolean(), true), receivesInactivityReminders: optionalishDefault(z.boolean(), true), receivesMedicationUpdates: optionalishDefault(z.boolean(), true), @@ -37,6 +38,7 @@ export const userRegistrationInputConverter = new Lazy( dateOfBirth: object.dateOfBirth ? dateConverter.encode(object.dateOfBirth) : null, clinician: object.clinician ?? null, + providerName: object.providerName ?? null, receivesAppointmentReminders: object.receivesAppointmentReminders, receivesInactivityReminders: object.receivesInactivityReminders, receivesMedicationUpdates: object.receivesMedicationUpdates, @@ -73,6 +75,7 @@ export class UserRegistration { readonly dateOfBirth?: Date readonly clinician?: string + readonly providerName?: string readonly receivesAppointmentReminders: boolean readonly receivesInactivityReminders: boolean @@ -104,6 +107,7 @@ export class UserRegistration { organization?: string dateOfBirth?: Date clinician?: string + providerName?: string receivesAppointmentReminders: boolean receivesInactivityReminders: boolean receivesMedicationUpdates: boolean @@ -118,6 +122,7 @@ export class UserRegistration { this.organization = input.organization this.dateOfBirth = input.dateOfBirth this.clinician = input.clinician + this.providerName = input.providerName this.receivesAppointmentReminders = input.receivesAppointmentReminders this.receivesInactivityReminders = input.receivesInactivityReminders this.receivesMedicationUpdates = input.receivesMedicationUpdates diff --git a/functions/src/services/healthSummary/databaseHealthSummaryService.ts b/functions/src/services/healthSummary/databaseHealthSummaryService.ts index 475a3e4d..41b834c9 100644 --- a/functions/src/services/healthSummary/databaseHealthSummaryService.ts +++ b/functions/src/services/healthSummary/databaseHealthSummaryService.ts @@ -54,15 +54,16 @@ export class DefaultHealthSummaryService implements HealthSummaryService { this.getVitals(userId, advanceDateByDays(date, -14), weightUnit), ]) - const clinician = - patient?.content.clinician ? - await this.userService.getAuth(patient.content.clinician) - : undefined + const providerName = + patient?.content.providerName ?? + (patient?.content.clinician ? + (await this.userService.getAuth(patient.content.clinician)).displayName + : undefined) return new HealthSummaryData({ name: auth.displayName, dateOfBirth: patient?.content.dateOfBirth, - providerName: clinician?.displayName, + providerName: providerName, nextAppointment: nextAppointment?.content, recommendations: recommendations.map((doc) => doc.content), vitals: vitals,