This repository has been archived by the owner on Mar 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrangle_incomplete_commissioner.py
143 lines (134 loc) · 5.78 KB
/
wrangle_incomplete_commissioner.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
import xlrd, requests, os
os.environ['DATABASE_URL'] = 'sqlite:///../test.db'
from app import db
from app import IncompleteCommissioner
book = xlrd.open_workbook("scratch/d.xls")
sh = book.sheet_by_index(4)
sh2 = book.sheet_by_index(5)
for rx in range(sh.nrows):
if rx < 14:
continue
row = sh.row(rx)
row2 = sh2.row(rx)
obj = IncompleteCommissioner()
obj.year = 2017
obj.month = 2
obj.region_code = str(row[1].value)
obj.ccg_code = str(row[2].value)
obj.ccg_name = str(row[3].value)
obj.treatment_function_code = str(row[4].value)
obj.treatment_function_name = str(row[5].value)
obj.total_incomplete = int(row[59].value)
obj.total_within_18 = int(row[60].value)
obj.total_with_dta = int(row2[59].value)
obj.total_waiting_1 = int(row[6].value)
obj.total_waiting_2 = int(row[7].value)
obj.total_waiting_3 = int(row[8].value)
obj.total_waiting_4 = int(row[9].value)
obj.total_waiting_5 = int(row[10].value)
obj.total_waiting_6 = int(row[11].value)
obj.total_waiting_7 = int(row[12].value)
obj.total_waiting_8 = int(row[13].value)
obj.total_waiting_9 = int(row[14].value)
obj.total_waiting_10 = int(row[15].value)
obj.total_waiting_11 = int(row[16].value)
obj.total_waiting_12 = int(row[17].value)
obj.total_waiting_13 = int(row[18].value)
obj.total_waiting_14 = int(row[19].value)
obj.total_waiting_15 = int(row[20].value)
obj.total_waiting_16 = int(row[21].value)
obj.total_waiting_17 = int(row[22].value)
obj.total_waiting_18 = int(row[23].value)
obj.total_waiting_19 = int(row[24].value)
obj.total_waiting_20 = int(row[25].value)
obj.total_waiting_21 = int(row[26].value)
obj.total_waiting_22 = int(row[27].value)
obj.total_waiting_23 = int(row[28].value)
obj.total_waiting_24 = int(row[29].value)
obj.total_waiting_25 = int(row[30].value)
obj.total_waiting_26 = int(row[31].value)
obj.total_waiting_27 = int(row[32].value)
obj.total_waiting_28 = int(row[33].value)
obj.total_waiting_29 = int(row[34].value)
obj.total_waiting_30 = int(row[35].value)
obj.total_waiting_31 = int(row[36].value)
obj.total_waiting_32 = int(row[37].value)
obj.total_waiting_33 = int(row[38].value)
obj.total_waiting_34 = int(row[39].value)
obj.total_waiting_35 = int(row[40].value)
obj.total_waiting_36 = int(row[41].value)
obj.total_waiting_37 = int(row[42].value)
obj.total_waiting_38 = int(row[43].value)
obj.total_waiting_39 = int(row[44].value)
obj.total_waiting_40 = int(row[45].value)
obj.total_waiting_41 = int(row[46].value)
obj.total_waiting_42 = int(row[47].value)
obj.total_waiting_43 = int(row[48].value)
obj.total_waiting_44 = int(row[49].value)
obj.total_waiting_45 = int(row[50].value)
obj.total_waiting_46 = int(row[51].value)
obj.total_waiting_47 = int(row[52].value)
obj.total_waiting_48 = int(row[53].value)
obj.total_waiting_49 = int(row[54].value)
obj.total_waiting_50 = int(row[55].value)
obj.total_waiting_51 = int(row[56].value)
obj.total_waiting_52 = int(row[57].value)
obj.total_waiting_52_plus = int(row[58].value)
obj.total_with_dta_1 = int(row2[6].value)
obj.total_with_dta_2 = int(row2[7].value)
obj.total_with_dta_3 = int(row2[8].value)
obj.total_with_dta_4 = int(row2[9].value)
obj.total_with_dta_5 = int(row2[10].value)
obj.total_with_dta_6 = int(row2[11].value)
obj.total_with_dta_7 = int(row2[12].value)
obj.total_with_dta_8 = int(row2[13].value)
obj.total_with_dta_9 = int(row2[14].value)
obj.total_with_dta_10 = int(row2[15].value)
obj.total_with_dta_11 = int(row2[16].value)
obj.total_with_dta_12 = int(row2[17].value)
obj.total_with_dta_13 = int(row2[18].value)
obj.total_with_dta_14 = int(row2[19].value)
obj.total_with_dta_15 = int(row2[20].value)
obj.total_with_dta_16 = int(row2[21].value)
obj.total_with_dta_17 = int(row2[22].value)
obj.total_with_dta_18 = int(row2[23].value)
obj.total_with_dta_19 = int(row2[24].value)
obj.total_with_dta_20 = int(row2[25].value)
obj.total_with_dta_21 = int(row2[26].value)
obj.total_with_dta_22 = int(row2[27].value)
obj.total_with_dta_23 = int(row2[28].value)
obj.total_with_dta_24 = int(row2[29].value)
obj.total_with_dta_25 = int(row2[30].value)
obj.total_with_dta_26 = int(row2[31].value)
obj.total_with_dta_27 = int(row2[32].value)
obj.total_with_dta_28 = int(row2[33].value)
obj.total_with_dta_29 = int(row2[34].value)
obj.total_with_dta_30 = int(row2[35].value)
obj.total_with_dta_31 = int(row2[36].value)
obj.total_with_dta_32 = int(row2[37].value)
obj.total_with_dta_33 = int(row2[38].value)
obj.total_with_dta_34 = int(row2[39].value)
obj.total_with_dta_35 = int(row2[40].value)
obj.total_with_dta_36 = int(row2[41].value)
obj.total_with_dta_37 = int(row2[42].value)
obj.total_with_dta_38 = int(row2[43].value)
obj.total_with_dta_39 = int(row2[44].value)
obj.total_with_dta_40 = int(row2[45].value)
obj.total_with_dta_41 = int(row2[46].value)
obj.total_with_dta_42 = int(row2[47].value)
obj.total_with_dta_43 = int(row2[48].value)
obj.total_with_dta_44 = int(row2[49].value)
obj.total_with_dta_45 = int(row2[50].value)
obj.total_with_dta_46 = int(row2[51].value)
obj.total_with_dta_47 = int(row2[52].value)
obj.total_with_dta_48 = int(row2[53].value)
obj.total_with_dta_49 = int(row2[54].value)
obj.total_with_dta_50 = int(row2[55].value)
obj.total_with_dta_51 = int(row2[56].value)
obj.total_with_dta_52 = int(row2[57].value)
obj.total_with_dta_52_plus = int(row2[58].value)
db.session.add(obj)
#print(post_data)
#r = requests.post("http://localhost:5000/api/incomplete-commissioner" json=post_data)
#print(r.text)
db.session.commit()