dmsaylor commited on
Commit
827f911
·
1 Parent(s): 07404f4

working dynamic columns

Browse files
efficiency_module/efficiency.py CHANGED
@@ -10,39 +10,36 @@ def efficiency():
10
 
11
 
12
  # build the report page for the exposure module
13
- @blueprint.route('/efficiency', methods=['POST'])
14
- def eff_post():
15
-
16
- mass = float(request.form["mass"])
17
- density = float(request.form["density"])
18
- PolymerVolume = mass / density
19
- SurfaceArea = float(request.form["area"])
20
-
21
- SolventVolume = float(request.form["svol"])
22
- ExtractionTime = float(request.form["time"])*3600.
23
- iterations = int(request.form["iterations"])
24
-
25
- ExtractionTime = ExtractionTime * iterations
26
- SolventVolume = SolventVolume * iterations
27
-
28
- #D = float(request.form["DiffCoeff"])
29
- #K = float(request.form["PartCoeff"])
30
-
31
- L = PolymerVolume / SurfaceArea
32
-
33
- nterms = 5
34
- M0 = 1.
35
- K = np.array((1e-3, 1., 1e3))
36
- D = np.array((1e-7, 1e-10, 1e-13))
37
- ExtEff = np.zeros((3,3))
38
- for i in range(3):
39
- for j in range(3):
40
- ExtEff[i,j] = PlaneSheetAnalytical(M0, D[i], K[j], PolymerVolume, SurfaceArea, SolventVolume, ExtractionTime, nterms)
41
- print(ExtEff[i,j])
42
-
43
- Conc = ExtEff * PolymerVolume / SolventVolume
44
-
45
- print(Conc)
46
-
47
- return render_template('efficiency_report.html', ExtEff = ExtEff, Conc=Conc)
48
 
 
10
 
11
 
12
  # build the report page for the exposure module
13
+ # @blueprint.route('/efficiency', methods=['POST'])
14
+ # def eff_post():
15
+ #
16
+ # mass = float(request.form["mass"])
17
+ # density = float(request.form["density"])
18
+ # PolymerVolume = mass / density
19
+ # SurfaceArea = float(request.form["area"])
20
+ #
21
+ # SolventVolume = float(request.form["svol"])
22
+ # ExtractionTime = float(request.form["time"])*3600.
23
+ # iterations = int(request.form["iterations"])
24
+ #
25
+ # ExtractionTime = ExtractionTime * iterations
26
+ # SolventVolume = SolventVolume * iterations
27
+ #
28
+ # #D = float(request.form["DiffCoeff"])
29
+ # #K = float(request.form["PartCoeff"])
30
+ #
31
+ # L = PolymerVolume / SurfaceArea
32
+ #
33
+ # nterms = 5
34
+ # M0 = 1.
35
+ # K = np.array((1e-3, 1., 1e3))
36
+ # D = np.array((1e-7, 1e-10, 1e-13))
37
+ # ExtEff = np.zeros((3,3))
38
+ # for i in range(3):
39
+ # for j in range(3):
40
+ # ExtEff[i,j] = PlaneSheetAnalytical(M0, D[i], K[j], PolymerVolume, SurfaceArea, SolventVolume, ExtractionTime, nterms)
41
+ #
42
+ # Conc = ExtEff * PolymerVolume / SolventVolume
43
+ #
44
+ # return render_template('efficiency_report.html', ExtEff = ExtEff, Conc=Conc)
 
 
 
45
 
efficiency_module/templates/efficiency_index.html CHANGED
@@ -8,6 +8,13 @@
8
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.min.js" integrity="sha384-VHvPCCyXqtD5DqJeNxl2dtTyhF78xXNXdkwX1CZeRusQfRKp+tA7hAShOK/B/fQ2" crossorigin="anonymous"></script>
9
  <link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles.css') }}">
10
 
 
 
 
 
 
 
 
11
  </head>
12
 
13
  <img src="{{ url_for('static',filename='images/FDAlogo.png') }}" style="float: left;" height="100"/>
@@ -15,48 +22,84 @@
15
  <br clear="all" />
16
 
17
  <header>
