irie 0.0.58__py3-none-any.whl → 0.0.60__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of irie might be problematic. Click here for more details.

Files changed (35) hide show
  1. irie/apps/evaluation/models.py +7 -0
  2. irie/apps/events/views_events.py +2 -2
  3. irie/apps/inventory/migrations/0009_datum_angle_x_datum_angle_y.py +23 -0
  4. irie/apps/inventory/models.py +1 -1
  5. irie/apps/inventory/views.py +10 -4
  6. irie/apps/prediction/forms/csi_upload.py +68 -0
  7. irie/apps/prediction/migrations/0007_remove_sensorassignment_orient_x_and_more.py +25 -0
  8. irie/apps/prediction/runners/__init__.py +6 -4
  9. irie/apps/prediction/runners/opensees/__init__.py +49 -14
  10. irie/apps/prediction/urls.py +6 -4
  11. irie/apps/prediction/views.py +248 -17
  12. irie/apps/static/assets/css/brace.css +1 -1
  13. irie/apps/static/assets/css/brace.css.map +1 -1
  14. irie/apps/static/assets/css/brace.min.css +1 -1
  15. irie/apps/static/assets/js/brace.js +101 -42
  16. irie/apps/templates/includes/footer.html +1 -1
  17. irie/apps/templates/inventory/asset-event-summary.html +7 -0
  18. irie/apps/templates/inventory/asset-on-map.html +22 -22
  19. irie/apps/templates/inventory/asset-on-map.js +115 -113
  20. irie/apps/templates/inventory/create-datum.html +44 -0
  21. irie/apps/templates/inventory/sensor-upload.html +22 -22
  22. irie/apps/templates/layouts/base.html +3 -3
  23. irie/apps/templates/prediction/create-model.html +32 -37
  24. irie/apps/templates/prediction/upload/confirm.html +93 -0
  25. irie/apps/templates/prediction/upload/step.html +119 -0
  26. irie/apps/templates/prediction/veux/navigator.html +54 -38
  27. irie/apps/templates/prediction/veux/navigator.js +222 -154
  28. irie/apps/templates/prediction/xara-profile.html +7 -3
  29. irie/core/settings.py +1 -0
  30. {irie-0.0.58.dist-info → irie-0.0.60.dist-info}/METADATA +7 -6
  31. {irie-0.0.58.dist-info → irie-0.0.60.dist-info}/RECORD +35 -29
  32. /irie/apps/prediction/{forms.py → forms/__init__.py} +0 -0
  33. {irie-0.0.58.dist-info → irie-0.0.60.dist-info}/WHEEL +0 -0
  34. {irie-0.0.58.dist-info → irie-0.0.60.dist-info}/entry_points.txt +0 -0
  35. {irie-0.0.58.dist-info → irie-0.0.60.dist-info}/top_level.txt +0 -0
@@ -4,185 +4,253 @@
4
4
  //
5
5
  //===----------------------------------------------------------------------===//
6
6
  //
