irie 0.0.19__py3-none-any.whl → 0.0.20__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.

@@ -60,18 +60,6 @@ class LiveEvaluation:
60
60
  return mname
61
61
 
62
62
  def setMetricData(self, mname: str, pid: str, data: dict):
63
- # self.metrics[mname][pid].data = data
64
- # try:
65
- # self.evaluation_data[mname]["details"][pid] = data["details"]
66
- # except KeyError:
67
- # self.evaluation_data[mname]["details"][pid] = data
68
- # self.metrics[mname][pid].buildDetails()
69
- # try:
70
- # None
71
- # except KeyError:
72
- # self.evaluation_data[mname]["summary"][pid] = \
73
- # self.metrics[mname][pid].getSummary()
74
-
75
63
  self.evaluation_data[mname]["details"][pid] = data.get("details", data)
76
64
  self.evaluation_data[mname]["summary"][pid] = data.get("summary", data)
77
65
  if len(self.evaluation_data[mname]["summary"]) == 1:
@@ -0,0 +1,18 @@
1
+ # Generated by Django 5.1.2 on 2024-12-14 07:51
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('irie_apps_evaluation', '0001_initial'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AddField(
14
+ model_name='evaluation',
15
+ name='status',
16
+ field=models.CharField(choices=[('Finished', 'Finished'), ('Running', 'Running'), ('Invalid', 'Invalid')], default='Finished', max_length=25),
17
+ ),
18
+ ]
@@ -19,16 +19,25 @@ from irie.apps.inventory.models import Asset
19
19
  from .daemon import LiveEvaluation
20
20
 
21
21
  class Evaluation(models.Model):
22
+ class Status(models.TextChoices):
23
+ Finished = "Finished"
24
+ Running = "Running"
25
+ Invalid = "Invalid"
26
+
22
27
  id = models.BigAutoField(primary_key=True)
23
28
  event = models.ForeignKey(EventRecord, on_delete=models.CASCADE)
24
29
  asset = models.ForeignKey(Asset, on_delete=models.CASCADE, null=True)
25
30
  evaluation_data = models.JSONField(default=dict)
31
+ status = models.CharField(max_length=25,
32
+ choices=Status.choices,
33
+ default=Status.Finished)
26
34
 
27
35
  @classmethod
28
36
  def create(cls, event: EventRecord, asset: Asset, data: dict = None):
29
37
  evaluation = cls()
30
38
  evaluation.event = event
31
39
  evaluation.asset = asset
40
+ evaluation.status = Evaluation.Status.Running
32
41
  evaluation.save()
33
42
 
34
43
  if data is not None:
@@ -43,6 +52,7 @@ class Evaluation(models.Model):
43
52
 
44
53
  def evaluate(event, evaluation)->"Evaluation":
45
54
 
55
+ count_okay = 0
46
56
  daemon = LiveEvaluation(event, event.asset.predictors, evaluation)
47
57
 
48
58
  # assignPredictorMetrics?
@@ -63,11 +73,18 @@ def evaluate(event, evaluation)->"Evaluation":
63
73
  for mname in predictions[predictor_name][1]:
64
74
  print(f">>> Retrieving {predictor_name}/{mname}.", file=sys.stderr)
65
75
  data = daemon.predictors[predictor_name].getMetricData(run_id, mname)
66
- daemon.setMetricData(mname, predictor_name, data)
76
+ if data is not None:
77
+ count_okay += 1
78
+ daemon.setMetricData(mname, predictor_name, data)
67
79
 
68
80
  print(f">>> Completed {predictor_name}.", file=sys.stderr)
69
81
 
82
+ if count_okay:
83
+ evaluation.status = Evaluation.Status.Finished
84
+ else:
85
+ evaluation.status = Evaluation.Status.Invalid
70
86
 
87
+ evaluation.save()
71
88
  daemon.save()
72
89
  return evaluation
73
90
 
@@ -25,6 +25,8 @@ from .filters import AssetFilter
25
25
  # Predictors
26
26
  from irie.apps.prediction.runners.hazus import hazus_fragility
27
27
  from irie.apps.prediction.runners.ssid import make_mountains, ssid_stats, ssid_event_plot
28
+ # Evaluations
29
+ from irie.apps.evaluation.models import Evaluation
28
30
 
29
31
 
30
32
  @login_required(login_url="/login/")
@@ -47,7 +49,6 @@ def _fetch_rendering(request):
47
49
 
48
50
  @login_required(login_url="/login/")
49
51
  def asset_event_summary(request, cesmd, event):
50
- from irie.apps.evaluation.models import Evaluation
51
52
 
52
53
  context = {}
53
54
  context["segment"] = "events"
