-
Notifications
You must be signed in to change notification settings - Fork 40
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
(refactor) Add workflows to pmtct summary in patient chart #1868
Conversation
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 we should also convert the Summary cards, @lucyjemutai already made a function that you can reuse for summary cards, that way, we shall get rid of all that columns code and move it to schema configs.
return encounter.patient.age; | ||
} | ||
|
||
if (actionOptions?.formName === 'selectMchForm') { |
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.
I think this should be put in the builder file where we are constructing form actions because in this getObsFromEncounter
function, only other columns other than actions use that function, so actions can be handled in their own function. Check something I did about conditional actions in the covid lab results table, you might need something like that.
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 @hadijahkyampeire I realised the error is there in in cacx and Tb modues as well on dev..
e16bd75
to
2fc6d94
Compare
@CynthiaKamau sorry about the conflicts, I think they are from the Eslint rule PR that just got merged. |
2fc6d94
to
1502c5b
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.
This is getting closer but I just noticed some other visual issues, let's have a call about them.
@@ -109,6 +109,20 @@ export const getTabColumns = (columnsDefinition: Array<ColumnDefinition>) => { | |||
} | |||
}); | |||
} | |||
if (column?.conditionalActionOptions?.length) { |
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.
This condition is similar to the one up, why can't you move that logic up or if anything is different you might wanna add it to the condition.
@@ -85,6 +85,7 @@ export function getObsFromEncounter( | |||
type?: string, | |||
fallbackConcepts?: Array<string>, | |||
secondaryConcept?: string, | |||
actionOptions?: any, |
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.
you forgot to remove this.
if (column.isConditionalConcept) { | ||
return getConditionalConceptValue(encounter, column.conditionalConceptMappings, column.isDate); | ||
return getConditionalConceptValue(encounter, column.conditionalconditionalConceptMappings, column.isDate); |
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.
This naming seems wrong, why change it to this?
} | ||
|
||
if (column.id == 'artInitiation' && column.encounterTypes?.length > 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 agreed not to use name specific conditions like art, because we want some of these functions to be reused, you might wanna do something like what I did for ART date and Reason.
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.
Also instead of using column.id, we can use the type field because ids might be different but types can be similar.
@@ -24,15 +53,45 @@ export const getSummaryCardProps = (schemaConfig, config = null) => { | |||
}, | |||
getObsSummary: async (encounters) => { | |||
const summaryValues = encounters.map((encounter) => { | |||
if (encounter && encounter.observation && encounter.observation.value) { | |||
if (column.encounterType === 'antenatal' && column.id === 'nextAppointmentDate') { |
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.
Same here, prefer using type to column id.
"isDate": true, | ||
"title": "Enrollment Date", | ||
"encounterTypes": ["motherPostnatal", "labourAndDelivery", "antenatal"], | ||
"concept": "161552AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" |
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.
Same here
"encounterTypes": [ | ||
"af1f1b24-d2e8-4282-b308-0bf79b365584" | ||
], | ||
"concept": "1148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" |
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.
Same here, let's not hardcode the concept uuids
"encounterTypes": [ | ||
"af1f1b24-d2e8-4282-b308-0bf79b365584" | ||
], | ||
"concept": "1151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" |
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.
Same here
"encounterTypes": [ | ||
"af1f1b24-d2e8-4282-b308-0bf79b365584" | ||
], | ||
"concept": "164460AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" |
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.
Same
"encounterTypes": [ | ||
"af1f1b24-d2e8-4282-b308-0bf79b365584" | ||
], | ||
"concept": "160433AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" |
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.
Same
d784f0a
to
acdb03b
Compare
acdb03b
to
8fc877b
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.
This looks good thanks @CynthiaKamau
Requirements
OHRI-123 My PR title
.Summary
-This pr refactors the code in the pmtct patient summary to use the new workflows approach
Screenshots
Related Issue
Other