Skip to content

Commit

Permalink
Add custom providerName to health summary pdf (#201)
Browse files Browse the repository at this point in the history
# Add custom providerName to health summary pdf

## ♻️ Current situation & Problem
*Link any open issues or pull requests (PRs) related to this PR. Please
ensure that all non-trivial PRs are first tracked and discussed in an
existing GitHub issue or discussion.*


## ⚙️ Release Notes 
*Add a bullet point list summary of the feature and possible migration
guides if this is a breaking change so this section can be added to the
release notes.*
*Include code snippets that provide examples of the feature implemented
or links to the documentation if it appends or changes the public
interface.*


## 📚 Documentation
*Please ensure that you properly document any additions in conformance
to [Spezi Documentation
Guide](https://github.com/StanfordSpezi/.github/blob/main/DOCUMENTATIONGUIDE.md).*
*You can use this section to describe your solution, but we encourage
contributors to document your reasoning and changes using in-line
documentation.*


## ✅ Testing
*Please ensure that the PR meets the testing requirements set by CodeCov
and that new functionality is appropriately tested.*
*This section describes important information about the tests and why
some elements might not be testable.*


### Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
pauljohanneskraft authored Jan 16, 2025
1 parent 38658b1 commit 0451549
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 0451549

Please sign in to comment.