-
Notifications
You must be signed in to change notification settings - Fork 0
/
temp.py
75 lines (65 loc) · 2.54 KB
/
temp.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
count = 0
template1 = '''
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Update Symptom/History</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<!-- Popper JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</head>
<body>
<center>
<h4 class='bg-light text-primary p-3'>
'''
template2 = '''
</h4>
<br>
</center>
<form>
<div class="container mb-3">
<div class="form-row">
<div class="col-sm-12">
<label class='text-secondary ml-1'>
'''
template3='''
</div>
</div>
<center>
<br>
<button type="submit" id='updateBtn' class="btn btn-primary">
Add Feature
</button>
</center>
</div>
</form>
<script src='../popup.js'></script>
</body>
</html>
'''
import json
with open('SymptomsOutput.json') as f:
data = json.load(f)
for element in data:
with open('files/'+str(count)+'.html','w') as wf:
wf.write(template1)
wf.write(str(element['text']))
wf.write(template2)
if str(element['type'])=='integer' or str(element['type'])=='double':
inputField = "" +str(element["laytext"]) +'</label><br /> <input type="number" class="form-control" min="' +str(element["min"]) +'" name="' +str(element["name"]) +'" id="fetchFeature" max="' +str(element["max"]) +'" value="' +str(element["default"]) +'" /><br /><small class="text-danger" id="errMsg"></small><br />'
else:
inputField = ''+str(element["laytext"]) +"</label><br /><select class='custom-select' id='fetchFeature'>"
for j in element['choices']:
inputField +='<option value="' + str(j["value"]) + '" >' + str(j["laytext"]) + "</option>"
inputField+="</select>"
inputField+="<input type='hidden' id='feature' value='"+element['type']+"'/>"
wf.write(inputField)
wf.write(template3)
count+=1