@@ -113,7 +114,7 @@ def dashboard(request):
113
114
  context["demo_version"] = True
114
115
 
115
116
  context["recent_evaluations"] = [
116
- (Evaluation.objects.get(event_id=event.id), event)
117
+ (Evaluation.objects.exclude(status=Evaluation.Status.Invalid).get(event_id=event.id), event)
117
118
  for event in sorted(EventRecord.objects.all(),
118
119
  key=lambda x: x.motion_data["event_date"], reverse=True)[:6]
119
120
  ]
@@ -205,7 +206,8 @@ def asset_profile(request, calid):
205
206
  "curves": json.dumps(hazus_results["curves"])
206
207
  # "plot_base64": hazus_results.get("plot_base64"),
207
208
  }
208
- except:
209
+ except Exception as e:
210
+ print(e)
209
211
  pass
210
212
 
211
213
 
@@ -214,8 +216,10 @@ def asset_profile(request, calid):
214
216
  if asset.cesmd:
215
217
  cesmd = asset.cesmd
216
218
 
217
- events = list(reversed(sorted(EventRecord.objects.filter(cesmd=cesmd),
218
- key=lambda x: x.motion_data["event_date"])))
219
+ events = list(sorted(
220
+ (e.event for e in Evaluation.objects.exclude(status=Evaluation.Status.Invalid).filter(asset=asset)),
221
+ key=lambda x: x.motion_data["event_date"], reverse=True))
222
+
219
223
 
220
224
  evals = [
221
225
  {"event": event,
@@ -20,11 +20,10 @@
20
20
  <nav aria-label="breadcrumb" class="d-none d-md-inline-block">
21
21
  <ol class="breadcrumb breadcrumb-dark breadcrumb-transparent">
22
22
  <li class="breadcrumb-item">
23
- <a href="/">
23
+ <a href="{% url 'dashboard' %}">
24
24
  <svg class="icon icon-xxs" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path></svg>
25
25
  </a>
26
26
  </li>
27
- <li class="breadcrumb-item"><a href="{% url 'dashboard' %}">BRACE<sup>2</sup></a></li>
28
27
  <li class="breadcrumb-item" aria-current="page">Evaluations</li>
29
28
  <li class="breadcrumb-item" aria-current="page">{{ event.id }}</li>
30
29
  <li class="breadcrumb-item active"><code>{{ asset.calid }}</code></li>
@@ -126,11 +126,10 @@
126
126
  <nav aria-label="breadcrumb" class="d-none d-md-inline-block">
127
127
  <ol class="breadcrumb breadcrumb-dark breadcrumb-transparent">
128
128
  <li class="breadcrumb-item">
129
- <a href="/">
129
+ <a href="{% url 'dashboard' %}">
130
130
  <svg class="icon icon-xxs" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path></svg>
131
131
  </a>
132
132
  </li>
133
- <li class="breadcrumb-item"><a href="{% url 'dashboard' %}">BRACE<sup>2</sup></a></li>
134
133
  <li class="breadcrumb-item" aria-current="page"><a href="{% url 'asset_table' %}">Inventory</a></li>
135
134
  <li class="breadcrumb-item active"><code>{{ asset.calid }}</code></li>
136
135
  </ol>
@@ -28,11 +28,10 @@ table a[href^="https://"]::after
28
28
  <nav aria-label="breadcrumb" class="d-none d-md-inline-block">
29
29
  <ol class="breadcrumb breadcrumb-dark breadcrumb-transparent">
30
30
  <li class="breadcrumb-item">
31
- <a href="/">
31
+ <a href="{% url 'dashboard' %}">
32
32
  <svg class="icon icon-xxs" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path></svg>
33
33
  </a>
34
34
  </li>
35
- <li class="breadcrumb-item"><a href="{% url 'dashboard' %}">BRACE<sup>2</sup></a></li>
36
35
  <li class="breadcrumb-item active" aria-current="page">Inventory</li>
37
36
  </ol>
38
37
  </nav>
irie/init/__main__.py CHANGED
@@ -16,9 +16,9 @@ def init(settings):
16
16
  "migrate"
17
17
  ])
18
18
 
19
- # call_command("makemigrations")
19
+ call_command("makemigrations")
20
20
 
21
- # call_command("migrate")
21
+ call_command("migrate")
22
22
 
23
23
  # call_command("init_assets")
24
24
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: irie
3
- Version: 0.0.19
3
+ Version: 0.0.20
4
4
  Summary: 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
@@ -23,12 +23,13 @@ irie/apps/documents/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
23
23
  irie/apps/evaluation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  irie/apps/evaluation/admin.py,sha256=kn7L9M8Vrcc8UfmnwOV_JS8TV464-21xEKV6VyX2Ni8,1379
