-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdataset_creator.py
More file actions
40 lines (28 loc) · 1.03 KB
/
Copy pathdataset_creator.py
File metadata and controls
40 lines (28 loc) · 1.03 KB
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
40
import json
from random import randrange
donors = {}
def assignQualityScore():
return randrange(20)
def buildSet(numPairs, numDeceased):
for i in range(1, numPairs + 1): # Living Donors
donori = {}
donori['alive'] = True
for j in range(1, numPairs + 1): # Assign quality scores for ever donor recipient pair
if j is not i:
donori['r' + str(j)] = assignQualityScore()
# else:
# donori['r' + str(j)] = -1
donors['d' + str(i)] = donori
for i in range(numPairs + 1, numPairs + numDeceased + 1): # Deceased Donors
donori = {}
donori['alive'] = False
for j in range(1, numPairs + 1): # Assign quality scores for ever donor recipient pair
donori['r' + str(j)] = assignQualityScore()
donors['d' + str(i)] = donori
def main():
buildSet(6, 2)
with open('donors.json', 'w') as outfile:
json.dump(donors, outfile, indent=4)
print(donors)
if __name__ == '__main__':
main()