Skip to content
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

Merged
merged 23 commits into from
Sep 23, 2024

Conversation

kb019
Copy link
Contributor

@kb019 kb019 commented Sep 4, 2024

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

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

image

kb019 and others added 15 commits June 26, 2024 19:38
…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,
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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() + '%',
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@denniskigen
Copy link
Member

Mind fixing the conflicts, @kb019?


interface WardMetricProps {
metricName: string;
metricValue: string;
isLoading: boolean;
}
const WardMetric: React.FC<WardMetricProps> = ({ metricName, metricValue, isLoading }) => {
const { i18n } = useTranslation();
Copy link
Contributor

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:

return t('encounterDisplay', '{{encounterType}} {{encounterDate}}', {
encounterType: obs.encounter.encounterType.display,
encounterDate: new Date(obs.encounter.encounterDatetime).toLocaleDateString(),
interpolation: { escapeValue: false },

Copy link
Contributor Author

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

@kb019
Copy link
Contributor Author

kb019 commented Sep 18, 2024

Mind fixing the conflicts, @kb019?

Hi @denniskigen , i merged the conflicts . Thank you.

@kb019
Copy link
Contributor Author

kb019 commented Sep 18, 2024

All the e2e tests pass in my local.I think the failure is not related to ward app.
image

Copy link
Contributor

@chibongho chibongho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. thanks!

@chibongho chibongho merged commit bc531a6 into openmrs:main Sep 23, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants