moest-np / center-randomize

Script is to assign exam centers to students
MIT License
753 stars 360 forks source link

Exam Center Randomization Script

The goal of this script is to assign exam centers to students.

Steps

  1. Prepare input files in the specified format.
  2. Run the program and re-run if -
    • Any school has students who have not been assigned a center.
    • Distribution across centers is uneven.
  3. Perform sanity checks of distributed centers.
  4. Manually reassign impractical centers and odd lot allocations. Keep changes to a minimum.

Allocation Guidelines

Parameters

Variable Value Description
PREF_DISTANCE_THRESHOLD 2 Preferred threshold distance in km
ABS_DISTANCE_THRESHOLD 7 Absolute threshold distance in km
MIN_STUDENT_IN_CENTER 10 Min. no of students from a school to be assigned to a center in normal circumstances
STRETCH_CAPACITY_FACTOR 0.02 Factor determining how much center capacity can be stretched if needed
PREF_CUTOFF -4 Cutoff value for preference score allocation

Input Files

school.tsv

scode   count   name-address    lat long
27101   1776    काठमाण्डौ मोडेल मा.वि., वागवजार 27.7067463495   85.3188922809
27007   1700    ट्रिनीटी इन्टरनेशनल मा.वि., डिल्लीबजार  27.7038931952   85.3251961353
27045   1278    साउथ वेस्टर्न स्टेट मा.वि., बसुन्धारा   27.7396600173   85.3254532539
27127   1210    क्यापिटल मा.वि., कोटेश्वर   27.673541693    85.3449013829

centers.tsv

cscode  capacity    name    address नाम ठेगाना  lat long
27003   500 NATIONAL SCHOOL OF SCIENCES SECONDARY SCHOOL    LAINCHAUR   नेशनल स्कुल अफ साइन्सेस मा.वि   लैनचौर  27.71933026 85.31413793
27051   500 UNIGLOBE MA VI  KAMALADI    युनिग्लोब मा.वि कमलादी  27.70792875 85.32068522
27045   568 SOUTH WESTERN ACADEMY SECONDARY SCHOOL  BASUNDHARA  साउथ वेर्ष्टन एकेडेमी मा.वि.    बसुन्धरा    27.74212647 85.33392421

prefs.tsv

scode   cscode  pref    reason
27xxx   27yyy   -5  same management
27yyy   27xxx   -5  same management
27aaa   27bbb   -1  last year's center

Command

To run school_center.py use the command below:

python3 school_center.py sample_data/schools_grade12_2081.tsv sample_data/centers_grade12_2081.tsv sample_data/prefs.tsv

Output

🚀 24-04-22 20:40:27 - __main__ - INFO - Remaining capacity at each center (remaining_capacity cscode): 

                                           Remaining capacity at center (-ve if stretched capacity is used)
                                             |
🚀 24-04-22 20:40:27 - __main__ - INFO - [(-11, '27022'), (-11, '27045'), (-11, '27057')] 
                                                    |
                                                   center code

🚀 24-04-22 20:40:27 - __main__ - INFO - Total remaining capacity across all centers: 161 

🚀 24-04-22 20:40:27 - __main__ - INFO - Students not assigned: 0