irie 0.0.0__tar.gz

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 (150) hide show
  1. irie-0.0.0/PKG-INFO +48 -0
  2. irie-0.0.0/README.md +14 -0
  3. irie-0.0.0/pyproject.toml +71 -0
  4. irie-0.0.0/setup.cfg +4 -0
  5. irie-0.0.0/src/irie/__main__.py +24 -0
  6. irie-0.0.0/src/irie/apps/__init__.py +5 -0
  7. irie-0.0.0/src/irie/apps/authentication/__init__.py +1 -0
  8. irie-0.0.0/src/irie/apps/authentication/admin.py +1 -0
  9. irie-0.0.0/src/irie/apps/authentication/config.py +6 -0
  10. irie-0.0.0/src/irie/apps/authentication/forms.py +41 -0
  11. irie-0.0.0/src/irie/apps/authentication/migrations/__init__.py +1 -0
  12. irie-0.0.0/src/irie/apps/authentication/models.py +1 -0
  13. irie-0.0.0/src/irie/apps/authentication/tests.py +1 -0
  14. irie-0.0.0/src/irie/apps/authentication/urls.py +9 -0
  15. irie-0.0.0/src/irie/apps/authentication/views.py +53 -0
  16. irie-0.0.0/src/irie/apps/config.py +8 -0
  17. irie-0.0.0/src/irie/apps/context_processors.py +5 -0
  18. irie-0.0.0/src/irie/apps/documents/__init__.py +0 -0
  19. irie-0.0.0/src/irie/apps/documents/apps.py +7 -0
  20. irie-0.0.0/src/irie/apps/documents/documents.py +61 -0
  21. irie-0.0.0/src/irie/apps/documents/migrations/__init__.py +0 -0
  22. irie-0.0.0/src/irie/apps/documents/tests.py +3 -0
  23. irie-0.0.0/src/irie/apps/documents/urls.py +12 -0
  24. irie-0.0.0/src/irie/apps/documents/views.py +27 -0
  25. irie-0.0.0/src/irie/apps/evaluation/__init__.py +0 -0
  26. irie-0.0.0/src/irie/apps/evaluation/admin.py +43 -0
  27. irie-0.0.0/src/irie/apps/evaluation/apps.py +18 -0
  28. irie-0.0.0/src/irie/apps/evaluation/daemon.py +107 -0
  29. irie-0.0.0/src/irie/apps/evaluation/identification.py +196 -0
  30. irie-0.0.0/src/irie/apps/evaluation/migrations/0001_initial.py +25 -0
  31. irie-0.0.0/src/irie/apps/evaluation/migrations/0002_remove_evaluation_cesmd.py +17 -0
  32. irie-0.0.0/src/irie/apps/evaluation/migrations/0003_evaluation_asset.py +20 -0
  33. irie-0.0.0/src/irie/apps/evaluation/migrations/__init__.py +0 -0
  34. irie-0.0.0/src/irie/apps/evaluation/models.py +72 -0
  35. irie-0.0.0/src/irie/apps/evaluation/urls.py +16 -0
  36. irie-0.0.0/src/irie/apps/evaluation/views.py +68 -0
  37. irie-0.0.0/src/irie/apps/events/__init__.py +0 -0
  38. irie-0.0.0/src/irie/apps/events/admin.py +9 -0
  39. irie-0.0.0/src/irie/apps/events/apps.py +12 -0
  40. irie-0.0.0/src/irie/apps/events/migrations/0001_initial.py +27 -0
  41. irie-0.0.0/src/irie/apps/events/migrations/0002_alter_event_id.py +18 -0
  42. irie-0.0.0/src/irie/apps/events/migrations/0003_event_cesmd.py +19 -0
  43. irie-0.0.0/src/irie/apps/events/migrations/0004_event_record_identifier.py +19 -0
  44. irie-0.0.0/src/irie/apps/events/migrations/0005_event_asset.py +21 -0
  45. irie-0.0.0/src/irie/apps/events/migrations/0006_alter_event_event_file.py +18 -0
  46. irie-0.0.0/src/irie/apps/events/migrations/__init__.py +0 -0
  47. irie-0.0.0/src/irie/apps/events/models.py +70 -0
  48. irie-0.0.0/src/irie/apps/events/tests.py +1 -0
  49. irie-0.0.0/src/irie/apps/events/tests_events.py +240 -0
  50. irie-0.0.0/src/irie/apps/events/urls.py +29 -0
  51. irie-0.0.0/src/irie/apps/events/views.py +55 -0
  52. irie-0.0.0/src/irie/apps/events/views_events.py +215 -0
  53. irie-0.0.0/src/irie/apps/inventory/CESMD.py +81 -0
  54. irie-0.0.0/src/irie/apps/inventory/__init__.py +5 -0
  55. irie-0.0.0/src/irie/apps/inventory/admin.py +10 -0
  56. irie-0.0.0/src/irie/apps/inventory/apps.py +12 -0
  57. irie-0.0.0/src/irie/apps/inventory/archive/arcGIS.py +1175 -0
  58. irie-0.0.0/src/irie/apps/inventory/calid.py +65 -0
  59. irie-0.0.0/src/irie/apps/inventory/fields.py +5 -0
  60. irie-0.0.0/src/irie/apps/inventory/forms.py +12 -0
  61. irie-0.0.0/src/irie/apps/inventory/migrations/0001_initial.py +31 -0
  62. irie-0.0.0/src/irie/apps/inventory/migrations/0002_assetevaluationmodel_cesmd.py +19 -0
  63. irie-0.0.0/src/irie/apps/inventory/migrations/0003_auto_20230520_2030.py +23 -0
  64. irie-0.0.0/src/irie/apps/inventory/migrations/0004_asset.py +27 -0
  65. irie-0.0.0/src/irie/apps/inventory/migrations/0005_auto_20230731_1802.py +23 -0
  66. irie-0.0.0/src/irie/apps/inventory/migrations/0006_auto_20230731_1816.py +28 -0
  67. irie-0.0.0/src/irie/apps/inventory/migrations/0007_auto_20230731_1827.py +24 -0
  68. irie-0.0.0/src/irie/apps/inventory/migrations/0008_asset_is_complete.py +19 -0
  69. irie-0.0.0/src/irie/apps/inventory/migrations/0009_auto_20230731_1842.py +29 -0
  70. irie-0.0.0/src/irie/apps/inventory/migrations/0010_auto_20230801_0025.py +23 -0
  71. irie-0.0.0/src/irie/apps/inventory/migrations/0011_alter_asset_cgs_data.py +18 -0
  72. irie-0.0.0/src/irie/apps/inventory/migrations/0012_corridor.py +22 -0
  73. irie-0.0.0/src/irie/apps/inventory/migrations/0013_alter_asset_cesmd.py +18 -0
  74. irie-0.0.0/src/irie/apps/inventory/migrations/0014_alter_asset_cesmd.py +18 -0
  75. irie-0.0.0/src/irie/apps/inventory/migrations/__init__.py +0 -0
  76. irie-0.0.0/src/irie/apps/inventory/models.py +70 -0
  77. irie-0.0.0/src/irie/apps/inventory/tables.py +584 -0
  78. irie-0.0.0/src/irie/apps/inventory/traffic.py +175052 -0
  79. irie-0.0.0/src/irie/apps/inventory/urls.py +25 -0
  80. irie-0.0.0/src/irie/apps/inventory/views.py +515 -0
  81. irie-0.0.0/src/irie/apps/management/__init__.py +0 -0
  82. irie-0.0.0/src/irie/apps/management/commands/__init__.py +0 -0
  83. irie-0.0.0/src/irie/apps/networks/__init__.py +0 -0
  84. irie-0.0.0/src/irie/apps/networks/apps.py +5 -0
  85. irie-0.0.0/src/irie/apps/networks/forms.py +64 -0
  86. irie-0.0.0/src/irie/apps/networks/migrations/0001_initial.py +26 -0
  87. irie-0.0.0/src/irie/apps/networks/migrations/__init__.py +0 -0
  88. irie-0.0.0/src/irie/apps/networks/models.py +14 -0
  89. irie-0.0.0/src/irie/apps/networks/networks.py +782 -0
  90. irie-0.0.0/src/irie/apps/networks/tests.py +1 -0
  91. irie-0.0.0/src/irie/apps/networks/urls.py +18 -0
  92. irie-0.0.0/src/irie/apps/networks/views.py +89 -0
  93. irie-0.0.0/src/irie/apps/prediction/__init__.py +0 -0
  94. irie-0.0.0/src/irie/apps/prediction/admin.py +9 -0
  95. irie-0.0.0/src/irie/apps/prediction/apps.py +12 -0
  96. irie-0.0.0/src/irie/apps/prediction/forms.py +20 -0
  97. irie-0.0.0/src/irie/apps/prediction/metrics.py +61 -0
  98. irie-0.0.0/src/irie/apps/prediction/migrations/0001_initial.py +32 -0
  99. irie-0.0.0/src/irie/apps/prediction/migrations/0002_auto_20230731_1801.py +27 -0
  100. irie-0.0.0/src/irie/apps/prediction/migrations/0003_rename_assetevaluationmodel_evaluation.py +18 -0
  101. irie-0.0.0/src/irie/apps/prediction/migrations/0004_delete_evaluation.py +16 -0
  102. irie-0.0.0/src/irie/apps/prediction/migrations/0005_predictormodel_protocol.py +18 -0
  103. irie-0.0.0/src/irie/apps/prediction/migrations/0006_alter_predictormodel_protocol.py +18 -0
  104. irie-0.0.0/src/irie/apps/prediction/migrations/0007_predictormodel_active.py +19 -0
  105. irie-0.0.0/src/irie/apps/prediction/migrations/0008_predictormodel_description.py +18 -0
  106. irie-0.0.0/src/irie/apps/prediction/migrations/0009_predictormodel_entry_point.py +19 -0
  107. irie-0.0.0/src/irie/apps/prediction/migrations/0010_alter_predictormodel_entry_point.py +18 -0
  108. irie-0.0.0/src/irie/apps/prediction/migrations/0011_remove_predictormodel_entry_point.py +17 -0
  109. irie-0.0.0/src/irie/apps/prediction/migrations/0012_predictormodel_entry_point.py +18 -0
  110. irie-0.0.0/src/irie/apps/prediction/migrations/0013_predictormodel_metrics.py +18 -0
  111. irie-0.0.0/src/irie/apps/prediction/migrations/0014_auto_20240930_0004.py +28 -0
  112. irie-0.0.0/src/irie/apps/prediction/migrations/0015_alter_predictormodel_render_file.py +18 -0
  113. irie-0.0.0/src/irie/apps/prediction/migrations/__init__.py +0 -0
  114. irie-0.0.0/src/irie/apps/prediction/models.py +37 -0
  115. irie-0.0.0/src/irie/apps/prediction/predictor.py +286 -0
  116. irie-0.0.0/src/irie/apps/prediction/runners/__init__.py +450 -0
  117. irie-0.0.0/src/irie/apps/prediction/runners/metrics.py +168 -0
  118. irie-0.0.0/src/irie/apps/prediction/runners/opensees/__init__.py +0 -0
  119. irie-0.0.0/src/irie/apps/prediction/runners/opensees/schemas/__init__.py +39 -0
  120. irie-0.0.0/src/irie/apps/prediction/runners/utilities.py +277 -0
  121. irie-0.0.0/src/irie/apps/prediction/runners/xmlutils.py +232 -0
  122. irie-0.0.0/src/irie/apps/prediction/runners/zipped.py +27 -0
  123. irie-0.0.0/src/irie/apps/prediction/templatetags/__init__.py +0 -0
  124. irie-0.0.0/src/irie/apps/prediction/templatetags/predictor.py +20 -0
  125. irie-0.0.0/src/irie/apps/prediction/urls.py +19 -0
  126. irie-0.0.0/src/irie/apps/prediction/views.py +184 -0
  127. irie-0.0.0/src/irie/apps/prediction/views_api.py +216 -0
  128. irie-0.0.0/src/irie/apps/site/__init__.py +0 -0
  129. irie-0.0.0/src/irie/apps/site/admin.py +1 -0
  130. irie-0.0.0/src/irie/apps/site/config.py +6 -0
  131. irie-0.0.0/src/irie/apps/site/migrations/__init__.py +1 -0
  132. irie-0.0.0/src/irie/apps/site/models.py +2 -0
  133. irie-0.0.0/src/irie/apps/site/templatetags/__init__.py +0 -0
  134. irie-0.0.0/src/irie/apps/site/templatetags/indexing.py +7 -0
  135. irie-0.0.0/src/irie/apps/site/tests.py +1 -0
  136. irie-0.0.0/src/irie/apps/site/urls.py +8 -0
  137. irie-0.0.0/src/irie/apps/site/view_sdof.py +40 -0
  138. irie-0.0.0/src/irie/apps/site/view_utils.py +13 -0
  139. irie-0.0.0/src/irie/apps/site/views.py +88 -0
  140. irie-0.0.0/src/irie/core/__init__.py +5 -0
  141. irie-0.0.0/src/irie/core/asgi.py +12 -0
  142. irie-0.0.0/src/irie/core/settings.py +223 -0
  143. irie-0.0.0/src/irie/core/urls.py +39 -0
  144. irie-0.0.0/src/irie/core/wsgi.py +12 -0
  145. irie-0.0.0/src/irie.egg-info/PKG-INFO +48 -0
  146. irie-0.0.0/src/irie.egg-info/SOURCES.txt +148 -0
  147. irie-0.0.0/src/irie.egg-info/dependency_links.txt +1 -0
  148. irie-0.0.0/src/irie.egg-info/entry_points.txt +2 -0
  149. irie-0.0.0/src/irie.egg-info/requires.txt +4 -0
  150. irie-0.0.0/src/irie.egg-info/top_level.txt +1 -0
