-
Notifications
You must be signed in to change notification settings - Fork 211
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
(fix) O3-3211: Fix calculations for Patients and Capacity in Ward Metrics #1307
Conversation
…ns (openmrs#1294) This PR refactors the registration form's cancel modal to match new modal naming and registration conventions. Modals are now registered in the routes registry file under the `modals`. The naming convention has also changed - modals now use the `*.modal.tsx` suffix. I've also amended the modal to use Carbon's ModalBody, ModalHeader, and ModalFooter components instead of using divs with custom classes. Finally, I've amended the modal title and content to align with other confirmation modals in O3.
@@ -86,5 +97,6 @@ export function createAndGetWardPatientGrouping( | |||
wardPatientPendingCount, | |||
bedLayouts, | |||
wardUnassignedPatientsList, | |||
totalPatientsCount: wardAdmittedPatientsWithBed.size + wardUnadmittedPatientsWithBed.size, |
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.
There's also another group here: admitted patients without beds... @chibongho may potentially know how to get this metric, I'd have to dig deeper into the code to refresh my memory.
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.
Oh k i will connect @chibongho . I think it might be the wardUnassignedPatientsList ,but i will confirm with @chibongho once.
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 the safest way to calculate this would be to take the union of:
- all patients assigned to bed, which can be taken from
bedLayout[]
); and - all patients admitted to location, which can be taken from
InpatientAdmission[]
Note that those 2 groups can have overlapping patients, so be careful not to double-count.
return { | ||
patients: wardPatientGroup.totalPatientsCount.toString(), | ||
freeBeds: freeBeds.toString(), | ||
capacity: capacity.toString() + '%', |
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 should be localized so that it appears correctly in e.g. Arabic, where the percent sign is affixed to the left side.
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.
Yeah sure @brandones , i will make the changes. Thanks.
Mind fixing the conflicts, @kb019? |
|
||
interface WardMetricProps { | ||
metricName: string; | ||
metricValue: string; | ||
isLoading: boolean; | ||
} | ||
const WardMetric: React.FC<WardMetricProps> = ({ metricName, metricValue, isLoading }) => { | ||
const { i18n } = useTranslation(); |
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.
Usually, this is done as a interpolated translation string, like this:
Lines 51 to 54 in 6822458
return t('encounterDisplay', '{{encounterType}} {{encounterDate}}', { | |
encounterType: obs.encounter.encounterType.display, | |
encounterDate: new Date(obs.encounter.encounterDatetime).toLocaleDateString(), | |
interpolation: { escapeValue: false }, |
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.
Hi @chibongho , removed i18n here , seems the direction automatically handeled in the document. Thanks
Hi @denniskigen , i merged the conflicts . Thank you. |
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.
Looks good. thanks!
Requirements
Summary
https://openmrs.atlassian.net/browse/O3-3211
This ticket is for fixing the calulations of Patients and bed Capacity displayed in ward metrics which is described in ticket above.
Screenshots