-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(feat) O3-3316 Add support for encounter diagnosis #298
base: main
Are you sure you want to change the base?
Conversation
Size Change: -264 kB (-17.22%) 👏 Total Size: 1.27 MB
ℹ️ View Unchanged
|
@CynthiaKamau Ping, are you still working on this? Any blockers? |
Yes, there some fixes that need to be done on the backend to complete the work |
@CynthiaKamau Please provide links to the work or issues you're talking about. If there is no linkable issue/PR/talk/Slack, please tell us what work needs to be completed before this can move forward. |
This is the link to the backend pr |
Ok @CynthiaKamau , looks like that backend PR is merged. Can we move forward with this? |
a40ba8d
to
2415c6d
Compare
Im working on it now |
e5de3c9
to
63ad98e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @CynthiaKamau! Are you planning on adding some test coverage?
bc33d5d
to
089214e
Compare
Ping @samuelmale |
@brandones I left a few more comments for @CynthiaKamau |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the great work @CynthiaKamau!
To make this more generic and practical, we need a way to extend the data source to load concepts from custom concept classes and, optionally, sets.
questionOptions: {
diagnosis: {
rank?: number;
isConfirmed?: boolean;
conceptClasses?: Array<string>;
conceptSet?: string;
}
}
cc: @ibacher
Is it supported by the backend ? I remember the question with the type problem had the same challenge |
f726e01
to
ca83cf3
Compare
e30f21c
to
2acf728
Compare
e048078
to
3acc948
Compare
c424cf2
to
f306ec1
Compare
1bbba35
to
025ca74
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CynthiaKamau can we add some integration test case(s)? One capturing and editing diagnosis would be super imperative!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CynthiaKamau any chance we can add some integrational tests? Here is an example of the "Obs Group": https://github.com/openmrs/openmrs-esm-form-engine-lib/blob/main/src/form-engine.test.tsx#L878-L1007
@samuelmale please review the latest changes |
return previousDiagnosis.value !== newValue; | ||
} | ||
|
||
export function voidDiagnosis(obs: OpenmrsObs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export function voidDiagnosis(obs: OpenmrsObs) { | |
export function voidDiagnosis(diagnosis: OpenmrsResource) { |
return Promise.resolve([ | ||
{ | ||
uuid: 'aaa-1', | ||
display: 'Kololo', | ||
}, | ||
{ | ||
uuid: 'aaa-2', | ||
display: 'Naguru', | ||
}, | ||
{ | ||
uuid: 'aaa-3', | ||
display: 'Muyenga', | ||
}, | ||
]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need locations for your test case?
@@ -1047,6 +1098,86 @@ describe('Form engine component', () => { | |||
}); | |||
}); | |||
|
|||
describe('Diagnisis field', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
describe('Diagnisis field', () => { | |
describe('Encounter Diagnosis', () => { |
const addButtons = screen.getAllByRole('button', { name: 'Add' }); | ||
expect(addButtons.length).toBeGreaterThan(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We always have a single "Add" button in a repeat section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}); | ||
const addButtons = screen.getAllByRole('button', { name: 'Add' }); | ||
expect(addButtons.length).toBeGreaterThan(0); | ||
screen.debug(addButtons); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a debug leftover?
it('should save diagnosis field on form submission', async () => { | ||
await act(async () => { | ||
renderForm(null, diagnosisForm); | ||
}); | ||
const saveEncounterMock = jest.spyOn(api, 'saveEncounter'); | ||
|
||
const combobox = await screen.findByRole('combobox', { name: /test diagnosis 1/i }); | ||
expect(combobox).toBeInTheDocument(); | ||
|
||
await userEvent.click(combobox); | ||
await waitFor(() => { | ||
expect(screen.getByText('stage 1')).toBeInTheDocument(); | ||
expect(screen.getByText('stage 2')).toBeInTheDocument(); | ||
}); | ||
await user.click(screen.getByText('stage 1')); | ||
await user.click(screen.getByRole('button', { name: /save/i })); | ||
expect(saveEncounterMock).toHaveBeenCalledTimes(1); | ||
const [_, encounter] = saveEncounterMock.mock.calls[0]; | ||
expect(encounter.diagnoses.length).toBe(1); | ||
expect(encounter.diagnoses[0]).toEqual({ | ||
patient: '8673ee4f-e2ab-4077-ba55-4980f408773e', | ||
condition: null, | ||
diagnosis: { | ||
coded: 'stage-1-uuid', | ||
}, | ||
certainty: 'CONFIRMED', | ||
rank: 1, | ||
formFieldPath: `rfe-forms-diagnosis1`, | ||
formFieldNamespace: 'rfe-forms', | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a unit test validating that the "repeating container" is properly constructed in edit mode?
Requirements
Summary
This feature attempts to introduce encounter diagnosis in RFE
Current AFE Schema :
Proposed schema as in RFE :
Screenshots
Screen.Recording.2024-11-27.at.15.11.12.mov
Related Issue
Other