From 2dcf6827a9d8c3f7d12a673e346ac40c76c135b4 Mon Sep 17 00:00:00 2001 From: Anant Mittal Date: Thu, 31 Mar 2022 16:35:47 -0700 Subject: [PATCH 01/19] Updated AssessmentProgress.tsx: added assignedDateTime to onSaveConfigure --- .../src/components/PatientDetail/AssessmentProgress.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web_registry/src/components/PatientDetail/AssessmentProgress.tsx b/web_registry/src/components/PatientDetail/AssessmentProgress.tsx index 410c953d..11114ce2 100644 --- a/web_registry/src/components/PatientDetail/AssessmentProgress.tsx +++ b/web_registry/src/components/PatientDetail/AssessmentProgress.tsx @@ -146,7 +146,8 @@ export const AssessmentProgress: FunctionComponent = o const onSaveConfigure = action(() => { const { frequency, dayOfWeek } = configureState; - var newAssessment = { ...assessment, frequency, dayOfWeek }; + assessment.assignedDateTime = new Date(); + var newAssessment = { ...assessment, frequency, dayOfWeek,}; currentPatient.updateAssessment(newAssessment); configureState.openConfigure = false; }); From c10923140eab7a0f6f6e95d7cc1bc66ed34ac9ab Mon Sep 17 00:00:00 2001 From: Anant Mittal Date: Thu, 31 Mar 2022 16:38:35 -0700 Subject: [PATCH 02/19] Updated MedicationProgress.tsx: added assignedDateTime --- .../PatientDetail/MedicationProgress.tsx | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/web_registry/src/components/PatientDetail/MedicationProgress.tsx b/web_registry/src/components/PatientDetail/MedicationProgress.tsx index ee7be59a..9434abef 100644 --- a/web_registry/src/components/PatientDetail/MedicationProgress.tsx +++ b/web_registry/src/components/PatientDetail/MedicationProgress.tsx @@ -43,14 +43,15 @@ export const MedicationProgress: FunctionComponent = o state.openConfigure = false; }); - // const handleConfigure = action(() => { - // state.openConfigure = true; - // state.frequency = assessment.frequency || 'Every 2 weeks'; - // state.dayOfWeek = assessment.dayOfWeek || 'Monday'; - // }); + const handleConfigure = action(() => { + state.openConfigure = true; + state.frequency = assessment.frequency || 'Every 2 weeks'; + state.dayOfWeek = assessment.dayOfWeek || 'Monday'; + }); const onSaveConfigure = action(() => { const { frequency, dayOfWeek } = state; + assessment.assignedDateTime = new Date(); var newAssessment = { ...assessment, frequency, dayOfWeek }; currentPatient.updateAssessment(newAssessment); state.openConfigure = false; @@ -126,10 +127,9 @@ export const MedicationProgress: FunctionComponent = o text: assessment.assigned ? getString('patient_progress_assessment_assigned_button') : getString('patient_progress_assessment_assign_button'), - // Temporarily disable assignment - // onClick: assessment.assigned - // ? undefined - // : () => currentPatient?.assignAssessment(assessment.assessmentId), + onClick: assessment.assigned + ? undefined + : () => currentPatient?.assignAssessment(assessment.assessmentId), } as IActionButton, ].concat( assessment.assigned @@ -137,8 +137,7 @@ export const MedicationProgress: FunctionComponent = o { icon: , text: getString('patient_progress_assessment_action_configure'), - // Temporarily disable assignment - // onClick: handleConfigure, + onClick: handleConfigure, } as IActionButton, ] : [], From a42f1e5a44bbae5dd66d3911ef770abd9b975160 Mon Sep 17 00:00:00 2001 From: Anant Mittal Date: Thu, 31 Mar 2022 16:40:26 -0700 Subject: [PATCH 03/19] Updated PatientStore.ts: added assignedDateTime --- web_registry/src/stores/PatientStore.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web_registry/src/stores/PatientStore.ts b/web_registry/src/stores/PatientStore.ts index 94dcb428..216a771b 100644 --- a/web_registry/src/stores/PatientStore.ts +++ b/web_registry/src/stores/PatientStore.ts @@ -435,10 +435,12 @@ export class PatientStore implements IPatientStore { console.assert(!!found, 'Assessment not found'); if (found) { + return this.updateAssessment({ ...toJS(found), assessmentId, assigned: true, + assignedDateTime: new Date(), frequency: found.frequency || 'Every 2 weeks', dayOfWeek: found.dayOfWeek || 'Monday', }); From 4164036d49101ff3217bd2dc93eceb6860c42c56 Mon Sep 17 00:00:00 2001 From: Anant Mittal Date: Thu, 31 Mar 2022 17:27:49 -0700 Subject: [PATCH 04/19] Fixed typo in medication config --- .../app_config/assessments/medication.json | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/server_flask/app_config/assessments/medication.json b/server_flask/app_config/assessments/medication.json index e88f09bf..63a0a129 100644 --- a/server_flask/app_config/assessments/medication.json +++ b/server_flask/app_config/assessments/medication.json @@ -1,23 +1,23 @@ { - "id": "medication", - "name": "Medication Check-In", - "instruction": "The following questions pertain to any medications you are taking for stress, mood, anxiety, sleep, or other psychological symptoms.", - "questions": [ - { - "question": "In the past 7 days, did you take all your prescribed medications as scheduled?", - "id": "adherence" - } - ], - "options": [ - { - "text": "Yes, I took my medications as scheduled", - "value": 1 - }, - { - "text": "No, I did not take all my medications as scheduled", - "value": 0 - } - ], - "interpretationName": "Medication tracking", - "interpretationTable": [] + "id": "medication", + "name": "Medication", + "instruction": "The following questions pertain to any medications you are taking for stress, mood, anxiety, sleep, or other psychological symptoms.", + "questions": [ + { + "question": "In the past 7 days, did you take all your prescribed medications as scheduled?", + "id": "adherence" + } + ], + "options": [ + { + "text": "Yes, I took my medications as scheduled", + "value": 1 + }, + { + "text": "No, I did not take all my medications as scheduled", + "value": 0 + } + ], + "interpretationName": "Medication tracking", + "interpretationTable": [] } From 81f2f5693c3b3a71d69bfc83ed4cd81b432c2d94 Mon Sep 17 00:00:00 2001 From: Anant Mittal Date: Thu, 31 Mar 2022 20:23:26 -0700 Subject: [PATCH 05/19] Updated GetFormDialog.tsx --- web_patient/src/components/Forms/GetFormDialog.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web_patient/src/components/Forms/GetFormDialog.tsx b/web_patient/src/components/Forms/GetFormDialog.tsx index a566b23d..0316e06a 100644 --- a/web_patient/src/components/Forms/GetFormDialog.tsx +++ b/web_patient/src/components/Forms/GetFormDialog.tsx @@ -2,20 +2,22 @@ import React, { FunctionComponent } from 'react'; import { ActivityLoggingForm } from 'src/components/Forms/ActivityLoggingForm'; import AddEditActivityForm from 'src/components/Forms/AddEditActivityForm'; import { AssessmentForm } from 'src/components/Forms/AssessmentForm'; +import MedicationLoggingForm from 'src/components/Forms/MedicationLoggingForm'; import MoodLoggingForm from 'src/components/Forms/MoodLoggingForm'; import SafetyPlanForm from 'src/components/Forms/SafetyPlanForm'; import { getRouteParameter, Parameters, ParameterValues } from 'src/services/routes'; const formComponents: { [paramName: string]: FunctionComponent } = { - [ParameterValues.form.moodLog]: MoodLoggingForm, - [ParameterValues.form.assessmentLog]: AssessmentForm, [ParameterValues.form.activityLog]: ActivityLoggingForm, [ParameterValues.form.addActivity]: AddEditActivityForm, + [ParameterValues.form.assessmentLog]: AssessmentForm, [ParameterValues.form.editActivity]: AddEditActivityForm, + [ParameterValues.form.medicationLog]: MedicationLoggingForm, + [ParameterValues.form.moodLog]: MoodLoggingForm, [ParameterValues.form.safetyPlan]: SafetyPlanForm, }; -export interface IFormProps {} +export interface IFormProps { } export default () => { const formName = getRouteParameter(Parameters.form); From 5ba95f16ef105037ab0126a714527ec6639a0b7a Mon Sep 17 00:00:00 2001 From: Anant Mittal Date: Thu, 31 Mar 2022 20:23:58 -0700 Subject: [PATCH 06/19] Updated routes.ts --- web_patient/src/services/routes.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web_patient/src/services/routes.ts b/web_patient/src/services/routes.ts index dfed5811..7b575d4e 100644 --- a/web_patient/src/services/routes.ts +++ b/web_patient/src/services/routes.ts @@ -24,11 +24,12 @@ export const Parameters = { export const ParameterValues = { form: { - moodLog: 'log-mood', - assessmentLog: 'log-assessment', activityLog: 'log-activity', addActivity: 'add-activity', + assessmentLog: 'log-assessment', editActivity: 'edit-activity', + medicationLog: 'log-medication', + moodLog: 'log-mood', safetyPlan: 'safety-plan', }, }; From d71fe98e503e871de6e8eec22d30faf10c4422ef Mon Sep 17 00:00:00 2001 From: Anant Mittal Date: Thu, 31 Mar 2022 20:24:41 -0700 Subject: [PATCH 07/19] Updated HomePage.tsx --- web_patient/src/components/Home/HomePage.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/web_patient/src/components/Home/HomePage.tsx b/web_patient/src/components/Home/HomePage.tsx index e429c045..c6e9bbb0 100644 --- a/web_patient/src/components/Home/HomePage.tsx +++ b/web_patient/src/components/Home/HomePage.tsx @@ -14,6 +14,7 @@ import { getString } from 'src/services/strings'; import { useStores } from 'src/stores/stores'; import { getGreeting } from 'src/utils/schedule'; import styled from 'styled-components'; +import _ from 'lodash'; const CompactList = withTheme( styled(List)((props) => ({ @@ -48,6 +49,7 @@ export const HomePage: FunctionComponent = observer(() => { navigate(`${Routes.resources}/${Routes.valuesInventory}`); }); + return ( {!!rootStore.inspirationalQuote ? ( @@ -95,10 +97,18 @@ export const HomePage: FunctionComponent = observer(() => { + to={ + _.isEqual(assessment.assessmentId, "medication") + ? getFormPath(ParameterValues.form.medicationLog, { + [Parameters.taskId]: assessment.scheduledAssessmentId, + [Parameters.assessmentId]: assessment.assessmentId, + }) + : getFormPath(ParameterValues.form.assessmentLog, { + [Parameters.taskId]: assessment.scheduledAssessmentId, + [Parameters.assessmentId]: assessment.assessmentId, + }) + } + > Date: Thu, 31 Mar 2022 20:28:00 -0700 Subject: [PATCH 08/19] Added MedicationLoggingForm.tsx --- .../Forms/MedicationLoggingForm.tsx | 320 ++++++++++++++++++ 1 file changed, 320 insertions(+) create mode 100644 web_patient/src/components/Forms/MedicationLoggingForm.tsx diff --git a/web_patient/src/components/Forms/MedicationLoggingForm.tsx b/web_patient/src/components/Forms/MedicationLoggingForm.tsx new file mode 100644 index 00000000..d7fb24cf --- /dev/null +++ b/web_patient/src/components/Forms/MedicationLoggingForm.tsx @@ -0,0 +1,320 @@ +import { + FormControl, + FormControlLabel, + Link, + Radio, + RadioGroup, + Stack, + Table, + TableBody, + TableCell, + TableHead, + TableRow, + TextField, +} from '@mui/material'; +import withTheme from '@mui/styles/withTheme'; +import { action, ObservableMap } from 'mobx'; +import { observer, useLocalObservable } from 'mobx-react'; +import React, { FunctionComponent } from 'react'; +import { IAssessmentLog } from 'shared/types'; +import FormDialog from 'src/components/Forms/FormDialog'; +import FormSection from 'src/components/Forms/FormSection'; +import { IFormProps } from 'src/components/Forms/GetFormDialog'; +import { getRouteParameter, Parameters } from 'src/services/routes'; +import { getString } from 'src/services/strings'; +import { useStores } from 'src/stores/stores'; +import { getAssessmentScore } from 'src/utils/assessment'; +import styled from 'styled-components'; + +export interface IMedicationLoggingFormProps extends IFormProps { } + +interface IQuestionFormProps { + instruction: string; + question: string; + questionId: string; + value: number | undefined; + options: { text: string; value: number }[]; + onValueChange: (newValue: number) => void; +} + +const ListDiv = styled.ul({ + marginBlockStart: '0.5em', + marginBlockEnd: '0.5em', + paddingInlineStart: 20, +}); + +const TotalScoreText = withTheme( + styled.div((props) => ({ + fontSize: props.theme.typography.h2.fontSize, + fontWeight: props.theme.typography.fontWeightMedium, + padding: props.theme.spacing(4), + paddingBottom: 0, + textAlign: 'center', + lineHeight: 1, + })), +); + +const BodyText = withTheme( + styled.div((props) => ({ + fontSize: props.theme.typography.body1.fontSize, + lineHeight: 1.1, + })), +); + +const CrisisContent: FunctionComponent = () => { + return ( + + + You indicated that you are having thoughts of death or suicide. + + If you need more help right away, here are some resources to try: + +
  • + + Call National Suicide Prevention Hotline by phone:{' '} + + 1-800-273-TALK (8255) + + +
  • +
  • + + National Suicide Prevention Web Chat{' '} + + https://suicidepreventionlifeline.org/chat/ + + +
  • +
  • + + Crisis Text Line - Text "HOME" to 741741{' '} + + https://www.crisistextline.org/ + + +
  • +
  • + + If you need immediate medical attention, please call{' '} + + 911 + {' '} + or go to your nearest emergency room. + +
  • +
    + + } + /> + ); +}; + +const QuestionForm: FunctionComponent = (props) => { + const { instruction, question, questionId, value, options, onValueChange } = props; + return ( + + onValueChange(Number(val))}> + {options.map((resp, ridx) => { + return ( + } + label={`${resp.text} (${resp.value})`} + /> + ); + })} + + + } + /> + ); +}; + +export const MedicationLoggingForm: FunctionComponent = observer(() => { + const assessmentId = getRouteParameter(Parameters.assessmentId); + const scheduleId = getRouteParameter(Parameters.taskId); + + if (!assessmentId || !scheduleId) { + console.error(`Scheduled id or assessment id not found in query paramters: ${assessmentId} ${scheduleId}`); + return null; + } + + const rootStore = useStores(); + const { patientStore } = rootStore; + const scheduledAssessment = patientStore.getScheduledAssessmentById(scheduleId); + + if (!scheduledAssessment) { + console.error(`Scheduled assessment not found by schedule id: ${scheduleId}`); + return null; + } + + const assessmentContent = rootStore.getAssessmentContent(scheduledAssessment?.assessmentId); + + if (!assessmentContent) { + return null; + } + + const viewState = useLocalObservable<{ hasData: boolean }>(() => ({ + hasData: false, + })); + + const dataState = useLocalObservable<{ pointValues: ObservableMap; comment: string }>(() => ({ + pointValues: new ObservableMap(), + comment: '', + })); + + const handleSelect = action((qid: string, value: number) => { + dataState.pointValues.set(qid, value); + viewState.hasData = Object.keys(dataState.pointValues).length > 0; + }); + + const handleCommentChange = action((event: React.ChangeEvent) => { + dataState.comment = event.target.value; + }); + + const handleSubmit = action(async () => { + const { scheduledAssessmentId, assessmentId } = scheduledAssessment; + try { + const log = { + scheduledAssessmentId, + assessmentId, + patientSubmitted: true, + pointValues: Object.fromEntries(dataState.pointValues.entries()), + recordedDateTime: new Date(), + comment: dataState.comment, + } as IAssessmentLog; + await patientStore.saveAssessmentLog(log); + return !patientStore.loadAssessmentLogsState.error; + } catch { + return false; + } + }); + + const getAssessmentPages = () => { + const questionPages = assessmentContent.questions.map((q) => ({ + content: ( + handleSelect(q.id, val)} + /> + ), + canGoNext: dataState.pointValues.get(q.id) != undefined, + })); + + const total = getAssessmentScore(Object.fromEntries(dataState.pointValues.entries())); + const assessment = + assessmentContent.interpretationTable + .slice() + .sort((row) => row.max) + .find((row) => total <= row.max)?.interpretation || ''; + + const scorePage = { + content: ( + + + {`${total}`} + {`${assessment}`} + + } + /> + {assessmentId == 'phq-9' && !!dataState.pointValues.get('Suicide') && } + + + + + {getString('Form_assessment_score_column_name')} + {assessmentContent.interpretationName} + + + + {assessmentContent.interpretationTable.map((int, idx) => ( + + + {int.score} + + {int.interpretation} + + ))} + + + } + /> + + ), + canGoNext: true, + }; + + const commentPage = { + content: ( + + } + /> + ), + canGoNext: true, + }; + + if (assessmentContent.questions.length > 1) { + return [...questionPages, scorePage, commentPage]; + } else { + return [...questionPages, commentPage]; + } + }; + + return ( + + ); +}); + +export default MedicationLoggingForm; From 7ed3e718fbb0d63783dded94bf62dbe13caf6e06 Mon Sep 17 00:00:00 2001 From: Anant Mittal Date: Sat, 2 Apr 2022 21:03:36 -0700 Subject: [PATCH 09/19] Updated assessment log schema --- scope_shared/scope/schemas/assessment-log.json | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scope_shared/scope/schemas/assessment-log.json b/scope_shared/scope/schemas/assessment-log.json index 7775775a..b36eebed 100644 --- a/scope_shared/scope/schemas/assessment-log.json +++ b/scope_shared/scope/schemas/assessment-log.json @@ -40,13 +40,21 @@ "type": "string" }, "pointValues": { - "type": "object", - "$comment": "TODO" + "type": "object" }, "totalScore": { "type": "number" + }, + "adherence": { + "type": "number" + }, + "medicationQuestion": { + "type": "boolean" + }, + "medicationNote": { + "type": "string" } }, "additionalProperties": false, - "required": ["_type", "recordedDateTime", "scheduledAssessmentId", "assessmentId", "pointValues"] + "required": ["_type", "recordedDateTime", "scheduledAssessmentId", "assessmentId"] } From f2d4c8cb0b6fea849e510adfb7acbd1e48bf5c13 Mon Sep 17 00:00:00 2001 From: Anant Mittal Date: Sat, 2 Apr 2022 21:04:34 -0700 Subject: [PATCH 10/19] Added MedicationLoggingForm.tsx --- .../Forms/MedicationLoggingForm.tsx | 242 +++++------------- 1 file changed, 61 insertions(+), 181 deletions(-) diff --git a/web_patient/src/components/Forms/MedicationLoggingForm.tsx b/web_patient/src/components/Forms/MedicationLoggingForm.tsx index d7fb24cf..2c7e7614 100644 --- a/web_patient/src/components/Forms/MedicationLoggingForm.tsx +++ b/web_patient/src/components/Forms/MedicationLoggingForm.tsx @@ -1,19 +1,13 @@ import { FormControl, FormControlLabel, - Link, Radio, RadioGroup, + SelectChangeEvent, Stack, - Table, - TableBody, - TableCell, - TableHead, - TableRow, TextField, } from '@mui/material'; -import withTheme from '@mui/styles/withTheme'; -import { action, ObservableMap } from 'mobx'; +import { action } from 'mobx'; import { observer, useLocalObservable } from 'mobx-react'; import React, { FunctionComponent } from 'react'; import { IAssessmentLog } from 'shared/types'; @@ -23,8 +17,6 @@ import { IFormProps } from 'src/components/Forms/GetFormDialog'; import { getRouteParameter, Parameters } from 'src/services/routes'; import { getString } from 'src/services/strings'; import { useStores } from 'src/stores/stores'; -import { getAssessmentScore } from 'src/utils/assessment'; -import styled from 'styled-components'; export interface IMedicationLoggingFormProps extends IFormProps { } @@ -37,92 +29,6 @@ interface IQuestionFormProps { onValueChange: (newValue: number) => void; } -const ListDiv = styled.ul({ - marginBlockStart: '0.5em', - marginBlockEnd: '0.5em', - paddingInlineStart: 20, -}); - -const TotalScoreText = withTheme( - styled.div((props) => ({ - fontSize: props.theme.typography.h2.fontSize, - fontWeight: props.theme.typography.fontWeightMedium, - padding: props.theme.spacing(4), - paddingBottom: 0, - textAlign: 'center', - lineHeight: 1, - })), -); - -const BodyText = withTheme( - styled.div((props) => ({ - fontSize: props.theme.typography.body1.fontSize, - lineHeight: 1.1, - })), -); - -const CrisisContent: FunctionComponent = () => { - return ( - - - You indicated that you are having thoughts of death or suicide. - - If you need more help right away, here are some resources to try: - -
  • - - Call National Suicide Prevention Hotline by phone:{' '} - - 1-800-273-TALK (8255) - - -
  • -
  • - - National Suicide Prevention Web Chat{' '} - - https://suicidepreventionlifeline.org/chat/ - - -
  • -
  • - - Crisis Text Line - Text "HOME" to 741741{' '} - - https://www.crisistextline.org/ - - -
  • -
  • - - If you need immediate medical attention, please call{' '} - - 911 - {' '} - or go to your nearest emergency room. - -
  • -
    - - } - /> - ); -}; const QuestionForm: FunctionComponent = (props) => { const { instruction, question, questionId, value, options, onValueChange } = props; @@ -143,7 +49,7 @@ const QuestionForm: FunctionComponent = (props) => { key={`${questionId}-${ridx}`} value={ridx} control={} - label={`${resp.text} (${resp.value})`} + label={`${resp.text}`} /> ); })} @@ -178,22 +84,23 @@ export const MedicationLoggingForm: FunctionComponent(() => ({ - hasData: false, - })); - const dataState = useLocalObservable<{ pointValues: ObservableMap; comment: string }>(() => ({ - pointValues: new ObservableMap(), - comment: '', + const dataState = useLocalObservable<{ adherence: number | undefined, medicationQuestion: boolean, medicationNote: string | undefined }>(() => ({ + adherence: undefined, + medicationQuestion: false, + medicationNote: '', })); - const handleSelect = action((qid: string, value: number) => { - dataState.pointValues.set(qid, value); - viewState.hasData = Object.keys(dataState.pointValues).length > 0; + const handleAdherence = action((value: number) => { + dataState.adherence = value as number; + }); + + const handleMedicationQuestion = action((event: SelectChangeEvent) => { + dataState.medicationQuestion = event.target.value == "true" ? true : false as boolean; }); - const handleCommentChange = action((event: React.ChangeEvent) => { - dataState.comment = event.target.value; + const handleMedicationNote = action((event: React.ChangeEvent) => { + dataState.medicationNote = event.target.value; }); const handleSubmit = action(async () => { @@ -203,9 +110,10 @@ export const MedicationLoggingForm: FunctionComponent { - const questionPages = assessmentContent.questions.map((q) => ({ + let adherenceQuestion = assessmentContent.questions[0]; + const adherenceQuestionPage = { content: ( handleSelect(q.id, val)} + question={adherenceQuestion.question} + questionId={adherenceQuestion.id} + value={dataState.adherence} + onValueChange={handleAdherence} /> ), - canGoNext: dataState.pointValues.get(q.id) != undefined, - })); - - const total = getAssessmentScore(Object.fromEntries(dataState.pointValues.entries())); - const assessment = - assessmentContent.interpretationTable - .slice() - .sort((row) => row.max) - .find((row) => total <= row.max)?.interpretation || ''; + canGoNext: dataState.adherence != undefined, + }; - const scorePage = { + const medicationQuestionPage = { content: ( - {`${total}`} - {`${assessment}`} - - } - /> - {assessmentId == 'phq-9' && !!dataState.pointValues.get('Suicide') && } - - - - - {getString('Form_assessment_score_column_name')} - {assessmentContent.interpretationName} - - - - {assessmentContent.interpretationTable.map((int, idx) => ( - - - {int.score} - - {int.interpretation} - - ))} - - + + + } label="Yes" /> + } label="No" /> + + } /> + {dataState.medicationQuestion && ( + + } + /> + )} ), - canGoNext: true, + canGoNext: !dataState.medicationQuestion || (dataState.medicationNote != ''), }; - const commentPage = { - content: ( - - } - /> - ), - canGoNext: true, - }; - if (assessmentContent.questions.length > 1) { - return [...questionPages, scorePage, commentPage]; - } else { - return [...questionPages, commentPage]; - } + return [adherenceQuestionPage, medicationQuestionPage]; }; return ( Date: Sat, 2 Apr 2022 21:04:57 -0700 Subject: [PATCH 11/19] Updated strings.ts --- web_patient/src/services/strings.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web_patient/src/services/strings.ts b/web_patient/src/services/strings.ts index 5250420b..85cfae09 100644 --- a/web_patient/src/services/strings.ts +++ b/web_patient/src/services/strings.ts @@ -40,6 +40,11 @@ const _strings = { Form_mood_submit_success: 'Thank you for checking in. Your responses will be available to your clinical social worker.', + Form_medication_logging_medication_question_prompt: 'Do you have questions for your psychosocial care team about any of the medications you are taking?', + Form_medication_logging_medication_note_prompt: 'What question about your medications would you like to ask your phsychosocial team?', + Form_medication_logging_medication_note_subprompt: '(If this is an emergency, please contact your medical team, call 911, or go to the nearest emergency room)', + Form_medication_logging_medication_note_subprompt_helper_text: 'This is a place you can remind yourself of any side effects or other medication questions you would like to discuss with your psychosocial team.', + Form_assessment_checkin_title: 'Check-In', Form_assessment_score_column_name: 'Score', Form_assessment_comment_prompt: 'Do you have any other notes?', From 58ec4bf8ab926b58efde63721ada39a231a439f1 Mon Sep 17 00:00:00 2001 From: Anant Mittal Date: Sat, 2 Apr 2022 21:07:31 -0700 Subject: [PATCH 12/19] Updated MedicationProgress.tsx --- .../PatientDetail/MedicationProgress.tsx | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/web_registry/src/components/PatientDetail/MedicationProgress.tsx b/web_registry/src/components/PatientDetail/MedicationProgress.tsx index 9434abef..b9374604 100644 --- a/web_registry/src/components/PatientDetail/MedicationProgress.tsx +++ b/web_registry/src/components/PatientDetail/MedicationProgress.tsx @@ -67,15 +67,16 @@ export const MedicationProgress: FunctionComponent = o const sortedLogs = assessmentLogs?.slice().sort((a, b) => compareDesc(a.recordedDateTime, b.recordedDateTime)); + const tableData = sortedLogs?.map((a) => { return { date: format(a.recordedDateTime, 'MM/dd/yy'), adherence: - a.pointValues['Adherence'] == 1 + a.adherence == 1 ? getString('patient_progress_medication_adherence_yes') : getString('patient_progress_medication_adherence_no'), id: a.assessmentLogId, - comment: a.comment, + medicationNote: a.medicationQuestion ? a.medicationNote : undefined, }; }); @@ -97,7 +98,7 @@ export const MedicationProgress: FunctionComponent = o headerAlign: 'center', }, { - field: 'comment', + field: 'medicationNote', headerName: getString('patient_progress_medication_header_comment'), width: 300, flex: 1, @@ -109,9 +110,9 @@ export const MedicationProgress: FunctionComponent = o const recurrence = assessment.assigned && assessment.assignedDateTime ? `${assessment.frequency} on ${assessment.dayOfWeek}s, assigned on ${format( - assessment.assignedDateTime, - 'MM/dd/yyyy', - )}` + assessment.assignedDateTime, + 'MM/dd/yyyy', + )}` : 'Not assigned'; return ( @@ -134,12 +135,12 @@ export const MedicationProgress: FunctionComponent = o ].concat( assessment.assigned ? [ - { - icon: , - text: getString('patient_progress_assessment_action_configure'), - onClick: handleConfigure, - } as IActionButton, - ] + { + icon: , + text: getString('patient_progress_assessment_action_configure'), + onClick: handleConfigure, + } as IActionButton, + ] : [], )}> From c8579b483cfd09c125bda1c9b91332e77fa3054d Mon Sep 17 00:00:00 2001 From: Anant Mittal Date: Sat, 2 Apr 2022 21:07:51 -0700 Subject: [PATCH 13/19] Updated types.ts --- web_shared/types.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web_shared/types.ts b/web_shared/types.ts index 4d78a24d..12e8a37f 100644 --- a/web_shared/types.ts +++ b/web_shared/types.ts @@ -162,8 +162,14 @@ export interface IAssessmentLog extends ILog { patientSubmitted?: boolean; // NEW submittedByProviderId?: string; - pointValues: AssessmentData; + pointValues?: AssessmentData; totalScore?: number; + + // For mediation tracking + adherence?: number, + medicationQuestion?: boolean, + medicationNote?: string, + } export interface IMoodLog extends ILog { From 6de1d41ad25c9dc218631390a7be37c70410e47a Mon Sep 17 00:00:00 2001 From: Anant Mittal Date: Sat, 2 Apr 2022 21:31:40 -0700 Subject: [PATCH 14/19] Added medication tracking to progress tab --- web_patient/src/App.tsx | 2 + .../Progress/MedicationTrackingHome.tsx | 95 +++++++++++++++++++ .../src/components/Progress/ProgressPage.tsx | 6 ++ web_patient/src/services/images.ts | 2 + web_patient/src/services/routes.ts | 1 + web_patient/src/services/strings.ts | 1 + 6 files changed, 107 insertions(+) create mode 100644 web_patient/src/components/Progress/MedicationTrackingHome.tsx diff --git a/web_patient/src/App.tsx b/web_patient/src/App.tsx index 9b12900e..1251a226 100644 --- a/web_patient/src/App.tsx +++ b/web_patient/src/App.tsx @@ -6,6 +6,7 @@ import Chrome from 'src/components/Chrome/Chrome'; import HomePage from 'src/components/Home/HomePage'; import ActivityTrackingHome from 'src/components/Progress/ActivityTrackingHome'; import AssessmentHome from 'src/components/Progress/AssessmentHome'; +import MedicationTrackingHome from 'src/components/Progress/MedicationTrackingHome'; import MoodTrackingHome from 'src/components/Progress/MoodTrackingHome'; import ProgressPage from 'src/components/Progress/ProgressPage'; import AboutUsPage from 'src/components/Resources/AboutUsPage'; @@ -42,6 +43,7 @@ export const App: FunctionComponent = () => { path={`/${Routes.progress}/*`} element={ + } /> } /> } /> = observer((props) => { + const { assessmentType } = props; + const navigate = useNavigate(); + const rootStore = useStores(); + const { patientStore } = rootStore; + + const viewState = useLocalObservable<{ selectedLog?: IAssessmentLog; isOpen: boolean }>(() => ({ + selectedLog: undefined, + isOpen: false, + })); + + const handleGoBack = action(() => { + navigate(-1); + }); + + const handleLogClick = action((log: IAssessmentLog) => { + viewState.selectedLog = log; + viewState.isOpen = true; + }); + + const handleClose = action(() => { + viewState.selectedLog = undefined; + viewState.isOpen = false; + }); + + const title = 'Progress_medication_tracking_title'; + const detail_title = 'Progress_medication_tracking_title'; + const assessmentContent = rootStore.getAssessmentContent(assessmentType); + + const logs = patientStore.assessmentLogs.filter((a) => a.assessmentId.toLowerCase() == assessmentType); + + + return ( + + patientStore.loadAssessmentLogs()}> + {logs.length > 0 ? ( + + + + + {getString('Assessment_progress_column_date')} + Took all meds for last 7 days + Question or Comment for Care Team + + + + {logs.map((log, idx) => ( + handleLogClick(log)}> + + {`${format(log.recordedDateTime, 'MM/dd')}`} + + + {log.adherence == 1 + ? 'Yes' + : 'No'} + + {log.medicationNote} + + ))} + +
    +
    + ) : ( + {getString('Assessment_progress_no_data')} + )} +
    +
    + ); +}); + +export default MedicationTrackingHome; diff --git a/web_patient/src/components/Progress/ProgressPage.tsx b/web_patient/src/components/Progress/ProgressPage.tsx index 8cb587be..e7bbddc4 100644 --- a/web_patient/src/components/Progress/ProgressPage.tsx +++ b/web_patient/src/components/Progress/ProgressPage.tsx @@ -40,6 +40,12 @@ export const ProgressPage: FunctionComponent = () => { imageSrc={getImage('Progress_mood_button_image')} />
    + + +
    diff --git a/web_patient/src/services/images.ts b/web_patient/src/services/images.ts index fde31a9a..a248b2dd 100644 --- a/web_patient/src/services/images.ts +++ b/web_patient/src/services/images.ts @@ -8,6 +8,7 @@ import AboutUsImageSrc from 'src/assets/about_us_icon.png'; import CrisisResourcesImageSrc from 'src/assets/crisis_resources_icon.png'; import PhqAssessmentImageSrc from 'src/assets/assessment_phq9_depression.png'; import GadAssessmentImageSrc from 'src/assets/assessment_gad7_anxiety.png'; +import MedicationAssessmentImageSrc from 'src/assets/medication_pill.png'; import LogoutImageSrc from 'src/assets/log_out_icon.png'; const _images = { @@ -23,6 +24,7 @@ const _images = { Progress_activity_button_image: ActivityProgressImageSrc, Progress_assessment_phq_button_image: PhqAssessmentImageSrc, Progress_assessment_gad_button_image: GadAssessmentImageSrc, + Progress_assessment_medication_button_image: MedicationAssessmentImageSrc, Progress_mood_button_image: MoodLoggingImageSrc, }; diff --git a/web_patient/src/services/routes.ts b/web_patient/src/services/routes.ts index 7b575d4e..71d950a4 100644 --- a/web_patient/src/services/routes.ts +++ b/web_patient/src/services/routes.ts @@ -13,6 +13,7 @@ export const Routes = { gadProgress: 'gad', activityProgress: 'activities', moodProgress: 'mood', + medicationProgress: 'medication', }; export const Parameters = { diff --git a/web_patient/src/services/strings.ts b/web_patient/src/services/strings.ts index 85cfae09..893320d7 100644 --- a/web_patient/src/services/strings.ts +++ b/web_patient/src/services/strings.ts @@ -129,6 +129,7 @@ const _strings = { Progress_gad_assessment_title: 'Anxiety Check-In', Progress_activity_tracking_title: 'Activity Tracking', Progress_mood_tracking_title: 'Mood Tracking', + Progress_medication_tracking_title: 'Medication Tracking', Activity_tracking_column_date: 'Date', Activity_tracking_column_name: 'Activity Name', From ec53f4c772ab051e14d5199c2ba902ad95c0f13b Mon Sep 17 00:00:00 2001 From: Anant Mittal Date: Sat, 2 Apr 2022 21:46:10 -0700 Subject: [PATCH 15/19] Updated MedicationTrackingHome.tsx --- .../Progress/MedicationTrackingHome.tsx | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/web_patient/src/components/Progress/MedicationTrackingHome.tsx b/web_patient/src/components/Progress/MedicationTrackingHome.tsx index 4dc89ef3..be3f84e2 100644 --- a/web_patient/src/components/Progress/MedicationTrackingHome.tsx +++ b/web_patient/src/components/Progress/MedicationTrackingHome.tsx @@ -10,7 +10,6 @@ import { DetailPage } from 'src/components/common/DetailPage'; import ProgressDialog from 'src/components/Progress/ProgressDialog'; import { getString } from 'src/services/strings'; import { useStores } from 'src/stores/stores'; -import { getAssessmentScore } from 'src/utils/assessment'; import styled from 'styled-components'; export const ClickableTableRow = styled(TableRow)({ @@ -45,7 +44,6 @@ export const MedicationTrackingHome: FunctionComponent<{ assessmentType: string }); const title = 'Progress_medication_tracking_title'; - const detail_title = 'Progress_medication_tracking_title'; const assessmentContent = rootStore.getAssessmentContent(assessmentType); const logs = patientStore.assessmentLogs.filter((a) => a.assessmentId.toLowerCase() == assessmentType); @@ -63,8 +61,8 @@ export const MedicationTrackingHome: FunctionComponent<{ assessmentType: string {getString('Assessment_progress_column_date')} - Took all meds for last 7 days - Question or Comment for Care Team + {getString('Medication_progress_adherence')} + {getString('Medication_progress_note')} @@ -83,6 +81,42 @@ export const MedicationTrackingHome: FunctionComponent<{ assessmentType: string ))} + {viewState.selectedLog && ( + + + + + {getString('Assessment_progress_column_date')} + + {`${viewState.selectedLog?.recordedDateTime && + format( + viewState.selectedLog.recordedDateTime, + 'MM/dd/yyyy h:mm aaa', + ) + }`} + + + + {getString('Medication_progress_adherence')} + + {viewState.selectedLog?.adherence} + + + + {getString('Medication_progress_note')} + + {viewState.selectedLog?.medicationNote} + + + + } + onClose={handleClose} + /> + )} ) : ( {getString('Assessment_progress_no_data')} From 559c0709630ec0728815d4a9b9ceb41a267a161b Mon Sep 17 00:00:00 2001 From: Anant Mittal Date: Sat, 2 Apr 2022 21:46:31 -0700 Subject: [PATCH 16/19] Updated strings.ts --- web_patient/src/services/strings.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web_patient/src/services/strings.ts b/web_patient/src/services/strings.ts index 893320d7..ac02178b 100644 --- a/web_patient/src/services/strings.ts +++ b/web_patient/src/services/strings.ts @@ -129,7 +129,7 @@ const _strings = { Progress_gad_assessment_title: 'Anxiety Check-In', Progress_activity_tracking_title: 'Activity Tracking', Progress_mood_tracking_title: 'Mood Tracking', - Progress_medication_tracking_title: 'Medication Tracking', + Progress_medication_tracking_title: 'Medication Check-in', Activity_tracking_column_date: 'Date', Activity_tracking_column_name: 'Activity Name', @@ -159,8 +159,12 @@ const _strings = { Assessment_progress_column_comment: 'Note', Assessment_progress_no_data: 'There are no submitted data for this assessment.', + Medication_progress_adherence: 'Took all meds for last 7 days', + Medication_progress_note: 'Question or Comment for Care Team', + Progress_phq_assessment_detail_title: 'Depression Assessment', Progress_gad_assessment_detail_title: 'Anxiety Assessment', + Progress_medication_assessment_detail_title: 'Medication Assessment', Careplan_no_tasks: 'There are no planned activities for this day.', Careplan_view_calendar: 'Calendar view', From 19cc57187f7bbb3b91550c5d15a92f07baa937a1 Mon Sep 17 00:00:00 2001 From: Anant Mittal Date: Fri, 1 Sep 2023 13:02:06 -0700 Subject: [PATCH 17/19] Update medication progress page in patient app --- .../Progress/MedicationTrackingHome.tsx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/web_patient/src/components/Progress/MedicationTrackingHome.tsx b/web_patient/src/components/Progress/MedicationTrackingHome.tsx index be3f84e2..5dc5fa39 100644 --- a/web_patient/src/components/Progress/MedicationTrackingHome.tsx +++ b/web_patient/src/components/Progress/MedicationTrackingHome.tsx @@ -48,7 +48,6 @@ export const MedicationTrackingHome: FunctionComponent<{ assessmentType: string const logs = patientStore.assessmentLogs.filter((a) => a.assessmentId.toLowerCase() == assessmentType); - return ( {`${format(log.recordedDateTime, 'MM/dd')}`} - - {log.adherence == 1 - ? 'Yes' - : 'No'} - + {log.adherence == 1 ? 'Yes' : 'No'} {log.medicationNote} ))} @@ -92,18 +87,21 @@ export const MedicationTrackingHome: FunctionComponent<{ assessmentType: string {getString('Assessment_progress_column_date')} - {`${viewState.selectedLog?.recordedDateTime && + {`${ + viewState.selectedLog?.recordedDateTime && format( viewState.selectedLog.recordedDateTime, 'MM/dd/yyyy h:mm aaa', ) - }`} + }`} {getString('Medication_progress_adherence')} - {viewState.selectedLog?.adherence} + + {viewState.selectedLog?.adherence == 1 ? 'Yes' : 'No'} + From a0dfbb2da11270eb0c2a83f1aef924f39f206d19 Mon Sep 17 00:00:00 2001 From: Anant Mittal Date: Fri, 1 Sep 2023 13:02:24 -0700 Subject: [PATCH 18/19] Add assessment log to routes --- web_patient/src/services/routes.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/web_patient/src/services/routes.ts b/web_patient/src/services/routes.ts index f1584d3f..824e8e32 100644 --- a/web_patient/src/services/routes.ts +++ b/web_patient/src/services/routes.ts @@ -31,6 +31,7 @@ export const ParameterValues = { activityLog: 'log-activity', addActivity: 'add-activity', addActivitySchedule: 'add-activity-schedule', + assessmentLog: 'log-assessment', editActivity: 'edit-activity', editActivitySchedule: 'edit-activity-schedule', medicationLog: 'log-medication', From 0f9baf88f0db920da6ee1b4aca8afc925e0aaa16 Mon Sep 17 00:00:00 2001 From: Anant Mittal Date: Fri, 1 Sep 2023 13:02:45 -0700 Subject: [PATCH 19/19] Update assessment log type for medication --- web_shared/types.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/web_shared/types.ts b/web_shared/types.ts index f180bd46..3cfde83a 100644 --- a/web_shared/types.ts +++ b/web_shared/types.ts @@ -182,14 +182,13 @@ export interface IAssessmentLog extends ILog { patientSubmitted?: boolean; // NEW submittedByProviderId?: string; - pointValues?: AssessmentData; + pointValues: AssessmentData; totalScore?: number; // For mediation tracking - adherence?: number, - medicationQuestion?: boolean, - medicationNote?: string, - + adherence?: number; + medicationQuestion?: boolean; + medicationNote?: string; } export interface IMoodLog extends ILog {