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

Change includeArchived to archivedStatus param #6128

Closed
wants to merge 2 commits into from

Conversation

emyl3
Copy link
Collaborator

@emyl3 emyl3 commented Jul 13, 2023

BACKEND & FRONTEND PULL REQUEST

Related Issue

Resolves #6062

Changes Proposed

Update getPatients and patientsCount to accept a parameter that can return deleted users, undeleted users, or all users.

Additional Information

Test the new archivedStatus parameter!
Update the values below as you see fit.

patients

patients(
      facilityId: $facilityId
      pageNumber: 0
      pageSize: 100
      archivedStatus: $archivedStatus
      namePrefixMatch: $namePrefixMatch
      includeArchivedFacilities: $includeArchivedFacilities
    ) {
      internalId
      firstName
      lastName
      middleName
      birthDate
      gender
      telephone
      email
      emails
      phoneNumbers {
        type
        number
      }
    }

patientsCount

    patientsCount(
      facilityId: $facilityId
      archivedStatus: $archivedStatus
      namePrefixMatch: $namePrefixMatch
    ) 

Testing

Deployed on dev4 for testing

@emyl3 emyl3 force-pushed the elisa/6062-patient-query-update branch 2 times, most recently from 78b1f70 to 2dce9bd Compare July 14, 2023 16:36
@emyl3 emyl3 temporarily deployed to Dev4 July 14, 2023 18:59 — with GitHub Actions Inactive
@@ -452,11 +466,10 @@ export const DetachedTestResultsList = ({
setStartDateError("");
setEndDateError("");
}}
disabled={
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

⚠️ updated this to address a code smell related to code complexity being over 15

@emyl3 emyl3 temporarily deployed to Dev4 July 17, 2023 14:51 — with GitHub Actions Inactive
@emyl3 emyl3 marked this pull request as ready for review July 17, 2023 15:23
@fzhao99
Copy link
Contributor

fzhao99 commented Jul 17, 2023

NB for reviewers: "b2daabe8-11c8-4006-aa5f-0163869d369b" is a facility Id you can used with archived (5 total) / unarchived (4 total) patients

@@ -145,12 +146,18 @@ void roundTrip() {
"French",
null);
List<Person> all =
Copy link
Contributor

@fzhao99 fzhao99 Jul 17, 2023

Choose a reason for hiding this comment

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

Feel free to point me to it if it's existing already, but could we add a test specifically to verify that the ArchivedStatus.Archived case is covered (ie it doesn't also return the other states?). Think I see most of the existing tests just being convered over to the UNARCHIVED/ALL states but not a new one for the new state we're introducing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes! Nice catch! I forgot to push up that change 😶‍🌫️ Will tag you in some comments on this PR 😅

Copy link
Contributor

@fzhao99 fzhao99 left a comment

Choose a reason for hiding this comment

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

lgtm overall! left one suggestion.

@emyl3 emyl3 force-pushed the elisa/6062-patient-query-update branch from ed8fabc to 3c27b01 Compare July 17, 2023 18:17
assertPatientList(patients, GALE, JANNELLE, KACEY, ELIZABETH, HEINRICK);
// all facilities, deleted
List<Person> deletedPatients =
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@fzhao99 -- testing patients for "ARCHIVED" status here, all facilities

assertPatientList(patients, JANNELLE, KACEY);
// site2, deleted, "fran"
deletedPatients = _service.getPatients(site2Id, 0, 100, ArchivedStatus.ARCHIVED, "fran", false);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@fzhao99 -- testing patients for "ARCHIVED" status here from a specific facility with text "fran"

assertEquals(7, _service.getPatientsCount(site2Id, true, null, false));
assertEquals(10, _service.getPatientsCount(null, ArchivedStatus.UNARCHIVED, null, false));
assertEquals(12, _service.getPatientsCount(null, ArchivedStatus.ALL, null, false));
assertEquals(2, _service.getPatientsCount(null, ArchivedStatus.ARCHIVED, null, false));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@fzhao99 -- testing patients count for "ARCHIVED" status here, all facilities

assertEquals(2, _service.getPatientsCount(null, ArchivedStatus.ARCHIVED, null, false));
assertEquals(6, _service.getPatientsCount(site2Id, ArchivedStatus.UNARCHIVED, null, false));
assertEquals(7, _service.getPatientsCount(site2Id, ArchivedStatus.ALL, null, false));
assertEquals(1, _service.getPatientsCount(site2Id, ArchivedStatus.ARCHIVED, null, false));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@fzhao99 -- testing patients for "ARCHIVED" status here, at a particular facility

assertEquals(0, _service.getPatientsCount(null, ArchivedStatus.UNARCHIVED, "M", false));
assertEquals(0, _service.getPatientsCount(null, ArchivedStatus.UNARCHIVED, "", false));

assertEquals(1, _service.getPatientsCount(null, ArchivedStatus.ARCHIVED, "fra", false));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@fzhao99 -- testing patient count for "ARCHIVED" status here, all facilities or particular facility with text "fra" or "charles"

@emyl3 emyl3 requested a review from fzhao99 July 17, 2023 18:27
@emyl3
Copy link
Collaborator Author

emyl3 commented Jul 17, 2023

Thank you @fzhao99 for flagging that. Let me know what you think! 😸

@emyl3 emyl3 temporarily deployed to Dev4 July 17, 2023 18:31 — with GitHub Actions Inactive
@sonarcloud
Copy link

sonarcloud bot commented Jul 17, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

96.9% 96.9% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@fzhao99 fzhao99 left a comment

Choose a reason for hiding this comment

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

lgtm!

Copy link
Contributor

@johanna-skylight johanna-skylight left a comment

Choose a reason for hiding this comment

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

Code looks awesome overall. The only question that I have is whether or not this will be backwards compatible with the UI (as the UI changes are going in the same PR).

How will the two graphql operations behave for requests that are still relying on the old parameter? (case when the UI is running old code)

@emyl3
Copy link
Collaborator Author

emyl3 commented Jul 17, 2023

Code looks awesome overall. The only question that I have is whether or not this will be backwards compatible with the UI (as the UI changes are going in the same PR).

How will the two graphql operations behave for requests that are still relying on the old parameter? (case when the UI is running old code)

OOO that is a very good point. Thank you for bringing this up. This change will definitely break some views for the X number of mins a user has the old frontend.

I will put up two separate PRs and probably close this one:

  • one PR to introduce and leverage this new parameter (archivedStatus)
  • another PR to deprecate and remove support for the old parameter (includeArchived)

Let me know if this sounds good to you, @johanna-skylight! Thank you! 😸

@emyl3
Copy link
Collaborator Author

emyl3 commented Jul 18, 2023

closed in favor of #6156

@emyl3 emyl3 deleted the elisa/6062-patient-query-update branch July 19, 2023 18:20
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.

[Unarchive patient] Patients query updates
3 participants