7
+ // class AnalysisNavigator {
8
+ // constructor(baseUrl, analysisTypes) {
9
+ // this.#url = baseUrl;
10
+ // this.#analysisTypes = analysisTypes;
11
+ // }
12
+ // }
13
+
7
14
  class VeuxNavigator {
8
- #initializedTabs;
9
- #table;
10
- #url;
11
- #tabLinkContainer;
12
- #tabContentContainer;
13
-
14
- constructor(baseUrl, tabLinkContainer, tabContentContainer) {
15
- this.#url = baseUrl;
16
- this.#initializedTabs = [];
17
- this.#tabLinkContainer = tabLinkContainer;
18
- this.#tabContentContainer = tabContentContainer;
19
- }
15
+ #initializedTabs;
16
+ #table;
17
+ #url;
18
+ #tabLinkContainer;
19
+ #tabContentContainer;
20
+ #propContainer;
21
+
22
+ constructor(baseUrl, tabLinkContainer, tabContentContainer, propContainer) {
23
+ this.#url = baseUrl;
24
+ this.#initializedTabs = [];
25
+ this.#tabLinkContainer = tabLinkContainer;
26
+ this.#tabContentContainer = tabContentContainer;
27
+ this.#propContainer = propContainer;
28
+ }
20
29
 
21
- initTabs(tab1, tabselector) {
22
- this.#initializedTabs.push(tab1);
30
+ initTabs(tab1, tabselector) {
31
+ this.#initializedTabs.push(tab1);
23
32
 
24
- const tabs = this.#tabLinkContainer.querySelectorAll(tabselector);
33
+ const tabs = this.#tabLinkContainer.querySelectorAll(tabselector);
25
34
 
26
- tabs.forEach(tab => {
27
- tab.addEventListener('click', (e) => {
28
- e.preventDefault();
29
- this.clickTab(tab);
30
- });
35
+ tabs.forEach(tab => {
36
+ tab.addEventListener('click', (e) => {
37
+ e.preventDefault();
38
+ this.clickTab(tab);
31
39
  });
32
- }
40
+ });
41
+ }
33
42
 
34
- select(elem) {
35
- const sname = `${elem.id}`; //dataset.name;
36
- // const hash = elem.dataset.hash;
43
+ //
44
+ //
45
+ //
46
+ select(elem) {
47
+ const sname = `${elem.id}`; //dataset.name;
37
48
 
38
- if (this.#initializedTabs.includes(sname)) {
39
- const tabLink = this.#tabLinkContainer.querySelector(`#${sname}-tab`);
40
- this.clickTab(tabLink);
41
- return;
42
- }
49
+ elem.parentElement.querySelectorAll('.table-active').forEach((el) => {
50
+ el.classList.remove("table-active");
51
+ });
52
+ elem.classList.add("table-active");
53
+
54
+ // elem.parentElement.querySelectorAll("tr").forEach((el) => {
55
+ // el.style.display = "none";
56
+ // });
57
+ // elem.style.display = "table-row";
43
58
 
44
- this.addTab(elem);
59
+ if (this.#initializedTabs.includes(sname)) {
60
+ const tabLink = this.#tabLinkContainer.querySelector(`#${sname}-tab`);
61
+ this.clickTab(tabLink);
62
+ return;
45
63
  }
46
64
 
47
- addTab(elem) {
48
- const tab = `${elem.id}`;
49
-
50
- //
51
- //
52
- //
53
- const tabLink = document.createElement('a');
54
- tabLink.id = `${tab}-tab`;
55
- tabLink.classList.add("tab-link", "nav-link", "active");
56
- tabLink.href = "#";
57
- tabLink.setAttribute('data-tab', tab);
58
- tabLink.setAttribute('data-query', elem.dataset.query);
59
- tabLink.setAttribute('data-bs-toggle', 'tab');
60
- tabLink.setAttribute('role', 'tab');
61
- tabLink.innerHTML = `${elem.dataset.name} <button class="btn-close" type="button" aria-label="Close"></button>`;
62
- const closeButton = tabLink.querySelector('.btn-close');
63
- closeButton.addEventListener('click', (e) => {
64
- this.delTab(tabLink);
65
- });
66
- tabLink.addEventListener('click', (e) => {
67
- e.preventDefault();
68
- this.clickTab(tabLink);
69
- });
70
-
71
- const tabItem = document.createElement('li');
72
- tabItem.role = 'presentation';
73
- tabItem.classList.add('nav-item');
74
- tabItem.appendChild(tabLink);
75
- // Add to list of tabs
76
- this.#tabLinkContainer.appendChild(tabItem);
77
-
78
- //
79
- //
80
- //
81
- const tabContent = document.createElement('div');
82
- tabContent.classList.add('tab-content', 'mt-3', 'card-body', 'p-2');
83
- tabContent.id = `${tab}-content`;
84
- tabContent.style.display = 'block';
85
- this.#tabContentContainer.appendChild(tabContent);
86
-
87
-
88
- this.#initializedTabs.push(tab);
65
+ this.addTab(elem);
66
+ }
67
+
68
+ addTab(elem) {
69
+ const tab = `${elem.id}`;
70
+
71
+ //
72
+ //
73
+ //
74
+ const tabLink = document.createElement('a');
75
+ tabLink.id = `${tab}-tab`;
76
+ tabLink.classList.add("tab-link", "nav-link", "active");
77
+ tabLink.href = "#";
78
+ tabLink.setAttribute('data-tab', tab);
79
+ tabLink.setAttribute('data-render', elem.dataset.render);
80
+ tabLink.setAttribute('data-bs-toggle', 'tab');
81
+ tabLink.setAttribute('role', 'tab');
82
+ tabLink.innerHTML = `${elem.dataset.name} <button class="btn-close" type="button" aria-label="Close"></button>`;
83
+ const closeButton = tabLink.querySelector('.btn-close');
84
+ closeButton.addEventListener('click', (e) => {
85
+ this.delTab(tabLink);
86
+ });
87
+ tabLink.addEventListener('click', (e) => {
88
+ e.preventDefault();
89
89
  this.clickTab(tabLink);
90
- this.fetchAndUpdateTab(tab, elem.dataset.query);
91
- return tabLink;
92
- }
90
+ });
91
+
92
+ const tabItem = document.createElement('li');
93
+ tabItem.role = 'presentation';
94
+ tabItem.classList.add('nav-item');
95
+ tabItem.appendChild(tabLink);
96
+ // Add to list of tabs
97
+ this.#tabLinkContainer.appendChild(tabItem);
98
+
99
+ //
100
+ //
101
+ //
102
+ const tabContent = document.createElement('div');
103
+ tabContent.classList.add('tab-content', 'mt-3', 'card-body', 'p-2');
104
+ tabContent.id = `${tab}-content`;
105
+ tabContent.style.display = 'block';
106
+ this.#tabContentContainer.appendChild(tabContent);
93
107
 
94
- clickTab(tabLink) {
95
-
96
- const tabs = this.#tabLinkContainer.querySelectorAll('.tab-link');
97
-
98
- // Remove 'active' class from all tabs
99
- tabs.forEach(t => {
100
- t.classList.remove('active');
101
- });
102
-
103
- // Add 'active' class to the clicked tab
104
- tabLink.classList.add('active');
105
-
106
- const tab = tabLink.getAttribute('data-tab');
107
- const contentDiv = this.#tabContentContainer.querySelector(`#${tab}-content`);
108
108
 
109
- contentDiv.style.display = 'block';
110
- this.#tabContentContainer.querySelectorAll(".tab-content").forEach((el) => {
111
- if (el.id != `${tab}-content`) {
112
- el.style.display = 'none';
113
- }
114
- });
115
- }
109
+ this.#initializedTabs.push(tab);
110
+ this.clickTab(tabLink);
111
+ this.fetchAndUpdateTab(tab, elem.dataset.render);
112
+ return tabLink;
113
+ }
116
114
 
117
- delTab(tabLink) {
118
- const tab = tabLink.getAttribute('data-tab');
119
- const corr = tabLink.getAttribute('data-corridor');
120
- const tabContent = this.#tabContentContainer.querySelector(`#${tab}-content`);
121
- tabContent.remove();
115
+ clickTab(tabLink) {
116
+ const tabs = this.#tabLinkContainer.querySelectorAll('.tab-link');
122
117
 
123
- const tabItem = tabLink.parentElement;
124
- tabItem.remove();
118
+ // Remove 'active' class from all tabs
119
+ tabs.forEach(t => {
120
+ t.classList.remove('active');
121
+ });
125
122
 
126
- const idx = this.#initializedTabs.indexOf(tab);
127
- if (idx > -1) {
128
- this.#initializedTabs.splice(idx, 1);
123
+ // Add 'active' class to the clicked tab
124
+ tabLink.classList.add('active');
125
+
126
+ const tab = tabLink.getAttribute('data-tab');
127
+ const contentDiv = this.#tabContentContainer.querySelector(`#${tab}-content`);
128
+
129
+ contentDiv.style.display = 'block';
130
+ this.#tabContentContainer.querySelectorAll(".tab-content").forEach((el) => {
131
+ if (el.id != `${tab}-content`) {
132
+ el.style.display = 'none';
129
133
  }
130
- this.clickTab(document.getElementById('tab1-tab'));
134
+ });
135
+ }
136
+
137
+ delTab(tabLink) {
138
+ const tab = tabLink.getAttribute('data-tab');
139
+ const corr = tabLink.getAttribute('data-corridor');
140
+ const tabContent = this.#tabContentContainer.querySelector(`#${tab}-content`);
141
+ tabContent.remove();
142
+
143
+ const tabItem = tabLink.parentElement;
144
+ tabItem.remove();
145
+
146
+ const idx = this.#initializedTabs.indexOf(tab);
147
+ if (idx > -1) {
148
+ this.#initializedTabs.splice(idx, 1);
131
149
  }
150
+ this.clickTab(document.getElementById('tab1-tab'));
151
+ }
132
152
 
133
- fetchAndUpdateTab(tab, query) {
134
- const contentDiv = this.#tabContentContainer.querySelector(`#${tab}-content`);
153
+ fetchAndUpdateTab(tab, query) {
154
+ const contentDiv = this.#tabContentContainer.querySelector(`#${tab}-content`);
135
155
 
136
- // Show loading message while content is being fetched
137
- contentDiv.innerHTML = `
138
- <div class="text-center">
139
- <div class="spinner-border" role="status">
140
- <span class="visually-hidden">Loading...</span>
141
- </div>
156
+ // Show loading message while content is being fetched
157
+ contentDiv.innerHTML = `
158
+ <div class="text-center">
159
+ <div class="spinner-border" role="status">
160
+ <span class="visually-hidden">Loading...</span>
142
161
  </div>
143
- `;
162
+ </div>
163
+ `;
144
164
 
145
- let apiUrl = `${this.#url}${query}`;
146
- console.log(`Fetching content from: ${apiUrl}`);
165
+ let apiUrl = `${this.#url}/render/?${query}`;
166
+ console.log(`Fetching content from: ${apiUrl}`);
147
167
 
148
- if (true) {
149
- contentDiv.innerHTML = "";
150
- const mv = document.createElement('model-viewer');
168
+ if (true) {
169
+ contentDiv.innerHTML = "";
170
+ const mv = document.createElement('model-viewer');
151
171
 
152
- mv.setAttribute('camera-controls', '');
153
- mv.setAttribute('autoplay', '');
154
- mv.setAttribute('interaction-prompt', 'none');
155
- mv.style.width = '100%';
156
- mv.style.height = '400px';
172
+ mv.setAttribute('camera-controls', '');
173
+ mv.setAttribute('autoplay', '');
174
+ mv.setAttribute('interaction-prompt', 'none');
175
+ mv.style.width = '100%';
176
+ mv.style.height = '400px';
157
177
 
158
- mv.src = apiUrl;
159
- contentDiv.appendChild(mv);
160
- return;
161
- }
178
+ mv.src = `${this.#url}/render/?${query}`;
179
+ contentDiv.appendChild(mv);
180
+ }
181
+
182
+ //
183
+ //
184
+ if (this.#propContainer) {
185
+ fetch(`${this.#url}/properties/?${query}`)
186
+ .then(response => response.json())
187
+ .then(data => {
188
+ let accordion = document.createElement('div');
189
+ accordion.classList.add('accordion');
190
+ accordion.classList.add('accordion-flush');
162
191
 
163
- //
164
- //
165
- fetch(apiUrl)
166
- .then(response => response.json())
167
- .then(data => {
168
- // Replace the loading message with the fetched content
169
- // when we get it
170
- contentDiv.innerHTML = "";
171
- const mv = document.createElement('model-viewer');
172
-
173
- mv.setAttribute('camera-controls', '');
174
- mv.setAttribute('autoplay', '');
175
- mv.setAttribute('interaction-prompt', 'none');
176
- mv.style.width = '100%';
177
- mv.style.height = '400px';
178
-
179
- // set the data-URI source
180
- mv.src = `data:model/gltf-binary;base64,${data.rendering}`;
181
- contentDiv.appendChild(mv);
182
- })
183
- .catch(error => {
184
- console.error('Error fetching content:', error);
185
- document.getElementById('tab-content').innerHTML = '<p>Error loading content.</p>';
186
- });
192
+ for (const prop_table of data) {
193
+ const table = document.createElement('table');
194
+ table.classList.add('table', 'table-striped', 'table-bordered');
195
+ const thead = document.createElement('thead');
196
+ const tbody = document.createElement('tbody');
197
+ thead.innerHTML = `
198
+ <tr>
199
+ <th>Property</th>
200
+ <th>Value</th>
201
+ </tr>
202
+ `;
203
+ prop_table.data.forEach(prop => {
204
+ const row = document.createElement('tr');
205
+ row.innerHTML = `
206
+ <td>${prop.name}</td>
207
+ <td>${prop.value.toFixed(2)}</td>
208
+ `;
209
+ tbody.appendChild(row);
210
+ });
211
+ table.appendChild(thead);
212
+ table.appendChild(tbody);
213
+
214
+ const item = document.createElement('div');
215
+ item.classList.add('accordion-item');
216
+ {
217
+ // Accordion item header
218
+ const header = document.createElement('span');
219
+ header.classList.add('accordion-header');
220
+ header.id = `heading-${prop_table.name}`;
221
+ const button = document.createElement('button');
222
+ button.classList.add('accordion-button');
223
+ button.setAttribute('type', 'button');
224
+ button.setAttribute('data-bs-toggle', 'collapse');
225
+ button.setAttribute('data-bs-target', `#collapse-${prop_table.name}`);
226
+ button.setAttribute('aria-expanded', 'true');
227
+ button.setAttribute('aria-controls', `collapse-${prop_table.name}`);
228
+ button.innerText = prop_table.name;
229
+ header.appendChild(button);
230
+ item.appendChild(header);
231
+ }
232
+ const collapse = document.createElement('div');
233
+ collapse.classList.add('accordion-collapse', 'collapse');
234
+ collapse.id = `collapse-${prop_table.name}`;
235
+ collapse.setAttribute('aria-labelledby', `heading-${prop_table.name}`);
236
+ collapse.setAttribute('data-bs-parent', `#accordion-${prop_table.name}`);
237
+ {
238
+ // Body
239
+ const body = document.createElement('div');
240
+ body.classList.add('accordion-body');
241
+ body.appendChild(table);
242
+ collapse.appendChild(body);
243
+ }
244
+ item.appendChild(collapse);
245
+ accordion.appendChild(item);
246
+ }
247
+ this.#propContainer.innerHTML = ''; // Clear previous content
248
+ this.#propContainer.appendChild(accordion);
249
+ })
250
+ .catch(error => {
251
+ console.error('Error analysis:', error);
252
+ this.#propContainer.innerHTML = '<p>Error loading content.</p>';
253
+ });
187
254
  }
255
+ }
188
256
  }
@@ -44,9 +44,10 @@
44
44
  <script>
45
45
  {% include "prediction/veux/navigator.js" %}
46
46
 
47
- const VIEWER = new VeuxNavigator(`/inventory/{{asset.calid}}/predictors/{{predictor.id}}/render/?section=`,
47
+ const VIEWER = new VeuxNavigator(`/inventory/{{asset.calid}}/predictors/{{predictor.id}}`,
48
48
  document.querySelector('#tab-link-container'),
49
- document.getElementById('tab-content-container'));
49
+ document.getElementById('tab-content-container'),
50
+ document.getElementById('property-viewer'));
50
51
 
51
52
  function handleMemberSelection(elem) {
52
53
  VIEWER.select(elem);
@@ -78,7 +79,8 @@ document.addEventListener('DOMContentLoaded', function () {
78
79
  document.addEventListener('DOMContentLoaded', () => {
79
80
  const container = document.getElementById("main-viewer");
80
81
 
81
- const modelPath = "{{ predictor.render_file.url|safe }}";
82
+ // const modelPath = "{# predictor.render_file.url|safe #}";
83
+ const modelPath = "/inventory/{{asset.calid}}/predictors/{{predictor.id}}/render/";
82
84
 
83
85
  const scene = createSensorRenderer(container, modelPath);
84
86
 
@@ -118,4 +120,6 @@ document.addEventListener('DOMContentLoaded', function () {
118
120
 
119
121
  });
120
122
  </script>
123
+ {% if predictor.render_file %}
124
+ {% endif %}
121
125
  {% endblock javascripts %}
irie/core/settings.py CHANGED
@@ -65,6 +65,7 @@ INSTALLED_APPS = [
65
65
  "irie.apps.documents", # TODO
66
66
  "crispy_forms",
67
67
  "crispy_bootstrap5",
68
+ "formtools"
68
69
 
69
70
  # "django_extensions", # For generating graphs, remove for deployment
70
71
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: irie
3
- Version: 0.0.58
3
+ Version: 0.0.60
4
4
  Summary: An infrastructure resilience engine
5
5
  Author-email: "Claudio M. Perez" <50180406+claudioperez@users.noreply.github.com>
6
6
  Project-URL: Repository, https://github.com/STAIRLab
@@ -26,15 +26,15 @@ Classifier: Operating System :: POSIX
26
26
  Classifier: Operating System :: Unix
27
27
  Classifier: Operating System :: MacOS
28
28
  Description-Content-Type: text/markdown
29
- Requires-Dist: tqdm
30
29
  Requires-Dist: opensees>=0.1.0
31
30
  Requires-Dist: quakeio
31
+ Requires-Dist: veux>=0.0.40
32
+ Requires-Dist: xara>=0.0.8
33
+ Requires-Dist: xcsi>=0.0.3
32
34
  Requires-Dist: mdof
33
- Requires-Dist: veux>=0.0.35
34
- Requires-Dist: xara
35
- Requires-Dist: xcsi
36
- Requires-Dist: xsection>=0.0.19
35
+ Requires-Dist: xsection>=0.0.20
37
36
  Requires-Dist: openbim
37
+ Requires-Dist: tqdm
38
38
  Requires-Dist: folium
39
39
  Requires-Dist: pandas
40
40
  Requires-Dist: numpy
@@ -56,6 +56,7 @@ Requires-Dist: django-environ==0.11.2
56
56
  Requires-Dist: djangorestframework==3.15.2
57
57
  Requires-Dist: djangorestframework-simplejwt==5.3.1
58
58
  Requires-Dist: dj-database-url==2.1.0
59
+ Requires-Dist: django-formtools
59
60
 
60
61
  <div align="center">
61
62
  <h4><code>irie</code></h4>