irie-0.0.0/PKG-INFO ADDED
@@ -0,0 +1,48 @@
1
+ Metadata-Version: 2.1
2
+ Name: irie
3
+ Version: 0.0.0
4
+ Summary: Finite element visualization with GPU support
5
+ Author-email: wd <5018-006+wd@users.noreply.github.com>, ab <52-93467+ab@users.noreply.github.com>
6
+ Project-URL: Repository, https://github.com/STAIRLab/irie
7
+ Project-URL: Documentation, https://structures.live
8
+ Keywords: visualization,rendering,seismic,opensees,post-processing,finite-element-analysis,glTF
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: BSD License
13
+ Classifier: Programming Language :: C
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.7
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3 :: Only
23
+ Classifier: Topic :: Software Development
24
+ Classifier: Topic :: Scientific/Engineering
25
+ Classifier: Operating System :: Microsoft :: Windows
26
+ Classifier: Operating System :: POSIX
27
+ Classifier: Operating System :: Unix
28
+ Classifier: Operating System :: MacOS
29
+ Description-Content-Type: text/markdown
30
+ Requires-Dist: opensees
31
+ Requires-Dist: quakeio
32
+ Requires-Dist: bottle
33
+ Requires-Dist: openbim
34
+
35
+ <div align="center">
36
+ <h2>BRACE2</h2>
37
+ <h1>Health Monitoring Platform</h1>
38
+ <h4>Mk III</h4>
39
+ </div>
40
+
41
+ ### External Dependencies
42
+
43
+ - [`quakeio`](https://pypi.org/project/quakeio)
44
+ - [`opensees`](https://pypi.org/project/opensees)
45
+ - [`mdof`](https://pypi.org/project/mdof)
46
+ - [`sdof`](https://pypi.org/project/sdof)
47
+
48
+ For developer notes, see [`help/README.md`](help/README.md).
irie-0.0.0/README.md ADDED
@@ -0,0 +1,14 @@
1
+ <div align="center">
2
+ <h2>BRACE2</h2>
3
+ <h1>Health Monitoring Platform</h1>
4
+ <h4>Mk III</h4>
5
+ </div>
6
+
7
+ ### External Dependencies
8
+
9
+ - [`quakeio`](https://pypi.org/project/quakeio)
10
+ - [`opensees`](https://pypi.org/project/opensees)
11
+ - [`mdof`](https://pypi.org/project/mdof)
12
+ - [`sdof`](https://pypi.org/project/sdof)
13
+
14
+ For developer notes, see [`help/README.md`](help/README.md).
@@ -0,0 +1,71 @@
1
+ [project]
2
+ name = "irie"
3
+ version = "0.0.0"
4
+ authors = [
5
+ {name="wd", email="5018-006+wd@users.noreply.github.com"},
6
+ {name="ab", email="52-93467+ab@users.noreply.github.com"}
7
+ ]
8
+ description="Finite element visualization with GPU support"
9
+
10
+ license = {file = ".github/LICENSE.txt"}
11
+ readme = "README.md"
12
+
13
+ keywords = [
14
+ "visualization",
15
+ "rendering",
16
+ "seismic",
17
+ "opensees",
18
+ "post-processing",
19
+ "finite-element-analysis",
20
+ "glTF"
21
+ ]
22
+
23
+ dependencies = [
24
+ "opensees",
25
+ "quakeio",
26
+ "bottle",
27
+ "openbim"
28
+ ]
29
+
30
+ classifiers = [
31
+ 'Development Status :: 4 - Beta',
32
+ 'Intended Audience :: Science/Research',
33
+ 'Intended Audience :: Developers',
34
+ 'License :: OSI Approved :: BSD License',
35
+ 'Programming Language :: C',
36
+ 'Programming Language :: Python',
37
+ 'Programming Language :: Python :: 3',
38
+ 'Programming Language :: Python :: 3.7',
39
+ 'Programming Language :: Python :: 3.8',
40
+ 'Programming Language :: Python :: 3.9',
41
+ 'Programming Language :: Python :: 3.10',
42
+ 'Programming Language :: Python :: 3.11',
43
+ 'Programming Language :: Python :: 3.12',
44
+ 'Programming Language :: Python :: 3 :: Only',
45
+ 'Topic :: Software Development',
46
+ 'Topic :: Scientific/Engineering',
47
+ 'Operating System :: Microsoft :: Windows',
48
+ 'Operating System :: POSIX',
49
+ 'Operating System :: Unix',
50
+ 'Operating System :: MacOS',
51
+ ]
52
+
53
+
54
+ [project.urls]
55
+ Repository = "https://github.com/STAIRLab/irie"
56
+ Documentation = "https://structures.live"
57
+
58
+ [project.scripts]
59
+ irie = "irie.__main__:main"
60
+
61
+ [build-system]
62
+ requires = [
63
+ "setuptools >= 52.0.2",
64
+ ]
65
+
66
+ build-backend = "setuptools.build_meta"
67
+
68
+ [tool.setuptools.package-data]
69
+ irie = ["assets/*"]
70
+
71
+
irie-0.0.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env python
2
+ #===----------------------------------------------------------------------===#
3
+ #
4
+ # STAIRLab -- STructural Artificial Intelligence Laboratory
5
+ #
6
+ #===----------------------------------------------------------------------===#
7
+
8
+ import os
9
+ import sys
10
+
11
+ def main():
12
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
13
+ try:
14
+ from django.core.management import execute_from_command_line
15
+ except ImportError as exc:
16
+ raise ImportError(
17
+ "Couldn't import Django. Are you sure it's installed and "
18
+ "available on your PYTHONPATH environment variable? Did you "
19
+ "forget to activate a virtual environment?"
20
+ ) from exc
21
+ execute_from_command_line(sys.argv)
22
+
23
+ if __name__ == '__main__':
24
+ main()
@@ -0,0 +1,5 @@
1
+ #===----------------------------------------------------------------------===#
2
+ #
3
+ # STAIRLab -- STructural Artificial Intelligence Laboratory
4
+ #
5
+ #===----------------------------------------------------------------------===#
@@ -0,0 +1 @@
1
+ from django.contrib import admin
@@ -0,0 +1,6 @@
1
+ from django.apps import AppConfig
2
+
3
+
4
+ class AuthConfig(AppConfig):
5
+ name = "apps.auth"
6
+ label = "apps_auth"
@@ -0,0 +1,41 @@
1
+ from django import forms
2
+ from django.contrib.auth.forms import UserCreationForm
3
+ from django.contrib.auth.models import User
4
+
5
+
6
+ class LoginForm(forms.Form):
7
+ username = forms.CharField(
8
+ widget=forms.TextInput(
9
+ attrs={"placeholder": "Username", "class": "form-control"}
10
+ )
11
+ )
12
+ password = forms.CharField(
13
+ widget=forms.PasswordInput(
14
+ attrs={"placeholder": "Password", "class": "form-control"}
15
+ )
16
+ )
17
+
18
+
19
+ class SignUpForm(UserCreationForm):
20
+ username = forms.CharField(
21
+ widget=forms.TextInput(
22
+ attrs={"placeholder": "Username", "class": "form-control"}
23
+ )
24
+ )
25
+ email = forms.EmailField(
26
+ widget=forms.EmailInput(attrs={"placeholder": "Email", "class": "form-control"})
27
+ )
28
+ password1 = forms.CharField(
29
+ widget=forms.PasswordInput(
30
+ attrs={"placeholder": "Password", "class": "form-control"}
31
+ )
32
+ )
33
+ password2 = forms.CharField(
34
+ widget=forms.PasswordInput(
35
+ attrs={"placeholder": "Password check", "class": "form-control"}
36
+ )
37
+ )
38
+
39
+ class Meta:
40
+ model = User
41
+ fields = ("username", "email", "password1", "password2")
@@ -0,0 +1 @@
1
+ from django.db import models
@@ -0,0 +1 @@
1
+ from django.test import TestCase
@@ -0,0 +1,9 @@
1
+ from django.urls import path
2
+ from .views import login_view, register_user
3
+ from django.contrib.auth.views import LogoutView
4
+
5
+ urlpatterns = [
6
+ path("login/", login_view, name="login"),
7
+ path("register/", register_user, name="register"),
8
+ path("logout/", LogoutView.as_view(), name="logout"),
9
+ ]
@@ -0,0 +1,53 @@
1
+ from django.shortcuts import render, redirect
2
+ from django.contrib.auth import authenticate, login
3
+ from .forms import LoginForm, SignUpForm
4
+
5
+
6
+ def login_view(request):
7
+ form = LoginForm(request.POST or None)
8
+
9
+ msg = None
10
+
11
+ if request.method == "POST":
12
+ if form.is_valid():
13
+ username = form.cleaned_data.get("username")
14
+ password = form.cleaned_data.get("password")
15
+ user = authenticate(username=username, password=password)
16
+ if user is not None:
17
+ login(request, user)
18
+ return redirect("/")
19
+ else:
20
+ msg = "Invalid credentials"
21
+ else:
22
+ msg = "Error validating the form"
23
+
24
+ return render(request, "accounts/login.html", {"form": form, "msg": msg})
25
+
26
+
27
+ def register_user(request):
28
+ msg = None
29
+ success = False
30
+
31
+ if request.method == "POST":
32
+ form = SignUpForm(request.POST)
33
+ if form.is_valid():
34
+ form.save()
35
+ username = form.cleaned_data.get("username")
36
+ raw_password = form.cleaned_data.get("password1")
37
+ user = authenticate(username=username, password=raw_password)
38
+
39
+ msg = "User created successfully."
40
+ success = True
41
+
42
+ # return redirect("/login/")
43
+
44
+ else:
45
+ msg = "Form is not valid"
46
+ else:
47
+ form = SignUpForm()
48
+
49
+ return render(
50
+ request,
51
+ "accounts/register.html",
52
+ {"form": form, "msg": msg, "success": success},
53
+ )
@@ -0,0 +1,8 @@
1
+ from django.apps import AppConfig
2
+
3
+
4
+ class AppsConfig(AppConfig):
5
+ default_auto_field = "django.db.models.BigAutoField"
6
+ name = "apps"
7
+ label = "apps"
8
+
@@ -0,0 +1,5 @@
1
+ from django.conf import settings
2
+
3
+
4
+ def cfg_assets_root(request):
5
+ return {"ASSETS_ROOT": settings.ASSETS_ROOT}
File without changes
@@ -0,0 +1,7 @@
1
+ from django.apps import AppConfig
2
+
3
+
4
+ class DocumentsConfig(AppConfig):
5
+ default_auto_field = "django.db.models.BigAutoField"
6
+ name = 'apps.documents'
7
+ label = 'documents'
@@ -0,0 +1,61 @@
1
+ TECHNOLOGY, MODELING, RESEARCH = range(3)
2
+
3
+ DOCUMENTS = [
4
+ # {
5
+ # "path": "2023-05-30 2nd Annual Report/BRACE2_2023_Annual_Report_Revised_After_Caltrans_Review.pdf",
6
+ # "title": "2nd Annual Report",
7
+ # "date": "2023-09-07",
8
+ # "scope": [TECHNOLOGY, MODELING, RESEARCH],
9
+ # "draft": False,
10
+ # "flags": ["new"]
11
+ # },
12
+ # {
13
+ # "path": "2023-05-30 2nd Annual Report/BRACE2_2023_Annual_Report.pdf",
14
+ # "title": "2nd Annual Report",
15
+ # "date": "2023-05-30",
16
+ # "scope": [TECHNOLOGY, MODELING, RESEARCH],
17
+ # "draft": True
18
+ # },
19
+ # {
20
+ # "path": "2021-10-27 ANNUAL Progress Report/BRACE2-Annual-Report-10-27-2021.pdf",
21
+ # "title": "1st Annual Report",
22
+ # "scope": [TECHNOLOGY, MODELING, RESEARCH],
23
+ # "date": "2021-10-27"
24
+ # },
25
+ # {
26
+ # "path": "2022-01-18 Progress Report 4/Update_BRACE2_1_18_2022.pdf",
27
+ # "title": "Progress Report 4",
28
+ # "scope": [MODELING, RESEARCH],
29
+ # "date": "2022-01-18"
30
+ # },
31
+ # {
32
+ # "path": "2022-04-21 Progress Report 5/BRACE2_Progress_Report_V_Part_I-4-21-2022.pdf",
33
+ # "title": "Progress Report 5",
34
+ # "scope": [MODELING, RESEARCH],
35
+ # "date": "2022-04-21"
36
+ # },
37
+ # {
38
+ # "path": "2022-06-01 NCE/BRACE2_Project_Extension_Workplan-6-1-2022.pdf",
39
+ # "title": "NCE/Project Extension Workplan",
40
+ # "scope": [MODELING, RESEARCH],
41
+ # "date": "2022-06-01"
42
+ # },
43
+ # {
44
+ # "path": "2022-08-11 Progress Report 6/BRACE2_Progress_Report_VI.pdf",
45
+ # "title": "Progress Report 6",
46
+ # "scope": [MODELING, RESEARCH],
47
+ # "date": "2022-08-11"
48
+ # },
49
+ # {
50
+ # "path": "2022-12-06 Memo Platform Guide/BRACE2_Memo_Platform_Guide_Final.pdf",
51
+ # "title": "Memo - Platform Guide",
52
+ # "scope": [MODELING],
53
+ # "date": "2022-12-06"
54
+ # },
55
+ # {
56
+ # "path": "2023-01-30 Platform Comment Responses/BRACE2_Memo_Platform_Comments_2-Jan-30-2023.pdf",
57
+ # "title": "Memo - Platform Comment Responses",
58
+ # "date": "2023-01-30"
59
+ # }
60
+ ]
61
+
@@ -0,0 +1,3 @@
1
+ from django.test import TestCase
2
+
3
+ # Create your tests here.
@@ -0,0 +1,12 @@
1
+ from django.urls import path
2
+ from django.conf.urls.static import static
3
+ from core import settings
4
+ from django.contrib.staticfiles.urls import staticfiles_urlpatterns
5
+
6
+ from . import views
7
+
8
+ urlpatterns = [
9
+ path("documents/", views.document_list, name="documents"),
10
+ path("documents.html", views.document_list),
11
+ ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
12
+
@@ -0,0 +1,27 @@
1
+ from django.shortcuts import render
2
+
3
+ from django import template
4
+ from django.contrib.auth.decorators import login_required
5
+ from django.http import HttpResponse, HttpResponseRedirect
6
+ from django.template import loader
7
+
8
+ from .documents import DOCUMENTS
9
+
10
+ @login_required(login_url="/login/")
11
+ def document_list(request):
12
+
13
+ context = {}
14
+ load_template = "documents.html"
15
+ context["documents"] = sorted(DOCUMENTS, key=lambda i: i["date"], reverse=True)
16
+ context["segment"] = load_template
17
+
18
+ try:
19
+ html_template = loader.get_template("documents/" + load_template)
20
+ return HttpResponse(html_template.render(context, request))
21
+
22
+ except Exception as e:
23
+ if "DEBUG" in os.environ and os.environ["DEBUG"]:
24
+ raise e
25
+ html_template = loader.get_template("home/page-500.html")
26
+ return HttpResponse(html_template.render(context, request))
27
+
File without changes
@@ -0,0 +1,43 @@
1
+ #===----------------------------------------------------------------------===#
2
+ #
3
+ # STAIRLab -- STructural Artificial Intelligence Laboratory
4
+ #
5
+ #===----------------------------------------------------------------------===#
6
+ #
7
+ # Summer 2023, BRACE2 Team
8
+ # Berkeley, CA
9
+ #
10
+ #----------------------------------------------------------------------------#
11
+ import json
12
+ import logging
13
+
14
+ from django.db.models import JSONField
15
+ from django.contrib import admin
16
+ from django.forms import widgets
17
+
18
+ from .models import Evaluation
19
+
20
+ logger = logging.getLogger(__name__)
21
+
22
+
23
+ class PrettyJSONWidget(widgets.Textarea):
24
+
25
+ def format_value(self, value):
26
+ try:
27
+ value = json.dumps(json.loads(value), indent=2, sort_keys=True)
28
+ # these lines will try to adjust size of TextArea to fit to content
29
+ row_lengths = [len(r) for r in value.split('\n')]
30
+ self.attrs['rows'] = min(max(len(row_lengths) + 2, 10), 30)
31
+ self.attrs['cols'] = min(max(max(row_lengths) + 2, 40), 120)
32
+ return value
33
+ except Exception as e:
34
+ logger.warning("Error while formatting JSON: {}".format(e))
35
+ return super(PrettyJSONWidget, self).format_value(value)
36
+
37
+
38
+ class JsonAdmin(admin.ModelAdmin):
39
+ formfield_overrides = {
40
+ JSONField: {'widget': PrettyJSONWidget}
41
+ }
42
+
43
+ admin.site.register(Evaluation, JsonAdmin)
@@ -0,0 +1,18 @@
1
+ #===----------------------------------------------------------------------===#
2
+ #
3
+ # STAIRLab -- STructural Artificial Intelligence Laboratory
4
+ #
5
+ #===----------------------------------------------------------------------===#
6
+ #
7
+ # Summer 2023, BRACE2 Team
8
+ # Berkeley, CA
9
+ #
10
+ #----------------------------------------------------------------------------#
11
+ from django.apps import AppConfig
12
+
13
+
14
+ class PredictionConfig(AppConfig):
15
+ default_auto_field = 'django.db.models.BigAutoField'
16
+ name = 'apps.evaluation'
17
+ label = 'apps_evaluation'
18
+
@@ -0,0 +1,107 @@
1
+ #===----------------------------------------------------------------------===#
2
+ #
3
+ # STAIRLab -- STructural Artificial Intelligence Laboratory
4
+ #
5
+ #===----------------------------------------------------------------------===#
6
+ #
7
+ # Summer 2023, BRACE2 Team
8
+ # Berkeley, CA
9
+ #
10
+ #----------------------------------------------------------------------------#
11
+ import sys
12
+ import multiprocessing.dummy
13
+ from collections import defaultdict
14
+ from typing import List, Iterator, Tuple, Dict, Collection
15
+
16
+ from apps.prediction.predictor import RunID
17
+ from apps.prediction.metrics import HealthMetric, METRIC_CLASSES
18
+
19
+ class LiveEvaluation:
20
+ # TODO: Merge into models.Evaluation?
21
+ def __init__(self, event, predictors, evaluation):
22
+ self.predictors = predictors
23
+
24
+ self.metrics: Dict[str, Dict[str, HealthMetric]] = defaultdict(dict)
25
+ self.active_metrics: List[str] = list(METRIC_CLASSES.keys())
26
+
27
+ self._evaluation = evaluation
28
+
29
+ self.evaluation_data = defaultdict(lambda: {
30
+ "predictors": [],
31
+ "summary": {},
32
+ "details": {}
33
+ })
34
+
35
+ def update(self):
36
+ self._evaluation.evaluation_data = dict(self.evaluation_data)
37
+ self.save(["evaluation_data"])
38
+
39
+ def save(self, fields=None):
40
+ if fields is None:
41
+ self._evaluation.save()
42
+ else:
43
+ self._evaluation.save(update_fields=fields)
44
+
45
+ def runPredictor(self, args: Tuple[str, Tuple[RunID, List[HealthMetric]]]):
46
+ predictor_name, (run_id, metrics) = args
47
+ self.predictors[predictor_name].runPrediction(run_id)
48
+ return predictor_name, run_id
49
+
50
+ # met_tag, predictor_name
51
+ def addMetric(self, mname: str, pid: str, confidence_score:int=0)->HealthMetric:
52
+ """
53
+ mname: metric id
54
+ pid: predictor id
55
+ """
56
+ #self.metrics[metric.metric_tag][metric.predictor] = metric
57
+ self.evaluation_data[mname]["predictors"].append(pid)
58
+ self.update()
59
+ return mname
60
+
61
+ def setMetricData(self, mname: str, pid: str, data: dict):
62
+ # self.metrics[mname][pid].data = data
63
+ # try:
64
+ # self.evaluation_data[mname]["details"][pid] = data["details"]
65
+ # except KeyError:
66
+ # self.evaluation_data[mname]["details"][pid] = data
67
+ # self.metrics[mname][pid].buildDetails()
68
+ # try:
69
+ # None
70
+ # except KeyError:
71
+ # self.evaluation_data[mname]["summary"][pid] = \
72
+ # self.metrics[mname][pid].getSummary()
73
+
74
+ self.evaluation_data[mname]["details"][pid] = data.get("details", data)
75
+ self.evaluation_data[mname]["summary"][pid] = data.get("summary", data)
76
+ if len(self.evaluation_data[mname]["summary"]) == 1:
77
+ self.evaluation_data[mname]["summary"][pid]["is_primary"] = True
78
+
79
+ self.update()
80
+
81
+ def assignMetricPredictors(self, event)->Dict[str, Tuple[RunID,List[HealthMetric]]]:
82
+ queued_predictions : Dict[str, Tuple[RunID,List[HealthMetric]]] = {}
83
+
84
+ for mname in self.active_metrics:
85
+ for predictor, score in self.scorePredictors(mname, self.predictors.values(), event):
86
+ print(predictor, score)
87
+
88
+
89
+ if predictor.name not in queued_predictions and predictor.active:
90
+ rid = predictor.newPrediction(event)
91
+ queued_predictions[predictor.name] = (rid, [])
92
+
93
+ predictor.activateMetric(mname, queued_predictions[predictor.name][0])
94
+ queued_predictions[predictor.name][1].append(
95
+ #self.addMetric(METRIC_CLASSES[metric](predictor.name), score)
96
+ self.addMetric(mname, predictor.name, score)
97
+ )
98
+
99
+ return queued_predictions
100
+
101
+
102
+ def scorePredictors(self, metric, predictors: Collection["Predictor"], event)->Iterator[Tuple["Predictor", int]]:
103
+ for predictor in predictors:
104
+ if predictor.active and metric in predictor.getMetricList():
105
+ print(">>> ", predictor.name, metric, file=sys.stderr)
106
+ yield (predictor, 0)
107
+