-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__main__.py
39 lines (28 loc) · 1017 Bytes
/
__main__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
""" main document, handles IO and runs the actual matching algorithm
to read candidates use argument "candidates"
to create the list of candidates use argument "candidateList"
to let the matching happen use argument "matching"
"""
import sys
import pandas as pd
from matching.games import HospitalResident
from reader import Reader
operation = sys.argv[1]
# insert path of doctors excel below
r = Reader("Projektprioritäten für Challengezuteilung(1-60).xlsx")
DOCTORS = None
HOSPITAL_PREFS = None
if operation == "candidates":
""" reads doctors excel and writes new excel with candidates per hospital """
r.read_doctors()
elif operation == "matching":
DOCTORS = r.read_doctors()
HOSPITAL_PREFS = r.read_hospital_prefs()
capacities = r.read_hospital_capacities()
game = HospitalResident.create_from_dictionaries(
DOCTORS, HOSPITAL_PREFS, capacities
)
result = game.solve()
turned = r.turn_dict(result)
df_result = pd.DataFrame(turned, index=[0]).T
df_result.to_excel("matching_result.xlsx")