This repository was archived by the owner on Feb 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdataGen.py
More file actions
100 lines (72 loc) · 2.1 KB
/
dataGen.py
File metadata and controls
100 lines (72 loc) · 2.1 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
import matplotlib.pyplot as plt
import os
import json
import sys
from colorama import init, Fore
from PIL import Image
import matplotlib.image as mpimg
import random
import math
_data = []
_tests = []
_testGroups =[]
_localDir = ""
def main():
pullNamesFromFile()
pullTestsFromFile()
#generateTestGroups()
process()
def pullNamesFromFile():
global _localDir
print("Intaking Data File")
_localDir = os.getcwd()
_dataFilePath = _localDir + "\\names.txt"
_dataFile = open(_dataFilePath, "r") #read only access of the data file
_iter = _dataFile.readlines()
for _line in _iter:
_data.append(_line[0:-1])
_dataFile.close()
def pullTestsFromFile():
global _localDir
print("Intaking Tests File")
_localDir = os.getcwd()
_dataFilePath = _localDir + "\\tests.txt"
_dataFile = open(_dataFilePath, "r") #read only access of the data file
_iter = _dataFile.readlines()
for _line in _iter:
_tests.append(_line[0:-1])
_dataFile.close()
def generateTestGroups():
#print("Generating Test Groups")
global _tests
_groupA = []
_groupB = []
_groupC = []
for i in range(0, 11):
_groupA.append(generateTest(_tests[i]))
for i in range(11, 21):
_groupB.append(generateTest(_tests[i]))
for i in range(21, 29):
_groupC.append(generateTest(_tests[i]))
# _testGroups.append(_groupA)
# _testGroups.append(_groupB)
# _testGroups.append(_groupC)
_testGroups = {"Primary Tests": _groupA, "Secondary Tests": _groupB, "Tertiary Tests":_groupC}
return _testGroups
def generateTest(name):
_zscaledScore = random.uniform(-4, 4)
_relTest = {'Name': name, "Description": "abc", "Id": 2}
_test = {"RawSore": 1, "ScaledScore": 1, "ZScore": _zscaledScore, "Percentile": 50, "RelatedTest": _relTest}
return _test
def process():
for index in range(0, len(_data)):
print("GENERATING PATIENT: " + str(index))
generatePatients(_data[index])
def generatePatients(name):
global _localDir
with open(_localDir + "/patients/" + name + ".json", "w") as write_file:
json.dump(generateTestGroups(), write_file)
if __name__ == "__main__":
main()