25
25
  irie/apps/evaluation/apps.py,sha256=siqeOaH_tmCU0edSPIWcw_6cmvw5gHWpbeWWbuTUYGM,557
26
- irie/apps/evaluation/daemon.py,sha256=GRZaECGz0nfuGehJd8iU4bg5UXHLd3wr0XXAZbBloxM,3859
26
+ irie/apps/evaluation/daemon.py,sha256=9iTefaGUOELIqJgeSdZUPcx7rKdRvxkVuwDpQ1DM7ME,3405
27
27
  irie/apps/evaluation/identification.py,sha256=Y1c6AlUlawas2fVOxDxowK_W1aJEDhe9b3NUYIXf40M,6183
28
- irie/apps/evaluation/models.py,sha256=yYgc9ey4TgfGJGgsWc836G--8l-KNQjdCmt6OyLhaS8,2373
28
+ irie/apps/evaluation/models.py,sha256=Wks_phbD1fOG7aGj1W7XQuJB1EaUf1lWBHRdgEMqo34,2970
29
29
  irie/apps/evaluation/urls.py,sha256=DnLB-MADpbZZxmdmgPbx2CAvdPv2X0pVgvoJmrYwzr0,483
30
30
  irie/apps/evaluation/views.py,sha256=vhQpT7Q-rotzmU_VB6Dx-1RxpX454cqK2nz4aIPp4YI,2341
31
31
  irie/apps/evaluation/migrations/0001_initial.py,sha256=Bu9By3pDY-Dls_dSUGBQOGlrs0dGQPRCZrOC7gxtb1I,846
32
+ irie/apps/evaluation/migrations/0002_evaluation_status.py,sha256=XkvEtJDmE7h48wrj_dguhAUmFSk2nMUYD09c8nhvp9c,494
32
33
  irie/apps/evaluation/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
34
  irie/apps/events/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
35
  irie/apps/events/admin.py,sha256=YbPPlS1d4NZ-Ah3LVtIKER1wtVK-y7kRA9H_-ql9kRs,342
@@ -56,7 +57,7 @@ irie/apps/inventory/sitemaps.py,sha256=yc3UMVuGWA8vC9zHseY1jfkeRw5_jTYjy-UUcGtGw
56
57
  irie/apps/inventory/tables.py,sha256=vZdPOcbN1ibuWXqLwbBUoQw9iavwa1GJ5fd83k8bu7Y,27874
57
58
  irie/apps/inventory/traffic.py,sha256=B3PHqn2Pm4AEdUZ_tuA16fuFruo2rm5waMBwLQyF-9g,4490337
58
59
  irie/apps/inventory/urls.py,sha256=mpmHjvDSHhC5xrEosbTH_h2bGWNJfslGcrt2mnUO40E,1019
59
- irie/apps/inventory/views.py,sha256=QA0zw7uRYdChF3bW6GZzjiUmtO_u8T45onFz-w5m_1U,14439
60
+ irie/apps/inventory/views.py,sha256=nfFG1AsCSuZPtMcCxKYxrbrQqK27iOExz1RhSSAQCRc,14596
60
61
  irie/apps/inventory/archive/arcGIS.py,sha256=vcfsy1be4edOXD1Z3rkUnq9QmCTol7dypdF816Q3B_w,34893
61
62
  irie/apps/inventory/migrations/0001_initial.py,sha256=PwTHv4Q3gqWFha--8Zp9kUOh-cYalB14jXj7RVJUVnw,1786
62
63
  irie/apps/inventory/migrations/0002_alter_asset_bridge_sensors_and_more.py,sha256=rPzWHkjg-ZCorVA_gv6MVb5F6LTLHcwlPwhBR1PxVr0,842
@@ -370,9 +371,9 @@ irie/apps/templates/includes/paginate.js,sha256=dAaL4uFQzEIbm61c_USEHlQLFkKc2ndJ
370
371
  irie/apps/templates/includes/scripts.html,sha256=1Up6xJJSTpdLTJp0tDAa3JubevvSlicOE4_j1vEOkek,1190
371
372
  irie/apps/templates/includes/settings-box.html,sha256=wexsLS4SMRyKci-r4L_LQ6QM27h4U291091NcGiTT3o,2486
372
373
  irie/apps/templates/includes/sidebar.html,sha256=uJnzXtcV7UvXscvEHe5z0wpLsFZk8B9mj1_Ye08NRbY,10972
