irie 0.0.21__py3-none-any.whl → 0.0.23__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 (36) hide show
  1. irie/apps/__init__.py +1 -1
  2. irie/apps/config.py +5 -0
  3. irie/apps/evaluation/models.py +3 -0
  4. irie/apps/events/models.py +1 -1
  5. irie/apps/inventory/models.py +14 -1
  6. irie/apps/inventory/sitemaps.py +5 -1
  7. irie/apps/inventory/urls.py +5 -4
  8. irie/apps/inventory/views.py +55 -12
  9. irie/apps/prediction/apps.py +3 -4
  10. irie/apps/prediction/forms.py +10 -8
  11. irie/apps/prediction/migrations/0003_alter_predictormodel_protocol.py +18 -0
  12. irie/apps/prediction/models.py +4 -4
  13. irie/apps/prediction/predictor.py +2 -2
  14. irie/apps/prediction/runners/__init__.py +5 -0
  15. irie/apps/prediction/runners/hazus.py +24 -39
  16. irie/apps/prediction/runners/opensees/__init__.py +1 -1
  17. irie/apps/prediction/runners/ssid.py +5 -1
  18. irie/apps/prediction/templatetags/predictor.py +0 -1
  19. irie/apps/prediction/urls.py +2 -2
  20. irie/apps/prediction/views.py +7 -9
  21. irie/apps/prediction/views_api.py +0 -4
  22. irie/apps/site/view_utils.py +2 -2
  23. irie/apps/sitemaps.py +7 -2
  24. irie/apps/templates/accounts/login.html +5 -5
  25. irie/apps/templates/inventory/asset-evals.html +70 -0
  26. irie/apps/templates/inventory/asset-event-summary.html +10 -9
  27. irie/apps/templates/inventory/asset-profile.html +12 -18
  28. irie/core/settings.py +6 -0
  29. irie/init/__main__.py +19 -9
  30. irie/init/bridges.py +26 -39
  31. irie/init/calid.py +111 -30
  32. {irie-0.0.21.dist-info → irie-0.0.23.dist-info}/METADATA +2 -2
  33. {irie-0.0.21.dist-info → irie-0.0.23.dist-info}/RECORD +36 -34
  34. {irie-0.0.21.dist-info → irie-0.0.23.dist-info}/WHEEL +0 -0
  35. {irie-0.0.21.dist-info → irie-0.0.23.dist-info}/entry_points.txt +0 -0
  36. {irie-0.0.21.dist-info → irie-0.0.23.dist-info}/top_level.txt +0 -0
irie/apps/__init__.py CHANGED
@@ -2,4 +2,4 @@
2
2
  #
3
3
  # STAIRLab -- STructural Artificial Intelligence Laboratory
4
4
  #
5
- #===----------------------------------------------------------------------===#
5
+ #===----------------------------------------------------------------------===#
irie/apps/config.py CHANGED
@@ -1,3 +1,8 @@
1
+ #===----------------------------------------------------------------------===#
2
+ #
3
+ # STAIRLab -- STructural Artificial Intelligence Laboratory
4
+ #
5
+ #===----------------------------------------------------------------------===#
1
6
  from django.apps import AppConfig
2
7
 
3
8
  class AppsConfig(AppConfig):
@@ -32,6 +32,9 @@ class Evaluation(models.Model):
32
32
  choices=Status.choices,
33
33
  default=Status.Finished)
34
34
 
35
+ def __str__(self):
36
+ return f"Evaluation {self.id} ({self.status})"
37
+
35
38
  @classmethod
36
39
  def create(cls, event: EventRecord, asset: Asset, data: dict = None):
37
40
  evaluation = cls()
@@ -21,7 +21,7 @@ from irie.apps.inventory.models import Asset
21
21
  class EventRecord(models.Model):
22
22
  id = models.BigAutoField(primary_key=True)
23
23
  upload_date = models.DateField(blank=False)
24
- event_file = models.FileField(upload_to='events', blank=True)
24
+ event_file = models.FileField(upload_to="events", blank=True)
25
25
  upload_data = models.JSONField(default=dict)
26
26
  motion_data = models.JSONField(default=dict)
27
27
  cesmd = models.CharField(max_length=7)
@@ -21,6 +21,19 @@ class Corridor(models.Model):
21
21
  def __str__(self):
22
22
  return f"{self.name} ({self.assets.count()})"
