-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataKeeper.py
252 lines (220 loc) · 8.63 KB
/
DataKeeper.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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
import ComparativeAnalysis
import DocParser
from tabulate import tabulate
from User import User
class DataKeeper:
def __init__(self):
self.history = {}
def showHistory(self):
data = list(self.history.values())
keys = list(self.history.keys())
for i in range(len(data)):
data[i].insert(0, keys[i])
print(tabulate(data,
headers=['КОЛИЧЕСТВО ОБЫЧНЫХ АКЦИЙ', 'КОЛИЧЕСТВО ПРИВИЛЕГИРОВАННЫХ АКЦИЙ', 'ЦЕНА ОБЫЧНЫХ АКЦИЙ',
'ЦЕНА ПРИВИЛЕГИРОВАННЫХ АКЦИЙ', 'БАЛАНСОВАЯ СТОИМОСТЬ',
'ВСЕГО АКТИВОВ', 'ВСЕГО ОБЯЗАТЕЛЬСТВ', 'РЫНГОЧНАЯ КАПИТАЛИЗАЦИЯ',
'БАЗА ЗНАНИЙ', 'КОЛИЧЕСТВО ПОЛЬЗОВАТЕЛЕЙ БАЗЫ', 'ТРЕНИНГИ',
'КОЛИЧЕСТВО ТРЕНИНГОВ', 'НАСТАВНИКИ',
'КОЛИЧЕСТВО СОТРУНИКОВ', 'КОЛИЧЕСТВО СОТРУНИКОВ ПРОШЕДШИХ ОБУЧЕНИЕ', 'ПО', 'ДОХОД КОМПАНИИ'],
tablefmt="grid"))
for i in range(len(data)):
data[i].pop(i)
def getMap(self):
return self.history
def fillMap(self, file):
# считываем по строкам и отправляем в словарь
file = open(file, "r")
lineCounter = 0
# считываем строку
line = file.readline()
oneWord = line.split(" ")
key = oneWord[0]
oneWord = oneWord[1:]
for item in oneWord:
lineCounter = lineCounter + 1
if "1" in item or "2" in item or "3" in item or "4" in item or "5" in item or "6" in item or "7" in item or "8" in item or "9" in item or "0" in item or item =="ПО":
d = str(item)
if item == "ПО":
d = oneWord[lineCounter]
if key in self.history.keys():
data = self.history.get(key)
data.append(d)
self.history.update({key: data})
else:
data = []
data.append(d)
self.history.update({key: data})
file.close
return self.history
newUser = User('Kate', '816856')
newUser.log()
myData = DataKeeper()
operation = "0"
method = "0"
print("Choose the data entering method:")
print("1. Input document")
print("2. Enter data")
method = int(input())
if method == 1:
print("Input name of the file: ")
name = DocParser.nameInput()
dataFile = DocParser.convertData(DocParser.readDoc(name))
myData.fillMap(dataFile)
elif method == 2:
file1 = open("C:\\Users\\ПК\\Desktop\\Диплом\\SelfWriter.txt", "w+")
print("Input year of analysis")
text = input()
file1.write(text+" ")
print("Input the price of ordinary shares")
text = input()
file1.write(text+" ")
print("Input the price of preferred shares")
text = input()
file1.write(text+" ")
print("Input the amount of ordinary shares")
text = input()
file1.write(text + " ")
print("Input the amount of preferred shares")
text = input()
file1.write(text + " ")
print("Input the balance value of the company")
text = input()
file1.write(text + " ")
print("Input the company assets")
text = input()
file1.write(text + " ")
print("Input the company obligations")
text = input()
file1.write(text + " ")
print("Input the market capitalization")
text = input()
file1.write(text + " ")
print("if your company has base of knowledge input 1, otherwise input 0")
text = input()
file1.write(text + " ")
print("input the number of knowledge base views")
text = input()
file1.write(text + " ")
print("if your company has the system of trainings input 1, otherwise input 0")
text = input()
file1.write(text+" ")
print("input the number of trainings")
text = input()
file1.write(text+" ")
print("if your company has the mentoring system input 1, otherwise input 0")
text = input()
file1.write(text + " ")
print("input the number of employees")
text = input()
file1.write(text + " ")
print("input the number of educated employees in the company")
text = input()
file1.write(text + " ")
print("input the name of the program id used in the company for knowledge management")
text = input()
file1.write(text + " ")
print("input the income of the company in thousands of rubles")
text = input()
file1.write(text + " ")
file1.close()
myData.fillMap("C:\\Users\\ПК\\Desktop\\Диплом\\SelfWriter.txt")
else:
print("try again")
exit(-1)
while operation != "4":
print("Choose the operation:")
print("1. Show assess")
print("2. Show analysis")
print("3. Show history")
print("4. Enter more data")
print("5. Exit")
operation = int(input())
if operation == 1:
if len(myData.getMap().keys()) > 1:
ComparativeAnalysis.assess(myData.getMap())
else:
print("Enter data, load the document")
elif operation == 2:
if len(myData.getMap().keys()) > 0:
ComparativeAnalysis.showAnalysis(myData.getMap())
ComparativeAnalysis.makeGraphs(myData.getMap())
else:
print("Enter data, load the document")
elif operation == 3:
myData.showHistory()
elif operation == 4:
print("Choose the data entering method:")
print("1. Input document")
print("2. Enter data")
method = int(input())
if method == 1:
print("Input name of the file: ")
name = DocParser.nameInput()
dataFile = DocParser.convertData(DocParser.readDoc(name))
myData.fillMap(dataFile)
elif method == 2:
file1 = open("C:\\Users\\ПК\\Desktop\\Диплом\\SelfWriter.txt", "w+")
print("Input year of analysis")
text = input()
file1.write(text + " ")
print("Input the price of ordinary shares")
text = input()
file1.write(text + " ")
print("Input the price of preferred shares")
text = input()
file1.write(text + " ")
print("Input the amount of ordinary shares")
text = input()
file1.write(text + " ")
print("Input the amount of preferred shares")
text = input()
file1.write(text + " ")
print("Input the balance value of the company")
text = input()
file1.write(text + " ")
print("Input the company assets")
text = input()
file1.write(text + " ")
print("Input the company obligations")
text = input()
file1.write(text + " ")
print("Input the market capitalization")
text = input()
file1.write(text + " ")
print("if your company has base of knowledge input 1, otherwise input 0")
text = input()
file1.write(text + " ")
print("input the number of knowledge base views")
text = input()
file1.write(text + " ")
print("if your company has the system of trainings input 1, otherwise input 0")
text = input()
file1.write(text + " ")
print("input the number of trainings")
text = input()
file1.write(text + " ")
print("if your company has the mentoring system input 1, otherwise input 0")
text = input()
file1.write(text + " ")
print("input the number of employees")
text = input()
file1.write(text + " ")
print("input the number of educated employees in the company")
text = input()
file1.write(text + " ")
print("input the name of the program id used in the company for knowledge management")
text = input()
file1.write(text + " ")
print("input the income of the company in thousands of rubles")
text = input()
file1.write(text + " ")
file1.close()
myData.fillMap("C:\\Users\\ПК\\Desktop\\Диплом\\SelfWriter.txt")
else:
print("try again")
exit(-1)
elif operation == 5:
exit(-1)
else:
print("The input is not correct. Try again.")