irie 0.0.0__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 (145) hide show
  1. irie/__main__.py +24 -0
  2. irie/apps/__init__.py +5 -0
  3. irie/apps/authentication/__init__.py +1 -0
  4. irie/apps/authentication/admin.py +1 -0
  5. irie/apps/authentication/config.py +6 -0
  6. irie/apps/authentication/forms.py +41 -0
  7. irie/apps/authentication/migrations/__init__.py +1 -0
  8. irie/apps/authentication/models.py +1 -0
  9. irie/apps/authentication/tests.py +1 -0
  10. irie/apps/authentication/urls.py +9 -0
  11. irie/apps/authentication/views.py +53 -0
  12. irie/apps/config.py +8 -0
  13. irie/apps/context_processors.py +5 -0
  14. irie/apps/documents/__init__.py +0 -0
  15. irie/apps/documents/apps.py +7 -0
  16. irie/apps/documents/documents.py +61 -0
  17. irie/apps/documents/migrations/__init__.py +0 -0
  18. irie/apps/documents/tests.py +3 -0
  19. irie/apps/documents/urls.py +12 -0
  20. irie/apps/documents/views.py +27 -0
  21. irie/apps/evaluation/__init__.py +0 -0
  22. irie/apps/evaluation/admin.py +43 -0
  23. irie/apps/evaluation/apps.py +18 -0
  24. irie/apps/evaluation/daemon.py +107 -0
  25. irie/apps/evaluation/identification.py +196 -0
  26. irie/apps/evaluation/migrations/0001_initial.py +25 -0
  27. irie/apps/evaluation/migrations/0002_remove_evaluation_cesmd.py +17 -0
  28. irie/apps/evaluation/migrations/0003_evaluation_asset.py +20 -0
  29. irie/apps/evaluation/migrations/__init__.py +0 -0
  30. irie/apps/evaluation/models.py +72 -0
  31. irie/apps/evaluation/urls.py +16 -0
  32. irie/apps/evaluation/views.py +68 -0
  33. irie/apps/events/__init__.py +0 -0
  34. irie/apps/events/admin.py +9 -0
  35. irie/apps/events/apps.py +12 -0
  36. irie/apps/events/migrations/0001_initial.py +27 -0
  37. irie/apps/events/migrations/0002_alter_event_id.py +18 -0
  38. irie/apps/events/migrations/0003_event_cesmd.py +19 -0
  39. irie/apps/events/migrations/0004_event_record_identifier.py +19 -0
  40. irie/apps/events/migrations/0005_event_asset.py +21 -0
  41. irie/apps/events/migrations/0006_alter_event_event_file.py +18 -0
  42. irie/apps/events/migrations/__init__.py +0 -0
  43. irie/apps/events/models.py +70 -0
  44. irie/apps/events/tests.py +1 -0
  45. irie/apps/events/tests_events.py +240 -0
  46. irie/apps/events/urls.py +29 -0
  47. irie/apps/events/views.py +55 -0
  48. irie/apps/events/views_events.py +215 -0
  49. irie/apps/inventory/CESMD.py +81 -0
  50. irie/apps/inventory/__init__.py +5 -0
  51. irie/apps/inventory/admin.py +10 -0
  52. irie/apps/inventory/apps.py +12 -0
  53. irie/apps/inventory/archive/arcGIS.py +1175 -0
  54. irie/apps/inventory/calid.py +65 -0
  55. irie/apps/inventory/fields.py +5 -0
  56. irie/apps/inventory/forms.py +12 -0
  57. irie/apps/inventory/migrations/0001_initial.py +31 -0
  58. irie/apps/inventory/migrations/0002_assetevaluationmodel_cesmd.py +19 -0
  59. irie/apps/inventory/migrations/0003_auto_20230520_2030.py +23 -0
  60. irie/apps/inventory/migrations/0004_asset.py +27 -0
  61. irie/apps/inventory/migrations/0005_auto_20230731_1802.py +23 -0
  62. irie/apps/inventory/migrations/0006_auto_20230731_1816.py +28 -0
  63. irie/apps/inventory/migrations/0007_auto_20230731_1827.py +24 -0
  64. irie/apps/inventory/migrations/0008_asset_is_complete.py +19 -0
  65. irie/apps/inventory/migrations/0009_auto_20230731_1842.py +29 -0
  66. irie/apps/inventory/migrations/0010_auto_20230801_0025.py +23 -0
  67. irie/apps/inventory/migrations/0011_alter_asset_cgs_data.py +18 -0
  68. irie/apps/inventory/migrations/0012_corridor.py +22 -0
  69. irie/apps/inventory/migrations/0013_alter_asset_cesmd.py +18 -0
  70. irie/apps/inventory/migrations/0014_alter_asset_cesmd.py +18 -0
  71. irie/apps/inventory/migrations/__init__.py +0 -0
  72. irie/apps/inventory/models.py +70 -0
  73. irie/apps/inventory/tables.py +584 -0
  74. irie/apps/inventory/traffic.py +175052 -0
  75. irie/apps/inventory/urls.py +25 -0
  76. irie/apps/inventory/views.py +515 -0
  77. irie/apps/management/__init__.py +0 -0
  78. irie/apps/management/commands/__init__.py +0 -0
  79. irie/apps/networks/__init__.py +0 -0
  80. irie/apps/networks/apps.py +5 -0
  81. irie/apps/networks/forms.py +64 -0
  82. irie/apps/networks/migrations/0001_initial.py +26 -0
  83. irie/apps/networks/migrations/__init__.py +0 -0
  84. irie/apps/networks/models.py +14 -0
  85. irie/apps/networks/networks.py +782 -0
  86. irie/apps/networks/tests.py +1 -0
  87. irie/apps/networks/urls.py +18 -0
  88. irie/apps/networks/views.py +89 -0
  89. irie/apps/prediction/__init__.py +0 -0
  90. irie/apps/prediction/admin.py +9 -0
  91. irie/apps/prediction/apps.py +12 -0
  92. irie/apps/prediction/forms.py +20 -0
  93. irie/apps/prediction/metrics.py +61 -0
  94. irie/apps/prediction/migrations/0001_initial.py +32 -0
  95. irie/apps/prediction/migrations/0002_auto_20230731_1801.py +27 -0
  96. irie/apps/prediction/migrations/0003_rename_assetevaluationmodel_evaluation.py +18 -0
  97. irie/apps/prediction/migrations/0004_delete_evaluation.py +16 -0
  98. irie/apps/prediction/migrations/0005_predictormodel_protocol.py +18 -0
  99. irie/apps/prediction/migrations/0006_alter_predictormodel_protocol.py +18 -0
  100. irie/apps/prediction/migrations/0007_predictormodel_active.py +19 -0
  101. irie/apps/prediction/migrations/0008_predictormodel_description.py +18 -0
  102. irie/apps/prediction/migrations/0009_predictormodel_entry_point.py +19 -0
  103. irie/apps/prediction/migrations/0010_alter_predictormodel_entry_point.py +18 -0
  104. irie/apps/prediction/migrations/0011_remove_predictormodel_entry_point.py +17 -0
  105. irie/apps/prediction/migrations/0012_predictormodel_entry_point.py +18 -0
  106. irie/apps/prediction/migrations/0013_predictormodel_metrics.py +18 -0
  107. irie/apps/prediction/migrations/0014_auto_20240930_0004.py +28 -0
  108. irie/apps/prediction/migrations/0015_alter_predictormodel_render_file.py +18 -0
  109. irie/apps/prediction/migrations/__init__.py +0 -0
  110. irie/apps/prediction/models.py +37 -0
  111. irie/apps/prediction/predictor.py +286 -0
  112. irie/apps/prediction/runners/__init__.py +450 -0
  113. irie/apps/prediction/runners/metrics.py +168 -0
  114. irie/apps/prediction/runners/opensees/__init__.py +0 -0
  115. irie/apps/prediction/runners/opensees/schemas/__init__.py +39 -0
  116. irie/apps/prediction/runners/utilities.py +277 -0
  117. irie/apps/prediction/runners/xmlutils.py +232 -0
  118. irie/apps/prediction/runners/zipped.py +27 -0
  119. irie/apps/prediction/templatetags/__init__.py +0 -0
  120. irie/apps/prediction/templatetags/predictor.py +20 -0
  121. irie/apps/prediction/urls.py +19 -0
  122. irie/apps/prediction/views.py +184 -0
  123. irie/apps/prediction/views_api.py +216 -0
  124. irie/apps/site/__init__.py +0 -0
  125. irie/apps/site/admin.py +1 -0
  126. irie/apps/site/config.py +6 -0
  127. irie/apps/site/migrations/__init__.py +1 -0
  128. irie/apps/site/models.py +2 -0
  129. irie/apps/site/templatetags/__init__.py +0 -0
  130. irie/apps/site/templatetags/indexing.py +7 -0
  131. irie/apps/site/tests.py +1 -0
  132. irie/apps/site/urls.py +8 -0
  133. irie/apps/site/view_sdof.py +40 -0
  134. irie/apps/site/view_utils.py +13 -0
  135. irie/apps/site/views.py +88 -0
  136. irie/core/__init__.py +5 -0
  137. irie/core/asgi.py +12 -0
  138. irie/core/settings.py +223 -0
  139. irie/core/urls.py +39 -0
  140. irie/core/wsgi.py +12 -0
  141. irie-0.0.0.dist-info/METADATA +48 -0
  142. irie-0.0.0.dist-info/RECORD +145 -0
  143. irie-0.0.0.dist-info/WHEEL +5 -0
  144. irie-0.0.0.dist-info/entry_points.txt +2 -0
  145. irie-0.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,65 @@