23
23
 
24
+
25
+ class _Sensor: # (models.Model):
26
+ class Status:
27
+ active: bool
28
+
29
+ status = None
30
+
31
+ class Station: # (models.Model):
32
+ sensors = None
33
+ assets = None
34
+ network = None
35
+ events = None
36
+
24
37
  class Asset(models.Model):
25
38
  id = models.BigAutoField(primary_key=True)
26
39
  cesmd = models.CharField(max_length=7, blank=True, null=True)
@@ -56,7 +69,7 @@ class Asset(models.Model):
56
69
  return None
57
70
 
58
71
  @property
59
- def predictors(self): # ->Dict[str, Predictor]:
72
+ def predictors(self):
60
73
  from irie.apps.prediction.predictor import PREDICTOR_TYPES
61
74
  from irie.apps.prediction.models import PredictorModel
62
75
  return {
@@ -1,4 +1,8 @@
1
-
1
+ #===----------------------------------------------------------------------===#
2
+ #
3
+ # STAIRLab -- STructural Artificial Intelligence Laboratory
4
+ #
5
+ #===----------------------------------------------------------------------===#
2
6
  from django.contrib.sitemaps import Sitemap
3
7
  from django.urls import reverse
4
8
  from .models import Asset # Replace with your model
@@ -12,15 +12,16 @@ from django.urls import path, re_path
12
12
  from irie.apps.inventory import views
13
13
 
14
14
  urlpatterns = [
15
- path("summarize/", views.asset_event_report),
15
+ path("summarize/", views.asset_event_report),
16
16
  path("dashboard/", views.dashboard, name="dashboard"),
17
17
  path("dashboard.html", views.dashboard),
18
- path("dashboard/demo", views.dashboard),
19
18
 
20
19
  path("asset-table.html", views.asset_table),
21
20
  path("asset-table/", views.asset_table, name="asset_table"),
22
21
  re_path(
23
- r"^evaluations/(?P<event>[0-9 A-Z-]*)/(?P<cesmd>[0-9 A-Z-]*)/.*", views.asset_event_summary, name="asset_event_summary"
22
+ "^evaluations/(?P<event>[0-9 A-Z-]*)/(?P<cesmd>[0-9 A-Z-]*)/.*", views.asset_event_summary,
23
+ name="asset_event_summary"
24
24
  ),
25
- re_path(r"^inventory/(?P<calid>[0-9 A-Z-]*)/", views.asset_profile, name="asset_profile"),
25
+ re_path("^inventory/(?P<calid>[0-9 A-Z-]*)/evaluations/$", views.asset_evals, name="asset_evals"),
26
+ re_path("^inventory/(?P<calid>[0-9 A-Z-]*)/$", views.asset_profile, name="asset_profile"),
26
27
  ]
@@ -40,7 +40,7 @@ def _fetch_rendering(request):
40
40
 
41
41
  from irie.apps.prediction.models import PredictorModel
42
42
  for p in PredictorModel.objects.filter(asset=asset):
43
- if p.protocol == "IRIE_PREDICTOR_T4":
43
+ if p.protocol == "IRIE_PREDICTOR_V1":
44
44
  return HttpResponse("html")
45
45
 
46
46
  return HttpResponse("No rendering available for this asset.")
@@ -172,6 +172,51 @@ def asset_event_report(request):
172
172
  return HttpResponse(resp)
173
173
 
174
174
 
175
+ # @login_required(login_url="/login/")
176
+ def asset_evals(request, calid):
177
+ context = {}
178
+ html_template = loader.get_template("inventory/asset-evals.html")
179
+ context["segment"] = "assets"
180
+
181
+ context["nce_version"] = True
182
+
183
+ page = request.GET.get("page", 1)
184
+ try:
185
+ page = int(page)
186
+ except:
187
+ page = 1
188
+
189
+ try:
190
+ asset = Asset.objects.get(calid=calid)
191
+
192
+ except Asset.DoesNotExist:
193
+ return raise404(request, context)
194
+
195
+ context["asset"] = asset
196
+
197
+ if asset.cesmd:
198
+ events = list(sorted(
199
+ (e.event for e in Evaluation.objects.exclude(status=Evaluation.Status.Invalid).filter(asset=asset)),
200
+ key=lambda x: x.motion_data["event_date"], reverse=True))
201
+
202
+ evals = [
203
+ {"event": event,
204
+ "pga": event.pga, #abs(event.motion_data["peak_accel"])/980.,
205
+ "evaluation": ssid,
206
+ }
207
+ for event, ssid in zip(events, ssid_stats(events, "period"))
208
+ ]
209
+ context["evaluations"] = Paginator(evals, 10).get_page(page)
210
+
211
+ try:
212
+ return HttpResponse(html_template.render(context, request))
213
+
214
+ except Exception as e:
215
+ if "DEBUG" in os.environ and os.environ["DEBUG"]:
216
+ raise e
217
+ html_template = loader.get_template("site/page-500.html")
218
+ return HttpResponse(html_template.render(context, request))
219
+
175
220
 
176
221
  # @login_required(login_url="/login/")
177
222
  def asset_profile(request, calid):
@@ -188,6 +233,12 @@ def asset_profile(request, calid):
188
233
  except Asset.DoesNotExist:
189
234
  return raise404(request, context)
190
235
 
236
+ page = request.GET.get("page", 1)
237
+ try:
238
+ page = int(page)
239
+ except:
240
+ page = 1
241
+
191
242
  context["asset"] = asset
192
243
 
193
244
  # Compute Hazus fragility probabilities and curve
@@ -196,21 +247,13 @@ def asset_profile(request, calid):
196
247
 
197
248
  # Add fragility probabilities and plot to the context
198
249
  context["hazus"] = {
199
- "probabilities": {
200
- "Slight": hazus_results.get("Slight"),
201
- "Moderate": hazus_results.get("Moderate"),
202
- "Extensive": hazus_results.get("Extensive"),
203
- "Complete": hazus_results.get("Complete"),
204
- },
205
250
  "sa_range": json.dumps(hazus_results["sa_range"]),
206
251
  "curves": json.dumps(hazus_results["curves"])
207
- # "plot_base64": hazus_results.get("plot_base64"),
208
252
  }
209
253
  except Exception as e:
210
254
  print(e)
211
255
  pass
212
256
 
213
-
214
257
  context["tables"] = _make_tables(asset)
215
258
 
216
259
  if asset.cesmd:
@@ -220,7 +263,6 @@ def asset_profile(request, calid):
220
263
  (e.event for e in Evaluation.objects.exclude(status=Evaluation.Status.Invalid).filter(asset=asset)),
221
264
  key=lambda x: x.motion_data["event_date"], reverse=True))
