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

Patient sorting: Bed 1-N #8511

Open
aparnacoronasafe opened this issue Sep 9, 2024 · 8 comments
Open

Patient sorting: Bed 1-N #8511

aparnacoronasafe opened this issue Sep 9, 2024 · 8 comments
Assignees

Comments

@aparnacoronasafe
Copy link
Member

Describe the bug
CARE has option to sort patient list by the bed number they are assigned to.

But the feature is not working as expected

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'patient list (live)'
  2. Click on 'sort by' and select "Bed 1-N"
  3. Scroll down to View the patient list
  4. See error. The beds are sorted as Bed 1, 10, 11, 12...19, 2, 21, 22.....

Expected behavior
The sorting should be as Bed 1,2,3,4......and so on

@aparnacoronasafe aparnacoronasafe added the good first issue Good for newcomers label Sep 9, 2024
@swayam-agrahari
Copy link

Hi @aparnacoronasafe, I would like to work on this issue. I have set up the project locally. I have a doubt, when I add a sort 1-N filter, how can I identify the bed number?
ps: This is my first issue. I'm new to opensource
Screenshot_10-Sep_04-18-00_6619

@xakep8
Copy link
Contributor

xakep8 commented Sep 13, 2024

@aparnacoronasafe @rithviknishad could you please assign this issue to me.

@rithviknishad
Copy link
Member

Hey, sure! Could you specify how this is going to be solved?

@rithviknishad
Copy link
Member

rithviknishad commented Sep 13, 2024

@swayam-agrahari
Currently it is sorting by the 'name' attribute of the bed object by the backend. Bed number is part of the name.

https://github.com/ohcnetwork/care/blob/develop/care/facility/api/viewsets/patient.py#L455

https://github.com/ohcnetwork/care/blob/develop/care/facility/models/bed.py#L20

@xakep8
Copy link
Contributor

xakep8 commented Sep 14, 2024

@rithviknishad we could seperate the number from the name while filtering and based on the number and name we could sort the names and return the data, for the beds with same number but different names we could just let the names be sorted by the lexicographical order, while the whole list is first sorted based on bed number, this way we wouldn't need to modify the schema and the filtering will also work just fine

@xakep8
Copy link
Contributor

xakep8 commented Sep 16, 2024

@rithviknishad is there some other way we could do it?

@rithviknishad
Copy link
Member

Not sure if that's the right way.

@bodhish
Copy link
Member

bodhish commented Sep 19, 2024

Having a sort order for the best is the solution here. Bed number should be independent from sort order.
@aparnacoronasafe how big a pain is this? I am assuming most 10 beds just have 10 beds so it maynot be a large issue here;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Triage
Development

No branches or pull requests

7 participants