Skip to content

Commit

Permalink
Merge pull request #87 from chronic-care/develop
Browse files Browse the repository at this point in the history
Release 2.3.0
  • Loading branch information
swmuir authored Jul 31, 2024
2 parents b4042cd + 378ced3 commit eced2f4
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 57 deletions.
9 changes: 2 additions & 7 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,13 @@ GENERATE_SOURCEMAP=false
# REACT_APP_SHARED_DATA_AUTH_ENDPOINT=
# REACT_APP_SHARED_DATA_SCOPE="launch/patient openid fhirUser patient/*.read patient/*.write"

REACT_APP_SHARED_DATA_ENDPOINT=http://localhost:8080/fhir
REACT_APP_SHARED_DATA_AUTH_ENDPOINT=https://gw.interop.community/MCCDevelopment/data
REACT_APP_SHARED_DATA_SCOPE="launch/patient openid fhirUser patient/* user/*.cruds patient/*.cruds"


# These 2 parameters are only used when Shared Data is a separate FHIR server with its own SMART launch flow.
REACT_APP_SHARED_DATA_CLIENT_ID=
REACT_APP_SHARED_DATA_REDIRECT_URI="./index.html"


REACT_APP_MELD_SANDBOX_NAME=MCCDevelopment
REACT_APP_MELD_SANDBOX_CLIENT_ID=5fa54c47-ed80-405b-a0b7-611eee5d0159
REACT_APP_MELD_SANDBOX_CLIENT_ID=<...>

# Logica sandbox
REACT_APP_CLIENT_ID_logica=<...>
Expand Down Expand Up @@ -94,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
5 changes: 4 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -821,9 +821,12 @@ class App extends React.Component<AppProps, AppState> {
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 (
<div className="app">

Expand Down
15 changes: 14 additions & 1 deletion src/components/edit-forms/ConditionEditForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -22,6 +22,7 @@ export default function ConditionEditForm(formData?: EditFormData) {
const [onsetDate, setStartDate] = React.useState<Date | null>(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
Expand Down Expand Up @@ -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()
Expand Down
32 changes: 31 additions & 1 deletion src/components/edit-forms/GoalEditForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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
Expand Down Expand Up @@ -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()
};

Expand Down
26 changes: 20 additions & 6 deletions src/components/summaries/ConditionList.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import '../../Home.css';
import React, { FC, useEffect, useState } from 'react';
import { Link } from 'react-router-dom';
import { useHistory } from 'react-router-dom';
import { FHIRData, displayDate } from '../../data-services/models/fhirResources';
import { ConditionSummary } from '../../data-services/models/cqlSummary';
import { Summary, SummaryRowItem, SummaryRowItems } from './Summary';
import { BusySpinner } from '../busy-spinner/BusySpinner';
import { SortModal } from '../sort-modal/sortModal';
import { SortOnlyModal } from '../sort-only-modal/sortOnlyModal';
import { Button } from '@mui/material';

interface ConditionListProps {
fhirDataCollection?: FHIRData[];
Expand All @@ -15,6 +17,7 @@ interface ConditionListProps {
}

export const ConditionList: FC<ConditionListProps> = ({ fhirDataCollection, conditionSummaryMatrix, canShareData }) => {
const history = useHistory();
process.env.REACT_APP_DEBUG_LOG === "true" && console.log("ConditionList component RENDERED!")
const [showModal, setShowModal] = useState(false);
const [sortingOption, setSortingOption] = useState<string>('');
Expand Down Expand Up @@ -104,6 +107,16 @@ export const ConditionList: FC<ConditionListProps> = ({ fhirDataCollection, cond
setSortedAndFilteredConditions(combinedConditions);
};

function handleEditClick(condition: ConditionSummary, conditionSummaryMatrix?: ConditionSummary[][]): void {
history.push({
pathname: '/condition-edit',
state: {
condition: condition,
conditionSummaryMatrix :conditionSummaryMatrix
}
});
}

return (
<div className="home-view">
<div className="welcome">
Expand All @@ -118,9 +131,9 @@ export const ConditionList: FC<ConditionListProps> = ({ fhirDataCollection, cond

{canShareData && (
<p>
<Link to={{ pathname: '/condition-edit', state: { fhirDataCollection } }}>
<Button variant="contained" color="primary" onClick={() => handleEditClick({} as ConditionSummary)}>
Add a Health Concern
</Link>
</Button>
</p>
)}

Expand Down Expand Up @@ -176,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'),
Expand All @@ -201,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)
Expand Down
15 changes: 8 additions & 7 deletions src/components/summaries/GoalList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -109,14 +109,15 @@ export const GoalList: FC<GoalListProps> = ({ 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
}
});
};
Expand All @@ -138,7 +139,7 @@ export const GoalList: FC<GoalListProps> = ({ fhirDataCollection, goalSummaryMat

{canShareData && (
<p>
<Button variant="contained" color="primary" onClick={() => handleEditClick({} as GoalSummary)}>
<Button variant="contained" color="primary" onClick={() => handleEditClick({} as GoalSummary,goalSummaryMatrix as GoalSummary[][])}>
Add a New Goal
</Button>
</p>
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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),
};
};
36 changes: 3 additions & 33 deletions src/data-services/fhirService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion src/data-services/models/cqlSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export interface EditFormData {
fhirDataCollection?: FHIRData[],
patientSummaries?: PatientSummary[],
supplementalDataClient?: Client,
canShareData?: boolean
canShareData?: boolean,
goalSummaryMatrix? : GoalSummary[][],
conditionSummaryMatrix?: ConditionSummary[][]
}

export interface SummaryData {
Expand Down

0 comments on commit eced2f4

Please sign in to comment.