222
265
 
223
-
224
266
  evals = [
225
267
  {"event": event,
226
268
  "pga": event.pga, #abs(event.motion_data["peak_accel"])/980.,
@@ -261,8 +303,9 @@ def _make_tables(asset):
261
303
  "Owner Agency",
262
304
  "Year Reconstructed",
263
305
  "Bridge Posting Code",
264
- "Latitude",
265
- "Longitude",
306
+ # "Latitude",
307
+ # "Longitude",
308
+ "Structure Number",
266
309
  "NBIS Minimum Bridge Length",
267
310
  "Record Type",
268
311
  "State Name",
@@ -6,7 +6,6 @@
6
6
  from django.apps import AppConfig
7
7
 
8
8
  class PredictionConfig(AppConfig):
9
- default_auto_field = 'django.db.models.BigAutoField'
10
- name = 'irie.apps.prediction'
11
- label = 'apps_prediction'
12
-
9
+ default_auto_field = "django.db.models.BigAutoField"
10
+ name = "irie.apps.prediction"
11
+ label = "apps_prediction"
@@ -9,11 +9,13 @@ from irie.apps.prediction.models import PredictorModel
9
9
  class PredictorForm(forms.ModelForm):
10
10
  class Meta:
11
11
  model = PredictorModel
12
- fields = '__all__'
13
- exclude = ['render_file',
14
- 'asset',
15
- 'metrics',
16
- 'active',
17
- 'entry_point',
18
- 'config',
19
- 'protocol']
12
+ fields = "__all__"
13
+ exclude = [
14
+ "render_file",
15
+ "asset",
16
+ "metrics",
17
+ "active",
18
+ "entry_point",
19
+ "config",
20
+ "protocol"
21
+ ]
@@ -0,0 +1,18 @@
1
+ # Generated by Django 5.1.2 on 2024-12-15 00:56
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('apps_prediction', '0002_alter_predictormodel_protocol'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AlterField(
14
+ model_name='predictormodel',
15
+ name='protocol',
16
+ field=models.CharField(choices=[('IRIE_PREDICTOR_V1', 'Type1'), ('IRIE_PREDICTOR_T2', 'Type2')], default='IRIE_PREDICTOR_T2', max_length=25),
17
+ ),
18
+ ]
@@ -12,8 +12,8 @@ class PredictorModel(models.Model):
12
12
  class Protocol(models.TextChoices):
13
13
  TYPE1 = "IRIE_PREDICTOR_V1"
14
14
  TYPE2 = "IRIE_PREDICTOR_T2"
15
- TYPE3 = "IRIE_PREDICTOR_T3"
16
- TYPE4 = "IRIE_PREDICTOR_T4"
15
+ # TYPE3 = "IRIE_PREDICTOR_T3"
16
+ # TYPE4 = "IRIE_PREDICTOR_T4"
17
17
 
18
18
  id = models.BigAutoField(primary_key=True)
19
19
  name = models.CharField(max_length=35)
@@ -26,8 +26,8 @@ class PredictorModel(models.Model):
26
26
 
27
27
  entry_point = models.JSONField(default=list)
28
28
  config = models.JSONField(default=dict)
29
- config_file = models.FileField(upload_to='predictor_configs/', null=True, blank=True)
30
- render_file = models.FileField(upload_to='renderings/', null=True, blank=True)
29
+ config_file = models.FileField(upload_to="predictor_configs/", null=True, blank=True)
30
+ render_file = models.FileField(upload_to="renderings/", null=True, blank=True)
31
31
  metrics = models.JSONField(default=list)
32
32
 
33
33
  active = models.BooleanField()
@@ -17,9 +17,9 @@ from .runners.opensees import OpenSeesRunner
17
17
  from .runners.ssid import SystemIdRunner
18
18
 
19
19
  PREDICTOR_TYPES : Dict[str, Runner] = {
20
- # "IRIE_PREDICTOR_V1" : PredictorType1,
20
+ "IRIE_PREDICTOR_V1" : OpenSeesRunner,
21
21
  "IRIE_PREDICTOR_T2" : SystemIdRunner,
22
- "" : SystemIdRunner,
22
+ # "" : SystemIdRunner,
23
23
  # "IRIE_PREDICTOR_T3" : PredictorType3,
24
24
  "IRIE_PREDICTOR_T4" : OpenSeesRunner,
25
25
  }
@@ -1,3 +1,8 @@
1
+ #===----------------------------------------------------------------------===#
2
+ #
3
+ # STAIRLab -- STructural Artificial Intelligence Laboratory
4
+ #
5
+ #===----------------------------------------------------------------------===#
1
6
  from pathlib import Path
2
7
  from typing import NewType
3
8
  from abc import abstractmethod
@@ -47,11 +47,10 @@ class HazusRunner(Runner):
47
47
  platform = "mdof"
48
48
 
49
49
  schema = {
50
- "title": "System ID",
51
- "name": "P2",
50
+ "title": "Hazus",
52
51
  "type": "object",
53
52
  "required": [
54
- "name",
53
+ "soil_type",
55
54
  "decimation",
56
55
  "method",
57
56
  "channels"
@@ -60,26 +59,12 @@ class HazusRunner(Runner):
60
59
  "name": {
61
60
  "type": "string",
62
61
  "title": "Name",
63
- "description": "Predictor name",
64
- "minLength": 2,
65
- # "default": "S1"
62
+ "default": "Hazus"
66
63
  },
67
- "method": {
64
+ "soil_type": {
68
65
  "type": "string",
69
- "title": "Method",
70
- "enum": ["Fourier Spectrum","Response Spectrum","SRIM","OKID"]
71
- },
72
- "damping": {
73
- "type": "number",
74
- "title": "Damping",
75
- "default": 0.02,
76
- "options": {"dependencies": {"method": ["Response Spectrum"]}},
77
- "description": "assumed damping ratio"
78
- },
79
- "channel": {
80
- "type": "integer",
81
- "title": "Channel",
82
- "description": ""
66
+ "title": "Soil type",
67
+ "enum": ["A","B","C","D"]
83
68
  }
84
69
  }
85
70
  }
@@ -162,6 +147,7 @@ def hazus_fragility(
162
147
 
163
148
  return dict(sa_range=sa_range, curves=curves)
164
149
 
150
+
165
151
  def hazus_prediction(
166
152
  nbi_data: dict,
167
153
  soil_type: str = "B", # Soil classification ("A", "B", "C", "D", "E")
@@ -324,11 +310,11 @@ def modify_ground_motion(soil_type: str, pga: float, sa_03s: float, sa_10s: floa
324
310
  ],
325
311
  "FA": [
326
312
  (0.25, {"A": 0.8, "B": 0.9, "C": 1.3, "D": 1.6, "E": 2.4}),
327
- (0.5, {"A": 0.8, "B": 0.9, "C": 1.3, "D": 1.4, "E": 1.7}),
313
+ (0.50, {"A": 0.8, "B": 0.9, "C": 1.3, "D": 1.4, "E": 1.7}),
328
314
  (0.75, {"A": 0.8, "B": 0.9, "C": 1.2, "D": 1.2, "E": 1.3}),
329
- (1.0, {"A": 0.8, "B": 0.9, "C": 1.2, "D": 1.1, "E": 1.1}),
315
+ (1.00, {"A": 0.8, "B": 0.9, "C": 1.2, "D": 1.1, "E": 1.1}),
330
316
  (1.25, {"A": 0.8, "B": 0.9, "C": 1.2, "D": 1.0, "E": 0.9}),
331
- (1.5, {"A": 0.8, "B": 0.9, "C": 1.2, "D": 1.0, "E": 0.8}),
317
+ (1.50, {"A": 0.8, "B": 0.9, "C": 1.2, "D": 1.0, "E": 0.8}),
332
318
  ],
333
319
  "FV": [
334
320
  (0.1, {"A": 0.8, "B": 0.8, "C": 1.5, "D": 2.4, "E": 4.2}),
@@ -420,11 +406,11 @@ def _get_i_shape(bridge_type: int) -> int:
420
406
  """
421
407
  # Mapping of bridge types to I_shape values from Table 7-1
422
408
  i_shape_mapping = {
423
- 1: 0, 2: 0, 3: 1, 4: 1, 5: 0, 6: 0,
424
- 7: 0, 8: 0, 9: 0, 10: 1, 11: 1, 12: 0,
425
- 13: 0, 14: 0, 15: 1, 16: 1, 17: 0, 18: 0,
426
- 19: 0, 20: 0, 21: 0, 22: 1, 23: 1, 24: 0,
427
- 25: 0, 26: 1, 27: 1,
409
+ 1 : 0, 2 : 0, 3 : 1, 4 : 1, 5 : 0, 6 : 0,
410
+ 7 : 0, 8 : 0, 9 : 0, 10: 1, 11: 1, 12: 0,
411
+ 13: 0, 14: 0, 15: 1, 16: 1, 17: 0, 18: 0,
412
+ 19: 0, 20: 0, 21: 0, 22: 1, 23: 1, 24: 0,
413
+ 25: 0, 26: 1, 27: 1,
428
414
  }
429
415
 
430
416
  if bridge_type not in i_shape_mapping:
@@ -537,38 +523,37 @@ def _hazus_type(properties: dict) -> int:
537
523
  HWB5 101 106 Non-CA < 1990 N/A N/A N/A EQ1 0 Conventional Multi-Col. Bent, Simple Support - Concrete
538
524
  HWB6 101 106 CA < 1975 N/A N/A N/A EQ1 0 Conventional Multi-Col. Bent, Simple Support - Concrete
539
525
  HWB7 101 106 Non-CA >= 1990 N/A N/A N/A EQ1 0 Seismic Multi-Col. Bent, Simple Support - Concrete
540
- 101 106 CA >= 1975 N/A N/A N/A EQ1 0 Seismic Multi-Col. Bent, Simple Support - Concrete
526
+ 101 106 CA >= 1975 N/A N/A N/A EQ1 0 Seismic Multi-Col. Bent, Simple Support - Concrete
541
527
  HWB8 205 206 CA < 1975 N/A N/A N/A EQ2 0 Conventional Single Col., Box Girder - Continuous Concrete
542
528
  HWB9 205 206 CA >= 1975 N/A N/A N/A EQ3 0 Seismic Single Col., Box Girder - Continuous Concrete
543
529
  HWB10 201 206 Non-CA < 1990 N/A N/A N/A EQ2 1 Conventional Continuous Concrete
544
- 201 206 CA < 1975 N/A N/A N/A EQ2 1 Conventional Continuous Concrete
530
+ 201 206 CA < 1975 N/A N/A N/A EQ2 1 Conventional Continuous Concrete
545
531
  HWB11 201 206 Non-CA >= 1990 N/A N/A N/A EQ3 1 Seismic Continuous Concrete
546
- 201 206 CA >= 1975 N/A N/A N/A EQ3 1 Seismic Continuous Concrete
532
+ 201 206 CA >= 1975 N/A N/A N/A EQ3 1 Seismic Continuous Concrete
547
533
  HWB12 301 306 Non-CA < 1990 N/A N/A No EQ4 0 Conventional Multi-Col. Bent, Simple Support - Steel
548
534
  HWB13 301 306 CA < 1975 N/A N/A No EQ4 0 Conventional Multi-Col. Bent, Simple Support - Steel
549
535
  HWB14 301 306 Non-CA >= 1990 N/A N/A N/A EQ1 0 Seismic Multi-Col. Bent, Simple Support - Steel
550
- 301 306 CA >= 1975 N/A N/A N/A EQ1 0 Seismic Multi-Col. Bent, Simple Support - Steel
536
+ 301 306 CA >= 1975 N/A N/A N/A EQ1 0 Seismic Multi-Col. Bent, Simple Support - Steel
551
537
  HWB15 402 410 Non-CA < 1990 N/A N/A No EQ5 1 Conventional Continuous Steel
552
- 402 410 CA < 1975 N/A N/A No EQ5 1 Conventional Continuous Steel
538
+ 402 410 CA < 1975 N/A N/A No EQ5 1 Conventional Continuous Steel
553
539
  HWB16 402 410 Non-CA >= 1990 N/A N/A N/A EQ3 1 Seismic Continuous Steel
554
- 402 410 CA >= 1975 N/A N/A N/A EQ3 1 Seismic Continuous Steel
540
+ 402 410 CA >= 1975 N/A N/A N/A EQ3 1 Seismic Continuous Steel
555
541
  HWB17 501 506 Non-CA < 1990 N/A N/A N/A EQ1 0 Conventional Multi-Col. Bent, Simple Support - Prestressed Concrete
556
542
  HWB18 501 506 CA < 1975 N/A N/A N/A EQ1 0 Conventional Multi-Col. Bent, Simple Support - Prestressed Concrete
557
543
  HWB19 501 506 Non-CA >= 1990 N/A N/A N/A EQ1 0 Seismic Multi-Col. Bent, Simple Support - Prestressed Concrete
558
- 501 506 CA >= 1975 N/A N/A N/A EQ1 0 Seismic Multi-Col. Bent, Simple Support - Prestressed Concrete
544
+ 501 506 CA >= 1975 N/A N/A N/A EQ1 0 Seismic Multi-Col. Bent, Simple Support - Prestressed Concrete
559
545
  HWB20 605 606 CA < 1975 N/A N/A N/A EQ2 0 Conventional Single Col., Box Girder - Prestressed Continuous Concrete
560
546
  HWB21 605 606 CA >= 1975 N/A N/A N/A EQ3 0 Seismic Single Col., Box Girder - Prestressed Continuous Concrete
561
547
  HWB22 601 607 Non-CA < 1990 N/A N/A N/A EQ2 1 Conventional Continuous Concrete
562
- 601 607 CA < 1975 N/A N/A N/A EQ2 1 Conventional Continuous Concrete
548
+ 601 607 CA < 1975 N/A N/A N/A EQ2 1 Conventional Continuous Concrete
563
549
  HWB23 601 607 Non-CA >= 1990 N/A N/A N/A EQ3 1 Seismic Continuous Concrete
564
- 601 607 CA >= 1975 N/A N/A N/A EQ3 1 Seismic Continuous Concrete
550
+ 601 607 CA >= 1975 N/A N/A N/A EQ3 1 Seismic Continuous Concrete
565
551
  HWB24 301 306 Non-CA < 1990 N/A N/A Yes EQ6 0 Conventional Multi-Col. Bent, Simple Support - Steel
566
552
  HWB25 301 306 CA < 1975 N/A N/A Yes EQ6 0 Conventional Multi-Col. Bent, Simple Support - Steel
567
553
  HWB26 402 410 Non-CA < 1990 N/A N/A Yes EQ7 1 Conventional Continuous Steel
568
554
  HWB27 402 410 CA < 1975 N/A N/A Yes EQ7 1 Conventional Continuous Steel
569
555
  HWB28 N/A N/A All other bridges that are not classified
570
556
 
571
-
572
557
  --------------------------
573
558
 
574
559
  Table 9-7: Hazus Highway System Classification
@@ -69,7 +69,7 @@ class OpenSeesRunner(Runner):
69
69
  predictor.name = data.pop("name")
70
70
  predictor.config = data
71
71
  predictor.asset = asset
72
- predictor.protocol = "IRIE_PREDICTOR_T4"
72
+ predictor.protocol = "IRIE_PREDICTOR_V1"
73
73
  predictor.active = True
74
74
  return predictor
75
75
 
@@ -1,3 +1,8 @@
1
+ #===----------------------------------------------------------------------===#
2
+ #
3
+ # STAIRLab -- STructural Artificial Intelligence Laboratory
4
+ #
5
+ #===----------------------------------------------------------------------===#
1
6
  from irie.apps.events.models import EventRecord
2
7
  from irie.apps.prediction.runners import Runner, RunID
3
8
  from irie.apps.prediction.models import PredictorModel
@@ -47,7 +52,6 @@ class SystemIdRunner(Runner):
47
52
  "title": "Name",
48
53
  "description": "Predictor name",
49
54
  "minLength": 2,
50
- # "default": "S1"
51
55
  },
52
56
  "method": {
53
57
  "type": "string",
@@ -9,7 +9,6 @@ def display_predictor(predictor):
9
9
  out = out + predictor.description
10
10
  out = out + "\n".join((out, '<table class="table align-items-center"><tbody>'))
11
11
 
12
- #for key, val in predictor.conf.get("config", {}).items():
13
12
  for key, val in predictor.conf.items():
14
13
  name = predictor.schema["properties"].get(key, {"name": key}).get("name", key)
15
14
  out = out + f"<tr><td>{name}</td><td><code>{val}</code></td><tr>"
@@ -7,12 +7,12 @@
7
7
  # Author: Claudio Perez
8
8
  #
9
9
  #----------------------------------------------------------------------------#
10
- from django.urls import path, re_path
10
+ from django.urls import re_path
11
11
  from .views import new_prediction, asset_predictors, predictor_profile, predictor_upload
12
12
 
13
13
  urlpatterns = [
14
14
  re_path("^inventory/[0-9 A-Z-]*/predictors/new", new_prediction),
15
15
  re_path("^inventory/(?P<calid>[0-9 A-Z-]*)/predictors/(?P<preid>[0-9 A-Z-]{1,})", predictor_profile),
16
16
  re_path("^inventory/(?P<calid>[0-9 A-Z-]*)/predictors/create", predictor_upload),
17
- re_path("^inventory/[0-9 A-Z-]*/predictors/", asset_predictors, name="asset_predictors")
17
+ re_path("^inventory/(?P<calid>[0-9 A-Z-]*)/predictors/", asset_predictors, name="asset_predictors")
18
18
  ]
@@ -21,7 +21,7 @@ from django.shortcuts import render
21
21
 
22
22
  from irie.apps.site.view_utils import raise404
23
23
  from irie.apps.inventory.models import Asset
24
- from irie.apps.prediction.predictor import PREDICTOR_TYPES, OpenSeesRunner
24
+ from irie.apps.prediction.predictor import PREDICTOR_TYPES
25
25
  from irie.apps.prediction.models import PredictorModel
26
26
  from .forms import PredictorForm
27
27
 
@@ -36,9 +36,7 @@ def new_prediction(request):
36
36
 
37
37
 
38
38
  @login_required(login_url="/login/")
39
- def asset_predictors(request):
40
-
41
- calid = request.path.split("/")[-3]
39
+ def asset_predictors(request, calid):
42
40
 
43
41
  context = {"segment": "inventory"}
44
42
 
@@ -55,6 +53,7 @@ def asset_predictors(request):
55
53
 
56
54
  try:
57
55
  context["asset"] = Asset.objects.get(calid=calid)
56
+
58
57
  except Asset.DoesNotExist:
59
58
  return HttpResponse(
60
59
  loader.get_template("site/page-404-sidebar.html").render(context, request)
@@ -103,9 +102,8 @@ def predictor_upload(request, calid):
103
102
 
104
103
  html_template = loader.get_template("prediction/predictor-upload.html")
105
104
 
106
- if request.method == 'POST':
107
- form = PredictorForm(request.POST, request.FILES) # include request.FILES
108
- # if form.is_valid():
105
+ if request.method == "POST":
106
+ form = PredictorForm(request.POST, request.FILES)
109
107
  asset = Asset.objects.get(calid=calid)
110
108
 
111
109
  # Save the predictor
@@ -119,12 +117,12 @@ def predictor_upload(request, calid):
119
117
 
120
118
 
121
119
  try:
122
- return render(request, 'prediction/predictor-upload.html', {"form": form})
120
+ return render(request, "prediction/predictor-upload.html", {"form": form})
123
121
 
124
122
  except Exception as e:
125
123
  if "DEBUG" in os.environ and os.environ["DEBUG"]:
126
124
  raise e
127
125
  html_template = loader.get_template("site/page-500.html")
128
- return HttpResponse(html_template.render(context, request))
126
+ return HttpResponse(html_template.render({}, request))
129
127
 
130
128
 
@@ -25,8 +25,6 @@ from rest_framework.permissions import IsAuthenticated
25
25
 
26
26
  from .models import Event
27
27
  from irie.apps.inventory.models import Asset
28
- # from irie.apps.evaluation.evaluation import (run_evaluation,
29
- # add_evaluation)
30
28
  from irie.apps.evaluation.models import Evaluation
31
29
  import quakeio
32
30
 
@@ -40,7 +38,6 @@ def serialize_event(event):
40
38
  else:
41
39
  serialized["event_file"] = None
42
40
 
43
- #serialized["data_str"] = json.loads(event.data_str) if event.data_str else {}
44
41
  return serialized
45
42
 
46
43
 
@@ -116,7 +113,6 @@ def save_event(request, event, success_status):
116
113
  event.cesmd = "CE" + event.motion_data["station_number"]
117
114
  event.asset = Asset.objects.get(cesmd="CE" + event.motion_data["station_number"])
118
115
  event.event_file = event_file
119
- # if event_file is not None:
120
116
 
121
117
  event.save()
122
118
 
@@ -7,7 +7,7 @@ def raise404(request, context={}, error=None):
7
7
  if error is not None and "DEBUG" in os.environ and os.environ["DEBUG"]:
8
8
  raise error
9
9
  if "segment" in context:
10
- html_template = loader.get_template("home/page-404-sidebar.html")
10
+ html_template = loader.get_template("site/page-404-sidebar.html")
11
11
  else:
12
- html_template = loader.get_template("home/page-404.html")
12
+ html_template = loader.get_template("site/page-404.html")
13
13
  return HttpResponse(html_template.render(context, request))
irie/apps/sitemaps.py CHANGED
@@ -1,13 +1,18 @@
1
+ #===----------------------------------------------------------------------===#
2
+ #
3
+ # STAIRLab -- STructural Artificial Intelligence Laboratory
4
+ #
5
+ #===----------------------------------------------------------------------===#
1
6
  from django.contrib.sitemaps import Sitemap
2
7
  from django.urls import reverse
3
8
 
4
9
  class IrieSitemap(Sitemap):
5
10
  priority = 0.9
6
- changefreq = 'weekly'
11
+ changefreq = "weekly"
7
12
 
8
13
  def items(self):
9
14
  # Return the names of your static views
10
- return ['home', 'about', 'dashboard', 'asset_table']
15
+ return ["home", "about", "dashboard", "asset_table"]
11
16
 
12
17
  def location(self, item):
13
18
  return reverse(item)
@@ -18,11 +18,11 @@
18
18
  <h1 class="mb-0 h3">Sign In</h1>
19
19
  <br />
20
20
  <p>
21
- {% if msg %}
22
- <span class="text-danger">{{ msg | safe }}</span>
23
- {% else %}
24
- Add your credentials
25
- {% endif %}
21
+ {% if msg %}
22
+ <span class="text-danger">{{ msg | safe }}</span>
23
+ {% else %}
24
+ Add your credentials
25
+ {% endif %}
26
26
  </p>
27
27
  </div>
28
28
  <form method="post" action="" class="mt-4">