-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds patient relationship mocks to VAOS (#33349)
* Adds getPatientRelationships to the VAOS service Signed-off-by: Ryan Shaw <[email protected]> * Stubbed out patient relationship mock Signed-off-by: Ryan Shaw <[email protected]> * Updated patient relationship mock data Signed-off-by: Ryan Shaw <[email protected]> * Stubs out transformer * Stub out types * Flattened relationship object * Updated types * Moved typedef’s * Name changes for consistency * Removes chained parseApiObject, will not work with endpoint * Updates types * Updates transformer to deal with array in response * Added additional mock * Updates service * Stubs out actions and reducers * Updates patient service * Adds reducer * Updates action * Added TODO and cleaned up * Adds failed reducer for providers and updates action * Adds selectors * Adds comment * Adds new hook for fetching patient provider relationships * Adds TODO * Updates types * Fixes transformer * Types reorg * Adds unit test * Update comment * Update src/applications/vaos/services/patient/types.js Co-authored-by: John Luo <[email protected]> * Adds links to GH issue * Updates comment style --------- Signed-off-by: Ryan Shaw <[email protected]> Co-authored-by: John Luo <[email protected]>
- Loading branch information
Showing
12 changed files
with
352 additions
and
46 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/applications/vaos/new-appointment/hooks/useGetPatientRelationships.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { useEffect } from 'react'; | ||
import { useSelector, shallowEqual, useDispatch } from 'react-redux'; | ||
import { FETCH_STATUS } from '../../utils/constants'; | ||
import { useOHDirectScheduling } from './useOHDirectScheduling'; | ||
import { getPatientProviderRelationships } from '../redux/selectors'; | ||
import { fetchPatientProviderRelationships } from '../redux/actions'; | ||
|
||
export function useGetPatientRelationships() { | ||
const dispatch = useDispatch(); | ||
const featureOHDirectSchedule = useOHDirectScheduling(); | ||
|
||
const { | ||
patientProviderRelationships, | ||
patientProviderRelationshipsStatus, | ||
} = useSelector( | ||
state => getPatientProviderRelationships(state), | ||
shallowEqual, | ||
); | ||
|
||
useEffect( | ||
() => { | ||
if ( | ||
featureOHDirectSchedule && | ||
!patientProviderRelationships.length && | ||
patientProviderRelationshipsStatus === FETCH_STATUS.notStarted | ||
) { | ||
dispatch(fetchPatientProviderRelationships()); | ||
} | ||
}, | ||
[ | ||
dispatch, | ||
featureOHDirectSchedule, | ||
patientProviderRelationshipsStatus, | ||
patientProviderRelationships, | ||
], | ||
); | ||
return { | ||
patientProviderRelationships, | ||
patientProviderRelationshipsStatus, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/applications/vaos/services/mocks/v2/patient_provider_relationships.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"type": "relationship", | ||
"attributes": { | ||
"type": "string", | ||
"attributes": { | ||
"provider": { | ||
"cernerId": "Practitioner/123456", | ||
"name": "Doe, John D, MD" | ||
}, | ||
"location": { | ||
"vhaFacilityId": "string", | ||
"name": "Marion VA Clinic" | ||
}, | ||
"clinic": { | ||
"vistaSite": "534", | ||
"ien": "6569", | ||
"name": "Zanesville Primary Care" | ||
}, | ||
"serviceType": { | ||
"coding": [ | ||
{ | ||
"code": "Routine Follow-up" | ||
} | ||
], | ||
"text": "string" | ||
}, | ||
"lastSeen": "2024-11-26T00:32:34.216Z" | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "relationship", | ||
"attributes": { | ||
"type": "string", | ||
"attributes": { | ||
"provider": { | ||
"cernerId": "Practitioner/1111", | ||
"name": "Doe, Mary D, MD" | ||
}, | ||
"location": { | ||
"vhaFacilityId": "string", | ||
"name": "Marion VA Clinic" | ||
}, | ||
"clinic": { | ||
"vistaSite": "534", | ||
"ien": "6569", | ||
"name": "Zanesville Primary Care" | ||
}, | ||
"serviceType": { | ||
"coding": [ | ||
{ | ||
"code": "New Problem" | ||
} | ||
], | ||
"text": "string" | ||
}, | ||
"lastSeen": "2024-10-15T00:32:34.216Z" | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.