ohcnetwork / care_fe

Care is a Digital Public Good enabling TeleICU & Decentralised Administration of Healthcare Capacity across States.
https://care.ohc.network
MIT License
242 stars 426 forks source link

Patient sorting: Bed 1-N #8511

Closed aparnacoronasafe closed 1 month ago

aparnacoronasafe commented 1 month ago

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

swayam-agrahari commented 1 month ago

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 commented 1 month ago

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

rithviknishad commented 1 month ago

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

rithviknishad commented 1 month ago

@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 commented 1 month ago

@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 commented 1 month ago

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

rithviknishad commented 1 month ago

Not sure if that's the right way.

bodhish commented 1 month ago

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;

aparnacoronasafe commented 1 month ago

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;

It isn't a critical issue that needs to be solved immediately.

There are larger 10bedicus with up to 20 beds.