18
- <h1 style="text-align:center"><font color="#0070C0">CH</font>emical <font color="#0070C0">RIS</font>k calculator (CHRIS) - Extraction efficiency RST</h1>
19
  </header>
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  <body>
22
 
23
  <form method="POST">
24
 
25
- <!-- Test article input section -->
26
-
27
- <h3> Test article <button type="button" class="Info_btn" data-toggle="modal" data-target="#ArticleModal">&#9432;</button> </h3>
28
- Mass (g):
29
- <input name="mass" id="mass" step="any" value="1.0" min="0.000001" type="number" required> <br>
30
- Density (g/cm<sup>3</sup>):
31
- <input name="density" id="density" step="any" value="1.0" min="0.01" type="number" required> <br>
32
- Exposed surface area (cm<sup>2</sup>):
33
- <input name="area" id="area" step="any" value="5.0" min="0.001" type="number" required><br>
34
-
35
- <!-- Extraction conditions input section -->
36
-
37
- <h3> Extraction conditions <button type="button" class="Info_btn" data-toggle="modal" data-target="#ExtractionModal">&#9432;</button> </h3>
38
-
39
- Solvent volume (ml):
40
- <input name="svol" id="svol" step="any" value="1.0" min="0.000001" type="number" required> <br>
41
- Immersion time per iteration (h):
42
- <input name="time" id="time" step="any" value="24.0" min="0.001" type="number" required> <br>
43
- Number of iterations:
44
- <input name="iterations" id="iterations" step="any" value="1" min="1" type="number" step="1" onchange="this.value = parseInt(this.value);" required> <br>
45
-
46
- <!-- Material properties input section
47
- <h3> Material properties <button type="button" class="Info_btn" data-toggle="modal" data-target="#MaterialModal">&#9432;</button> </h3>
48
- Diffusion coefficient (D): <select name="DiffCoeff">
49
- <option value="1e-7" selected>Fast (1e-7 cm2/s) </option>
50
- <option value="1e-10">Medium (1e-10 cm2/s) </option>
51
- <option value="1e-13">Slow (1e-13 cm2/s) </option>
52
- </select> <br>
53
- Partition coefficient (K): <select name="PartCoeff">
54
- <option value="1e-3" selected>Low (1e-3) </option>
55
- <option value="1">Medium (1) </option>
56
- <option value="1e3">High (1e3) </option>
57
- </select> <br> -->
58
-
59
- <h3> Efficiency estimation </h3>
60
- Click to calculate: <button type="submit">Submit</button>
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  </body>
62
  </html>
 
8
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.min.js" integrity="sha384-VHvPCCyXqtD5DqJeNxl2dtTyhF78xXNXdkwX1CZeRusQfRKp+tA7hAShOK/B/fQ2" crossorigin="anonymous"></script>
9
  <link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles.css') }}">
10
 
11
+ <style>
12
+ table, th, td {
13
+ border: 1px solid black;
14
+ border-collapse: collapse;
15
+ }
16
+ </style>
17
+
18
  </head>
19
 
20
  <img src="{{ url_for('static',filename='images/FDAlogo.png') }}" style="float: left;" height="100"/>
 
22
  <br clear="all" />
23
 
24
  <header>
25
+ <h1 style="text-align:center"><font color="#0070C0">CH</font>emical <font color="#0070C0">RIS</font>k calculator (CHRIS) - Extraction efficiency comparison RST</h1>
26
  </header>
27
 