373
- irie/apps/templates/inventory/asset-event-summary.html,sha256=ZDhCIO6gV6XTeLDZt2l5X47hBv9jXsLL4p9yflbu-mk,50749
374
- irie/apps/templates/inventory/asset-profile.html,sha256=iHUT9In2zjiVBZ3NHnrQMLkUAIaELMMHZm2UHFXMiR8,11289
375
- irie/apps/templates/inventory/asset-table.html,sha256=A-1hVxDxuahlZQ1CYFb2fKO9710wKk5NoZN-dNBjrNE,12208
374
+ irie/apps/templates/inventory/asset-event-summary.html,sha256=BmLAFtfNDi98aZIu5WbkPMda-QZgoWhssN6l3e2QLgE,50672
375
+ irie/apps/templates/inventory/asset-profile.html,sha256=0j8JdAu8fKGOnGjkBb0pKopRkaqQIKzI1dek6oxCx38,11208
376
+ irie/apps/templates/inventory/asset-table.html,sha256=hiPrumCigE_m1H6vSr8l-AoRosV8WnFuRg89cuzavvY,12129
376
377
  irie/apps/templates/inventory/bridge-dashboard.html,sha256=67zrDlih3LOi9xFVwPVZZkgRT3DO-lE_qRL7q8Uz9GY,45472
377
378
  irie/apps/templates/inventory/bridge.html,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
378
379
  irie/apps/templates/inventory/dashboard.html,sha256=yKEqsdSQpLIxv-E2sytN3yPNN9Li0q4488N3VVT9Jg8,7604
@@ -417,7 +418,7 @@ irie/core/settings.py,sha256=9jqn02olEya6O2p3pABLFhmHRwl_U05sOAtluo6y1Rg,6342
417
418
  irie/core/urls.py,sha256=H_oIilxAeV6C5W3TY_-oYwkbHiOnHdrRGweBDnOe04k,1279
418
419
  irie/core/wsgi.py,sha256=8dxK789vOoRWm0IatEhNqMgZhov9TlspjM6hOUbjg24,395
419
420
  irie/init/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
420
- irie/init/__main__.py,sha256=6-_8v1yigDWa6AE0c4xT5CBF--MVhQWnOmG-1ea8X6w,589
421
+ irie/init/__main__.py,sha256=EMfVc-Q-IPi1uBU3vOkoP4_-JMWpK1dFnqu3prfXsDM,589
421
422
  irie/init/bridges.py,sha256=vWDhpQ42Ws9SHUMPw5N8sEQ_7PXbdXRK1SUlSMQQCeI,74681
422
423
  irie/init/calid.py,sha256=Q6ie1irxm9EiGdxuR2OD05Hffg0UsTWIxQJha-kWkVs,1331
423
424
  irie/init/getCGSData.py,sha256=iZG3Ab1Y_rhiliKCPNy0MZrKBsfEe6ShgSFz2ttvTUU,2916
@@ -436,8 +437,8 @@ irie/init/management/commands/init_corridors.py,sha256=EzLk0HUiFxlco-2u0rypewOc9
436
437
  irie/init/management/commands/init_predictors.py,sha256=jdD7rd8l2qxuUuR5GOYuHXp-ZQkAK477TefksBMdlOw,2362
437
438
  irie/rest/__main__.py,sha256=6Nf_-Rr9zGmMyp_wqCFDO7ls9QPnPd9UyUgN17rIGYw,3680
438
439
  irie/usgs/__main__.py,sha256=HiSvPn5IW5IqRiCk1qRRq5dCy3-7iISw7v1P_w2rLrk,5049
439
- irie-0.0.19.dist-info/METADATA,sha256=_6PuRaS62LXJrFGi_g7nV50sNSZqQkHBY2J4DAkry5c,3244
440
- irie-0.0.19.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
441
- irie-0.0.19.dist-info/entry_points.txt,sha256=A_3h9wPBGfxGQ78_MGa-nO6Z0foxOYeAnIE47jxEztg,44
442
- irie-0.0.19.dist-info/top_level.txt,sha256=zVCxi5E2nkISZPzKq8VEhWe_dGuPcefLYV1tYqQdwlY,5
443
- irie-0.0.19.dist-info/RECORD,,
440
+ irie-0.0.20.dist-info/METADATA,sha256=5hxwSV5Sr0rE1jc33o6wBorklugHZZmr399OcdrS2DA,3244
441
+ irie-0.0.20.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
442
+ irie-0.0.20.dist-info/entry_points.txt,sha256=A_3h9wPBGfxGQ78_MGa-nO6Z0foxOYeAnIE47jxEztg,44
443
+ irie-0.0.20.dist-info/top_level.txt,sha256=zVCxi5E2nkISZPzKq8VEhWe_dGuPcefLYV1tYqQdwlY,5
444
+ irie-0.0.20.dist-info/RECORD,,
File without changes