From a6e5bcc5a96c2c5f4be27363d6eb4345e9000795 Mon Sep 17 00:00:00 2001 From: Sean <> Date: Wed, 31 Jul 2024 10:32:54 -0400 Subject: [PATCH] Updates for SDS Added refresh for add goals feature Added refresh for add health concerns feature --- .env | 2 +- src/App.tsx | 5 ++- .../edit-forms/ConditionEditForm.tsx | 15 +++++++- src/components/edit-forms/GoalEditForm.tsx | 32 ++++++++++++++++- src/components/summaries/ConditionList.tsx | 14 ++++---- src/components/summaries/GoalList.tsx | 15 ++++---- src/data-services/fhirService.ts | 36 ++----------------- src/data-services/models/cqlSummary.ts | 4 ++- 8 files changed, 72 insertions(+), 51 deletions(-) diff --git a/.env b/.env index ad96fe3..1a1bd27 100644 --- a/.env +++ b/.env @@ -89,6 +89,6 @@ REACT_APP_LOG_ENABLED=false REACT_APP_LOG_API_KEY=<...> REACT_APP_LOG_ENDPOINT_URI="http://localhost:8085" -REACT_APP_VERSION="version - 2.2.3" +REACT_APP_VERSION="version - 2.3.0" # Set to have HHS Banner REACT_APP_HHS_BANNER=false \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx index 03e2098..64848f7 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -821,9 +821,12 @@ class App extends React.Component { fhirDataCollection: this.state.fhirDataCollection, patientSummaries: this.state.patientSummaries, supplementalDataClient: this.state.supplementalDataClient, - canShareData: this.state.canShareData + canShareData: this.state.canShareData, + goalSummaryMatrix: this.state.goalSummaries, + conditionSummaryMatrix: this.state.conditionSummaries } + return (
diff --git a/src/components/edit-forms/ConditionEditForm.tsx b/src/components/edit-forms/ConditionEditForm.tsx index 56fff0d..2ed1ec3 100644 --- a/src/components/edit-forms/ConditionEditForm.tsx +++ b/src/components/edit-forms/ConditionEditForm.tsx @@ -11,7 +11,7 @@ import LocalizationProvider from '@mui/lab/LocalizationProvider'; import TextField from '@mui/material/TextField'; import Typography from '@mui/material/Typography'; -import { EditFormData } from '../../data-services/models/cqlSummary'; +import { ConditionSummary, EditFormData } from '../../data-services/models/cqlSummary'; import { Condition } from '../../data-services/fhir-types/fhir-r4'; import { createSharedDataResource } from '../../data-services/fhirService'; @@ -22,6 +22,7 @@ export default function ConditionEditForm(formData?: EditFormData) { const [onsetDate, setStartDate] = React.useState(null) const patientID = formData?.supplementalDataClient?.getPatientId() + const patientName: string | null = null // TODO: find patient with matching ID from formData?patientSummaries const fhirUser = formData?.supplementalDataClient?.getFhirUser() const userName: string | null = null // TODO: find user with matching ID from formData?patientSummaries or CareTeam @@ -89,6 +90,18 @@ export default function ConditionEditForm(formData?: EditFormData) { createSharedDataResource(condition) + var cs: ConditionSummary = { + ConceptName: description ? description : '', + OnsetDate: onsetDate?.toISOString(), + RecordedDate: new Date().toISOString(), + Recorder: undefined, + Asserter: undefined + } + + if (formData?.conditionSummaryMatrix) { + formData?.conditionSummaryMatrix[0].push(cs) + } + // update FHIRData shared state history.goBack() diff --git a/src/components/edit-forms/GoalEditForm.tsx b/src/components/edit-forms/GoalEditForm.tsx index 4e4d6d7..bd4c6ee 100644 --- a/src/components/edit-forms/GoalEditForm.tsx +++ b/src/components/edit-forms/GoalEditForm.tsx @@ -12,7 +12,7 @@ import LocalizationProvider from '@mui/lab/LocalizationProvider'; import TextField from '@mui/material/TextField'; import Typography from '@mui/material/Typography'; -import { EditFormData } from '../../data-services/models/cqlSummary'; +import { EditFormData, GoalSummary, GoalTarget } from '../../data-services/models/cqlSummary'; import { Goal } from '../../data-services/fhir-types/fhir-r4'; import { createSharedDataResource } from '../../data-services/fhirService'; @@ -32,6 +32,7 @@ export default function GoalEditForm(formData?: EditFormData) { ); const patientID = formData?.supplementalDataClient?.getPatientId() + const patientName: string | null = null // TODO: find patient with matching ID from formData?patientSummaries const fhirUser = formData?.supplementalDataClient?.getFhirUser() const userName: string | null = null // TODO: find user with matching ID from formData?patientSummaries or CareTeam @@ -79,6 +80,35 @@ export default function GoalEditForm(formData?: EditFormData) { createSharedDataResource(goal,formData?.fhirDataCollection) + var gs: GoalSummary = { + Description: descriptionCodeable.text, + + // Category?: string, + // Description: string, + // ExpressedBy: expressedByRef, + StartDate: startDate?.toISOString(), + Target: [], + LifecycleStatus: 'active', + AchievementStatus: achievementStatus.text + // Addresses?: DataElementSummary[], + // Notes?: string[], + // Provenance?: ProvenanceSummary[], + // LearnMore?: string + + + } + + gs.Target?.push({} as GoalTarget); + if (gs.Target) { + gs.Target[0].DueDate = dueDate?.toISOString() + } + + + if (formData?.goalSummaryMatrix) { + formData?.goalSummaryMatrix[0].push(gs) + } + + history.goBack() }; diff --git a/src/components/summaries/ConditionList.tsx b/src/components/summaries/ConditionList.tsx index 69e5651..65c4e94 100644 --- a/src/components/summaries/ConditionList.tsx +++ b/src/components/summaries/ConditionList.tsx @@ -107,11 +107,12 @@ export const ConditionList: FC = ({ fhirDataCollection, cond setSortedAndFilteredConditions(combinedConditions); }; - function handleEditClick(condition: ConditionSummary): void { + function handleEditClick(condition: ConditionSummary, conditionSummaryMatrix?: ConditionSummary[][]): void { history.push({ pathname: '/condition-edit', state: { - condition: condition + condition: condition, + conditionSummaryMatrix :conditionSummaryMatrix } }); } @@ -188,10 +189,11 @@ const buildRows = (cond: ConditionSummary, theSource?: string): SummaryRowItems } rows.push(conditionName) + const author: SummaryRowItem | undefined = - cond.Recorder === null && cond.Asserter === null + cond.Recorder == null && cond.Asserter == null ? undefined - : { + : { isHeader: false, twoColumns: true, data1: 'Author: ' + (cond.Recorder ?? cond.Asserter ?? 'Unknown'), @@ -213,8 +215,8 @@ const buildRows = (cond: ConditionSummary, theSource?: string): SummaryRowItems isHeader: false, twoColumns: true, // Still need null checks as one item or the other could be null, just not both - data1: cond.RecordedDate === null ? '' : 'Recorded: ' + displayDate(cond.RecordedDate), - data2: cond.AssertedDate === null ? '' : 'Asserted: ' + displayDate(cond.AssertedDate), + data1: cond.RecordedDate == null ? '' : 'Recorded: ' + displayDate(cond.RecordedDate), + data2: cond.AssertedDate == null ? '' : 'Asserted: ' + displayDate(cond.AssertedDate), } if (recordedAndAssertedDates !== undefined) { rows.push(recordedAndAssertedDates) diff --git a/src/components/summaries/GoalList.tsx b/src/components/summaries/GoalList.tsx index 155a534..9c4a918 100644 --- a/src/components/summaries/GoalList.tsx +++ b/src/components/summaries/GoalList.tsx @@ -2,7 +2,7 @@ import '../../Home.css'; import React, { FC, useEffect, useState } from 'react'; import { Link } from 'react-router-dom'; import { useHistory } from 'react-router-dom'; -import { FHIRData } from '../../data-services/models/fhirResources'; +import { displayDate, FHIRData } from '../../data-services/models/fhirResources'; import { GoalSummary, GoalTarget } from '../../data-services/models/cqlSummary'; import { Summary, SummaryRowItem, SummaryRowItems } from './Summary'; import { BusySpinner } from '../busy-spinner/BusySpinner'; @@ -109,14 +109,15 @@ export const GoalList: FC = ({ fhirDataCollection, goalSummaryMat setSortedAndFilteredGoals(combinedGoals); }; - const handleEditClick = (goal: GoalSummary) => { + const handleEditClick = (goal: GoalSummary,goalSummaryMatrix:GoalSummary[][]) => { history.push({ pathname: '/goal-edit', state: { goalData: goal, prepopulatedDescription: goal.Description, prepopulatedDate: goal.StartDate || null, - prepopulatedDueDate: goal?.Target?.[0]?.DueDate || null + prepopulatedDueDate: goal?.Target?.[0]?.DueDate || null, + goalSummaryMatrix : goalSummaryMatrix } }); }; @@ -138,7 +139,7 @@ export const GoalList: FC = ({ fhirDataCollection, goalSummaryMat {canShareData && (

-

@@ -197,7 +198,7 @@ const buildRows = (goal: GoalSummary, theSource?: string): SummaryRowItems => { isHeader: false, twoColumns: true, data1: goal.ExpressedBy, - data2: goal.StartDate === null ? '' : 'Start: ' + goal.StartDate, + data2: goal.StartDate === null ? '' : 'Start: ' + displayDate(goal.StartDate), }, ]; //add "SDS Data" instead of "Data SDS" @@ -340,7 +341,7 @@ const buildTargetValueAndDueDate = (curTarget: GoalTarget): SummaryRowItem => { return { isHeader: false, twoColumns: true, - data1: curTarget.TargetValue === null ? '' : 'Target: ' + curTarget.TargetValue, - data2: curTarget.DueDate === null ? '' : 'Due: ' + curTarget.DueDate, + data1: curTarget.TargetValue == null ? '' : 'Target: ' + curTarget.TargetValue, + data2: curTarget.DueDate === null ? '' : 'Due: ' + displayDate(curTarget.DueDate), }; }; \ No newline at end of file diff --git a/src/data-services/fhirService.ts b/src/data-services/fhirService.ts index a30aead..d03fc3a 100644 --- a/src/data-services/fhirService.ts +++ b/src/data-services/fhirService.ts @@ -858,44 +858,14 @@ export function createSharedDataResource(resource: Resource, fhirDataCollection? return client?.create(resource as fhirclient.FHIR.Resource) }) .then((response) => { - - if (resource.resourceType === "Goal") { fhirDataCollection?.forEach(fhirData => { - - console.error('fhirData : ' + fhirData.serverUrl) ; - console.error('fhirData : ' + fhirData.isSDS) ; - console.error('fhirData : ' + fhirData.serverUrl) ; - console.error('fhirData : ' + fhirData.isSDS) ; - console.error('fhirData : ' + fhirData.serverUrl) ; - console.error('fhirData : ' + fhirData.isSDS) ; - console.error('fhirData : ' + fhirData.serverUrl) ; - console.error('fhirData : ' + fhirData.isSDS) ; - console.error('fhirData : ' + fhirData.serverUrl) ; - console.error('fhirData : ' + fhirData.isSDS) ; - console.error('fhirData : ' + fhirData.serverUrl) ; - console.error('fhirData : ' + fhirData.isSDS) ; - console.error('fhirData : ' + fhirData.serverUrl) ; - console.error('fhirData : ' + fhirData.isSDS) ; - console.error('fhirData : ' + fhirData.serverUrl) ; - console.error('fhirData : ' + fhirData.isSDS) ; if (fhirData.isSDS) { - fhirData.goals?.push(resource as Goal); - - console.error('fhirData : ' + JSON.stringify(fhirData.goals)) ; + // fhirData.goals?.push(resource as Goal); } - // let index = selected.indexOf(value) - // if (index > -1) { - // selected.splice(index, 1) - // } - // else { - // selected.push(value) - // } - }) - // this.setState({selectedOptions: selected}) - // } + } + ) } - console.error('SDS client: ' + JSON.stringify(fhirDataCollection)) ; return response }).catch(error => { console.log('Cannot create shared data resource: ' + resource.resourceType + '/' + resource.id + ' error: ', error) diff --git a/src/data-services/models/cqlSummary.ts b/src/data-services/models/cqlSummary.ts index 5c419d2..fcadbbf 100644 --- a/src/data-services/models/cqlSummary.ts +++ b/src/data-services/models/cqlSummary.ts @@ -12,7 +12,9 @@ export interface EditFormData { fhirDataCollection?: FHIRData[], patientSummaries?: PatientSummary[], supplementalDataClient?: Client, - canShareData?: boolean + canShareData?: boolean, + goalSummaryMatrix? : GoalSummary[][], + conditionSummaryMatrix?: ConditionSummary[][] } export interface SummaryData {