1
+ # CESMD = {
2
+ # # "CE89324": {},
3
+ # # "CE58700": "CE58700", # CE58700
4
+ # "04-0236": "CE89324", # painter
5
+ # "04-0228 (01-Hum-225-1.2)": "CE89686", # eureka-samoa
6
+ # "10-0299 (01-MEN-101-160.03)": "CE79421", # CE79421
7
+ # "23-0015R (04-SOL-80-12.8)": "CE68184", # carquinez-east-northbound
8
+ # "28-0352L (04-SOL-80-0.01)": "CE68185", # carquinez-west-southbound
9
+ # "28-0153 (04-CC-68-25.04)": "CE68682", # CE68682
10
+ # "33-0214L": "CE58658", # hayward
11
+ # "34-0003 (04-SF-80-5.6)": "CE58632", # CE58632
12
+ # "34-0006 (04-SF-80-13.2)": "CE58600", # CE58600
13
+ # "34-0006 (04-SF-80-8.7)": "CE58601", # CE58601
14
+ # "04-0016R (01-HUM-101-53.9)": "CE89973", # CE89973
15
+ # "04-0170 (01-HUM-101-R92.99)": "CE89708", # CE89708
16
+ # "04-0229 (01-HUM-255-0.7)": "CE89735", # CE89735
17
+ # "04-0230 (01-HUM-255-0.2)": "CE89736", # CE89736
18
+ #
19
+ # "43-0031E (05-SBT-156-0.00)": "CE47315", # CE47315
20
+ # "47-0048": "CE54730", # crowley
21
+ # "50-0271 (06-KER-5-4.1)": "CE24775", # CE24775
22
+ # "50-0340 (09-KER-395-R25.08)": "CE33742", # ridgecrest
23
+ # "53-1471 (07-LA-47-0.86)": "CE14406", # CE14406
24
+ # "53-1794 (07-LA-14-R57.37)": "CE24706", # CE24706
25
+ # "53-2791 (07-LA-10-8.8)": "CE24704", # CE24704
26
+ # "53-2795F": "CE24694", # sylmar
27
+ # "54-0823G": "CE23631", # bernardino
28
+ # "55-0225 (07-ORA-5-6.62)": "CE13795", # capistrano
29
+ # "56-0586G (08-RIV-15-R41.57)": "CE13705", # CE13705
30
+ # "58-0215": "CE01336", # meloland
31
+ # }
32
+
33
+ CESMD = {
34
+ # "CE89324": {},
35
+ # "CE58700": "CE58700", # CE58700
36
+ "04-0236": "CE89324", # painter
37
+ "04-0228": "CE89686", # eureka-samoa
38
+ "10-0299": "CE79421", # CE79421
39
+ "23-0015R": "CE68184", # carquinez-east-northbound
40
+ "28-0352L": "CE68185", # carquinez-west-southbound
41
+ "28-0153": "CE68682", # CE68682
42
+ "33-0214L": "CE58658", # hayward
43
+ "34-0003": "CE58632", # CE58632
44
+ "34-0006": "CE58600", # CE58600
45
+ "34-0006": "CE58601", # CE58601
46
+ "04-0016R": "CE89973", # CE89973
47
+ "04-0170": "CE89708", # CE89708
48
+ "04-0229": "CE89735", # CE89735
49
+ "04-0230": "CE89736", # CE89736
50
+
51
+ "43-0031E": "CE47315", # CE47315
52
+ "47-0048": "CE54730", # crowley
53
+ "50-0271": "CE24775", # CE24775
54
+ "50-0340": "CE33742", # ridgecrest
55
+ "53-1471": "CE14406", # CE14406
56
+ "53-1794": "CE24706", # CE24706
57
+ "53-2791": "CE24704", # CE24704
58
+ "53-2795F": "CE24694", # sylmar
59
+ "54-0823G": "CE23631", # bernardino
60
+ "55-0225": "CE13795", # capistrano
61
+ "56-0586G": "CE13705", # CE13705
62
+ "58-0215": "CE01336", # meloland
63
+ }
64
+
65
+ CALID = {v: k for k, v in CESMD.items()}
@@ -0,0 +1,5 @@
1
+
2
+ from django.db import models
3
+
4
+ class BitFlagsField(models.IntegerField): pass
5
+
@@ -0,0 +1,12 @@
1
+ #===----------------------------------------------------------------------===#
2
+ #
3
+ # STAIRLab -- STructural Artificial Intelligence Laboratory
4
+ #
5
+ #===----------------------------------------------------------------------===#
6
+ from django import forms
7
+ from apps.inventory.models import Asset
8
+
9
+ class AssetForm(forms.ModelForm):
10
+ class Meta:
11
+ model = Asset
12
+ fields = '__all__'
@@ -0,0 +1,31 @@
1
+ # Generated by Django 3.2.13 on 2022-07-24 02:48
2
+
3
+ from django.db import migrations, models
4
+ import django.db.models.deletion
5
+
6
+
7
+ class Migration(migrations.Migration):
8
+
9
+ initial = True
10
+
11
+ dependencies = [
12
+ ('apps_events', '0002_alter_event_id'),
13
+ ]
14
+
15
+ operations = [
16
+ migrations.CreateModel(
17
+ name='AssetModel',
18
+ fields=[
19
+ ('id', models.BigAutoField(primary_key=True, serialize=False)),
20
+ ('cesmd', models.CharField(max_length=7)),
21
+ ],
22
+ ),
23
+ migrations.CreateModel(
24
+ name='AssetEvaluationModel',
25
+ fields=[
26
+ ('id', models.BigAutoField(primary_key=True, serialize=False)),
27
+ ('evaluation_data', models.JSONField(default=dict)),
28
+ ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps_events.event')),
29
+ ],
30
+ ),
31
+ ]
@@ -0,0 +1,19 @@
1
+ # Generated by Django 3.2.13 on 2022-07-24 03:06
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('apps_inventory', '0001_initial'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AddField(
14
+ model_name='assetevaluationmodel',
15
+ name='cesmd',
16
+ field=models.CharField(default='CE58658', max_length=7),
17
+ preserve_default=False,
18
+ ),
19
+ ]
@@ -0,0 +1,23 @@
1
+ # Generated by Django 3.2.13 on 2023-05-20 20:30
2
+
3
+ from django.db import migrations
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('apps_inventory', '0002_assetevaluationmodel_cesmd'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.RemoveField(
14
+ model_name='assetevaluationmodel',
15
+ name='event',
16
+ ),
17
+ migrations.DeleteModel(
18
+ name='AssetModel',
19
+ ),
20
+ migrations.DeleteModel(
21
+ name='AssetEvaluationModel',
22
+ ),
23
+ ]
@@ -0,0 +1,27 @@
1
+ # Generated by Django 3.2.13 on 2023-07-31 18:01
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ initial = True
9
+
10
+ dependencies = [
11
+ ('apps_inventory', '0003_auto_20230520_2030'),
12
+ ]
13
+
14
+ operations = [
15
+ migrations.CreateModel(
16
+ name='Asset',
17
+ fields=[
18
+ ('id', models.BigAutoField(primary_key=True, serialize=False)),
19
+ ('cesmd', models.CharField(max_length=7)),
20
+ ('calid', models.CharField(max_length=15)),
21
+ ('motion_data', models.JSONField(default=dict)),
22
+ ],
23
+ options={
24
+ 'ordering': ['-id'],
25
+ },
26
+ ),
27
+ ]
@@ -0,0 +1,23 @@
1
+ # Generated by Django 3.2.13 on 2023-07-31 18:02
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('apps_inventory', '0004_asset'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.RenameField(
14
+ model_name='asset',
15
+ old_name='motion_data',
16
+ new_name='cesmd_data',
17
+ ),
18
+ migrations.AddField(
19
+ model_name='asset',
20
+ name='fhwa_data',
21
+ field=models.JSONField(default=dict),
22
+ ),
23
+ ]
@@ -0,0 +1,28 @@
1
+ # Generated by Django 3.2.13 on 2023-07-31 18:16
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('apps_inventory', '0005_auto_20230731_1802'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AddField(
14
+ model_name='asset',
15
+ name='name',
16
+ field=models.CharField(blank=True, max_length=100),
17
+ ),
18
+ migrations.AlterField(
19
+ model_name='asset',
20
+ name='cesmd_data',
21
+ field=models.JSONField(blank=True, default=dict),
22
+ ),
23
+ migrations.AlterField(
24
+ model_name='asset',
25
+ name='fhwa_data',
26
+ field=models.JSONField(blank=True, default=dict),
27
+ ),
28
+ ]
@@ -0,0 +1,24 @@
1
+ # Generated by Django 3.2.13 on 2023-07-31 18:27
2
+
3
+ import django.core.validators
4
+ from django.db import migrations, models
5
+
6
+
7
+ class Migration(migrations.Migration):
8
+
9
+ dependencies = [
10
+ ('apps_inventory', '0006_auto_20230731_1816'),
11
+ ]
12
+
13
+ operations = [
14
+ migrations.AddField(
15
+ model_name='asset',
16
+ name='bridge_sensors',
17
+ field=models.CharField(blank=True, max_length=200, validators=[django.core.validators.int_list_validator]),
18
+ ),
19
+ migrations.AddField(
20
+ model_name='asset',
21
+ name='ground_sensors',
22
+ field=models.CharField(blank=True, max_length=200, validators=[django.core.validators.int_list_validator]),
23
+ ),
24
+ ]
@@ -0,0 +1,19 @@
1
+ # Generated by Django 3.2.13 on 2023-07-31 18:30
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('apps_inventory', '0007_auto_20230731_1827'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AddField(
14
+ model_name='asset',
15
+ name='is_complete',
16
+ field=models.BooleanField(default=False),
17
+ preserve_default=False,
18
+ ),
19
+ ]
@@ -0,0 +1,29 @@
1
+ # Generated by Django 3.2.13 on 2023-07-31 18:42
2
+
3
+ import django.core.validators
4
+ from django.db import migrations, models
5
+
6
+
7
+ class Migration(migrations.Migration):
8
+
9
+ dependencies = [
10
+ ('apps_inventory', '0008_asset_is_complete'),
11
+ ]
12
+
13
+ operations = [
14
+ migrations.AlterField(
15
+ model_name='asset',
16
+ name='bridge_sensors',
17
+ field=models.CharField(blank=True, help_text='Comma-separated list of bridge channel numbers', max_length=200, validators=[django.core.validators.int_list_validator]),
18
+ ),
19
+ migrations.AlterField(
20
+ model_name='asset',
21
+ name='ground_sensors',
22
+ field=models.CharField(blank=True, help_text='Comma-separated list of ground channel numbers', max_length=200, validators=[django.core.validators.int_list_validator]),
23
+ ),
24
+ migrations.AlterField(
25
+ model_name='asset',
26
+ name='is_complete',
27
+ field=models.BooleanField(help_text='Is the asset a complete digital twin'),
28
+ ),
29
+ ]
@@ -0,0 +1,23 @@
1
+ # Generated by Django 3.2.13 on 2023-08-01 00:25
2
+
3
+ from django.db import migrations
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('apps_inventory', '0009_auto_20230731_1842'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.RenameField(
14
+ model_name='asset',
15
+ old_name='cesmd_data',
16
+ new_name='cgs_data',
17
+ ),
18
+ migrations.RenameField(
19
+ model_name='asset',
20
+ old_name='fhwa_data',
21
+ new_name='nbi_data',
22
+ ),
23
+ ]
@@ -0,0 +1,18 @@
1
+ # Generated by Django 3.2.13 on 2023-08-01 02:34
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('apps_inventory', '0010_auto_20230801_0025'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AlterField(
14
+ model_name='asset',
15
+ name='cgs_data',
16
+ field=models.JSONField(blank=True, default=list),
17
+ ),
18
+ ]
@@ -0,0 +1,22 @@
1
+ # Generated by Django 5.1 on 2024-11-08 05:48
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('apps_inventory', '0011_alter_asset_cgs_data'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.CreateModel(
14
+ name='Corridor',
15
+ fields=[
16
+ ('id', models.BigAutoField(primary_key=True, serialize=False)),
17
+ ('name', models.CharField(max_length=20)),
18
+ ('route', models.CharField(blank=True, max_length=100)),
19
+ ('assets', models.ManyToManyField(related_name='corridors', to='apps_inventory.asset')),
20
+ ],
21
+ ),
22
+ ]
@@ -0,0 +1,18 @@
1
+ # Generated by Django 5.1 on 2024-11-08 07:18
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('apps_inventory', '0012_corridor'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AlterField(
14
+ model_name='asset',
15
+ name='cesmd',
16
+ field=models.CharField(blank=True, max_length=7),
17
+ ),
18
+ ]
@@ -0,0 +1,18 @@
1
+ # Generated by Django 5.1 on 2024-11-08 07:20
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('apps_inventory', '0013_alter_asset_cesmd'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AlterField(
14
+ model_name='asset',
15
+ name='cesmd',
16
+ field=models.CharField(blank=True, max_length=7, null=True),
17
+ ),
18
+ ]
File without changes
@@ -0,0 +1,70 @@
1
+ #===----------------------------------------------------------------------===#
2
+ #
3
+ # STAIRLab -- STructural Artificial Intelligence Laboratory
4
+ #
5
+ #===----------------------------------------------------------------------===#
6
+ #
7
+ # Summer 2023, BRACE2 Team
8
+ # Berkeley, CA
9
+ #
10
+ #----------------------------------------------------------------------------#
11
+ from django.db import models
12
+ from django.core.validators import int_list_validator
13
+
14
+ class Corridor(models.Model):
15
+ id = models.BigAutoField(primary_key=True)
16
+ name = models.CharField(max_length=20)
17
+ route = models.CharField(max_length=100, blank=True)
18
+ assets = models.ManyToManyField('Asset', related_name='corridors')
19
+
20
+ def __str__(self):
21
+ return f"{self.name} ({self.assets.count()})"
22
+
23
+ class Asset(models.Model):
24
+ id = models.BigAutoField(primary_key=True)
25
+ cesmd = models.CharField(max_length=7, blank=True, null=True)
26
+ calid = models.CharField(max_length=15)
27
+ name = models.CharField(max_length=100, blank=True)
28
+
29
+ is_complete = models.BooleanField(help_text="Is the asset a complete digital twin")
30
+
31
+ nbi_data = models.JSONField(default=dict, blank=True)
32
+ cgs_data = models.JSONField(default=list, blank=True)
33
+
34
+ # Ground motion sensors
35
+ ground_sensors = models.CharField(validators=[int_list_validator],
36
+ max_length=200, blank=True,
37
+ help_text="Comma-separated list of ground channel numbers")
38
+ bridge_sensors = models.CharField(validators=[int_list_validator],
39
+ max_length=200, blank=True,
40
+ help_text="Comma-separated list of bridge channel numbers")
41
+
42
+ def __str__(self):
43
+ return f"{self.calid} - {self.name}"
44
+
45
+ @property
46
+ def predictors(self): # ->Dict[str, Predictor]:
47
+ from apps.prediction.predictor import PREDICTOR_TYPES
48
+ from apps.prediction.models import PredictorModel
49
+ return {
50
+ p.name: PREDICTOR_TYPES[p.protocol](p)
51
+ for p in PredictorModel.objects.filter(asset=self)
52
+ }
53
+
54
+ @property
55
+ def coordinates(self):
56
+ if self.nbi_data:
57
+ for table in self.nbi_data.values():
58
+ if "Latitude" in table:
59
+ return map(float, map(table.get, ["Latitude", "Longitude"]))
60
+
61
+ if self.cgs_data:
62
+ lat, lon = map(self.cgs_data[0].get, ["Latitude", "Longitude"])
63
+ return (float(lat.replace("N", "")), -float(lon.replace("W", "")))
64
+
65
+
66
+ return (None, None)
67
+
68
+ class Meta:
69
+ ordering = ["-id"]
70
+