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

refactor: assign less than min threshold students to previous center #51

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ashiishme
Copy link

The new implementation fixes the #13 of allocating small amount of students to a new center.

Details

  • The center allocation works exactly as it was before, allocating the total students based on calc_per_center
  • If there are any remaining students ( less than MIN_STUDENT_IN_CENTER ), they are assigned to the first center of that specific school.
  • If there are any remaining students ( greater than MIN_STUDENT_IN_CENTER ), they are assigned to a new center

The PR also abstract the center allocation logic to a new function allocate_to_centers.

I saw that there is a WIP PR related to the unit test. I can also add the test for allocate_to_centers function once the that PR is merged to make sure that the allocation is working as expected.

Resolves #13

Abstracts the center allocation to a separate function
Assigns the remaining students to previous center if the remainder is less than minimum threshold
@ashiishme ashiishme force-pushed the issue-13-avoid-less-than-min-allocation branch from 0fa5027 to d42d315 Compare April 24, 2024 12:26
Comment on lines +214 to +216
if next_allot < MIN_STUDENT_IN_CENTER and len(allocated_centers) > 0:
# get the first center code
allocate_center_code = centers[0]['cscode']
Copy link
Collaborator

Choose a reason for hiding this comment

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

first center may not always be the best choice to allocate remaining students.

  • it may not have required capacity as we have used center_cap_left for current_center.
  • in my opinion assigning them to last allotted center might be preferable for registration number distribution. eg: school with 408 students - Case 1: Center A: registration no 1 - 200; Center B reg no 201 - 408. Case 2: Center A: registration no. 1 - 208; Center B reg no 209 - 408. Case 1 would be preferred as starting registration number for all centers is a easy number

Copy link
Author

Choose a reason for hiding this comment

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

@sapradhan Thank you for your feedback. I agree with your point that the distributed number might not be cleaner.

I have one question, so when assigning the registration number, we will not care about the offset as below:

  • Center A: reg number from 1 to 200
  • Center B: reg number from 201 to 400
  • Remaining reg number ( 401 to 408 )

Let me know and I will make changes to assign to the last center.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Handling issue 1 should be good enough for now.

I realize now that issue 2 may not be that important.
Registration numbers distribution are not currently handled by this script. I only brought up registration numbers looking at notice published by NEB, so may be part of a future enhancement. Also centers can be ordered differently so as to make the registration no. distribution cleaner. eg - if we allot Center A - 208, Center B - 200, it does not mean we have to put first 208 students to Center A. We can distribute Center B 1 - 200, Center A 201 - 408. So I take back my previous opinion that assigning students to last allotted center is preferred.

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.

[TODO] avoid allotting small number of students last center
3 participants