28
+ <script>
29
+ function addColumn(){
30
+
31
+ var i = document.getElementById('theTable').rows[0].cells.length;
32
+
33
+ $("#theTable tr:eq( 0 )").append("<td> <input type='number' step='any' value='1.0' min='0.00001' required id='mass'" + i + "> </td>");
34
+ $("#theTable tr:eq( 1 )").append("<td> <input type='number' step='any' value='1.0' min='0.00001' required id='density'" + i + "> </td>");
35
+ $("#theTable tr:eq( 2 )").append("<td> <input type='number' step='any' value='6.0' min='0.00001' required id='area'" + i + "> </td>");
36
+ $("#theTable tr:eq( 3 )").append("<td> <input type='number' step='any' value='1.0' min='0.00001' required id='svol'" + i + "> </td>");
37
+ $("#theTable tr:eq( 4 )").append("<td> <input type='number' step='1' value='1' min='1' onchange='this.value = parseInt(this.value);' required id='iterations'" + i + "> </td>");
38
+ $("#theTable tr:eq( 5 )").append("<td> <input type='number' step='any' value='1.0' min='0.00001' required id='time'" + i + "> </td>");
39
+ $("#theTable tr:eq( 6 )").append("<td> <input type='number' step='any' value='1e-8' min='1e-20' required id='D'" + i + "> </td>");
40
+ $("#theTable tr:eq( 7 )").append("<td> <input type='number' step='any' value='1.0' min='0.00001' required id='K'" + i + "> </td>");
41
+
42
+ };
43
+
44
+ function removeColumn(){
45
+
46
+ $('#theTable tr').find('td:last').remove();
47
+
48
+ };
49
+ </script>
50
+
51
  <body>
52
 
53
  <form method="POST">
54
 
55
+
56
+
57
+ <input type = "button" onclick = "javascript:addColumn()" value = "Add column" />
58
+ <input type = "button" onclick = "javascript:removeColumn()" value = "Remove column" />
59
+
60
+ <table id="theTable">
61
+ <tr>
62
+ <th> Test article mass (g)</th>
63
+ <td> <input name="mass1" id="mass1" step="any" value="1.0" min="0.000001" type="number" required> </td>
64
+ <td> <input name="mass2" id="mass2" step="any" value="1.0" min="0.000001" type="number" required> </td>
65
+ </tr>
66
+ <tr>
67
+ <th> Test article density (g/cm<sup>3</sup>) </th>
68
+ <td> <input name="density1" id="density1" step="any" value="1.0" min="0.01" type="number" required> </td>
69
+ <td> <input name="density2" id="density2" step="any" value="1.0" min="0.01" type="number" required> </td>
70
+ </tr>
71
+ <tr>
72
+ <th> Test article surface area (cm<sup>2</sup>) </th>
73
+ <td> <input name="area1" id="area1" step="any" value="6.0" min="0.001" type="number" required> </td>
74
+ <td> <input name="area2" id="area2" step="any" value="6.0" min="0.001" type="number" required> </td>
75
+ </tr>
76
+ <tr>
77
+ <th> Solvent volume (ml) </th>
78
+ <td> <input name="svol1" id="svol1" step="any" value="1.0" min="0.000001" type="number" required> </td>
79
+ <td> <input name="svol2" id="svol2" step="any" value="1.0" min="0.000001" type="number" required> </td>
80
+ </tr>
81
+ <tr>
82
+ <th> # of iterations </th>
83
+ <td> <input name="iterations1" id="iterations1" value="1" min="1" type="number" step="1" onchange="this.value = parseInt(this.value);" required> </td>
84
+ <td> <input name="iterations2" id="iterations2" value="1" min="1" type="number" step="1" onchange="this.value = parseInt(this.value);" required> </td>
85
+ </tr>
86
+ <tr>
87
+ <th> time per iteration (h) </th>
88
+ <td> <input name="time1" id="time1" step="any" value="24.0" min="0.001" type="number" required> </td>
89
+ <td> <input name="time2" id="time2" step="any" value="24.0" min="0.001" type="number" required> </td>
90
+ </tr>
91
+ <tr>
92
+ <th> Diffusion coefficient (cm<sup>2</sup>/s) </th>
93
+ <td> <input name="D1" id="D1" step="any" value="1e-8" min="1e-20" type="number" required> </td>
94
+ <td> <input name="D2" id="D2" step="any" value="1e-8" min="1e-20" type="number" required> </td>
95
+ </tr>
96
+ <tr>
97
+ <th> Partition coefficient </th>
98
+ <td> <input name="K1" id="K1" step="any" value="1" min="1e-3" type="number" required> </td>
99
+ <td> <input name="K2" id="K2" step="any" value="1" min="1e-3" type="number" required> </td>
100
+ </tr>
101
+ </table>
102
+
103
+ <br> <button type="submit">Calculate</button>
104
  </body>
105
  </html>