Skip to content

Commit

Permalink
Merge branch 'main' into update-sso
Browse files Browse the repository at this point in the history
  • Loading branch information
pauljohanneskraft authored Jan 16, 2025
2 parents 2bd5e7d + 0451549 commit 57790b0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).|
Expand Down
5 changes: 5 additions & 0 deletions functions/models/src/types/userRegistration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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,
Expand Down Expand Up @@ -73,6 +75,7 @@ export class UserRegistration {

readonly dateOfBirth?: Date
readonly clinician?: string
readonly providerName?: string

readonly receivesAppointmentReminders: boolean
readonly receivesInactivityReminders: boolean
Expand Down Expand Up @@ -104,6 +107,7 @@ export class UserRegistration {
organization?: string
dateOfBirth?: Date
clinician?: string
providerName?: string
receivesAppointmentReminders: boolean
receivesInactivityReminders: boolean
receivesMedicationUpdates: boolean
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 57790b0

Please sign in to comment.