From 59dfc7160cbcc8d91e0b487d21dc13a992a3f8d7 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bachorski <60391032+arkadiuszbachorski@users.noreply.github.com> Date: Mon, 20 Jan 2025 12:28:21 +0100 Subject: [PATCH] Support custom providerName for Patients (#105) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Support custom providerName for Patients ## :recycle: Current situation & Problem Closes #103 ## :gear: Release Notes * Support custom providerName for Patients ## :white_check_mark: Testing Tested manually ⚠️ Do not merge this until models are updated to the latest version. ### 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). --- package-lock.json | 8 +++---- package.json | 2 +- routes/~_dashboard/~patients/PatientForm.tsx | 22 +++++++++++++++++++- routes/~_dashboard/~patients/~$id/~index.tsx | 1 + routes/~_dashboard/~patients/~invite.tsx | 1 + 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5b7701d..7255022 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0", "license": "MIT", "dependencies": { - "@stanfordbdhg/engagehf-models": "^0.5.0", + "@stanfordbdhg/engagehf-models": "^0.6.0", "@stanfordspezi/spezi-web-design-system": "^0.3.0", "@t3-oss/env-core": "^0.11.1", "@tanstack/react-query": "^5.62.0", @@ -3717,9 +3717,9 @@ } }, "node_modules/@stanfordbdhg/engagehf-models": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@stanfordbdhg/engagehf-models/-/engagehf-models-0.5.0.tgz", - "integrity": "sha512-iCkxfo4Al+GaRk6NUTM7/JNkVikliYKBwvAjiH+GPb3udAo/rSTWV0RD5UTiouQSazhdf6Qd6KZTrUzN8v0AuQ==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@stanfordbdhg/engagehf-models/-/engagehf-models-0.6.0.tgz", + "integrity": "sha512-f4CFerWr/YrXdXB+K66Rq8SbKF9byKWx+/NA+kIHXxUjIELh5ZQvO83voVT7dlnEfepN3i0nWz5V1Wwd2UPHLQ==", "dependencies": { "zod": "^3.23.8" }, diff --git a/package.json b/package.json index 2a1138d..04f9eeb 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "prepush": "npm run lint:fix && tsc --noEmit" }, "dependencies": { - "@stanfordbdhg/engagehf-models": "^0.5.0", + "@stanfordbdhg/engagehf-models": "^0.6.0", "@stanfordspezi/spezi-web-design-system": "^0.3.0", "@t3-oss/env-core": "^0.11.1", "@tanstack/react-query": "^5.62.0", diff --git a/routes/~_dashboard/~patients/PatientForm.tsx b/routes/~_dashboard/~patients/PatientForm.tsx index 915a0ae..90adc94 100644 --- a/routes/~_dashboard/~patients/PatientForm.tsx +++ b/routes/~_dashboard/~patients/PatientForm.tsx @@ -32,6 +32,10 @@ export const patientFormSchema = z.object({ displayName: z.string(), clinician: z.string().min(1, 'Clinician is required'), dateOfBirth: z.date().optional(), + providerName: z.preprocess( + (value) => (value === '' ? null : value), + z.string().nullable(), + ), }) export type PatientFormSchema = z.infer @@ -43,7 +47,10 @@ interface PatientFormProps { email: string | null }> userInfo?: Pick - user?: Pick + user?: Pick< + User, + 'organization' | 'clinician' | 'dateOfBirth' | 'providerName' + > onSubmit: (data: PatientFormSchema) => Promise clinicianPreselectId?: string } @@ -62,6 +69,7 @@ export const PatientForm = ({ displayName: userInfo?.displayName ?? '', clinician: user?.clinician ?? clinicianPreselectId ?? '', dateOfBirth: user?.dateOfBirth ? new Date(user.dateOfBirth) : undefined, + providerName: user?.providerName ?? '', }, }) @@ -114,6 +122,18 @@ export const PatientForm = ({ )} /> + + Displayed as "Provider" of the Health Report.
+ If "Provider name" is not set, assigned clinician will be shown. + + } + render={({ field }) => } + /> diff --git a/routes/~_dashboard/~patients/~$id/~index.tsx b/routes/~_dashboard/~patients/~$id/~index.tsx index c58265b..d816e5e 100644 --- a/routes/~_dashboard/~patients/~$id/~index.tsx +++ b/routes/~_dashboard/~patients/~$id/~index.tsx @@ -112,6 +112,7 @@ const PatientPage = () => { clinician: form.clinician, organization: clinician.organization, dateOfBirth: form.dateOfBirth?.toISOString() ?? null, + providerName: form.providerName, } if (resourceType === 'user') { await callables.updateUserInformation({ diff --git a/routes/~_dashboard/~patients/~invite.tsx b/routes/~_dashboard/~patients/~invite.tsx index 9c5bc75..a089442 100644 --- a/routes/~_dashboard/~patients/~invite.tsx +++ b/routes/~_dashboard/~patients/~invite.tsx @@ -39,6 +39,7 @@ const InvitePatientPage = () => { clinician: form.clinician, organization: clinician.organization, dateOfBirth: form.dateOfBirth?.toISOString(), + providerName: form.providerName, }, }) toast.success('Patient has been successfully invited!')