irie 0.0.42__py3-none-any.whl → 0.0.44__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 (51) hide show
  1. irie/apps/inventory/archive/CESMD.py +0 -0
  2. irie/apps/inventory/filters.py +7 -6
  3. irie/apps/inventory/models.py +27 -0
  4. irie/apps/inventory/services/render.py +0 -0
  5. irie/apps/inventory/urls.py +4 -1
  6. irie/apps/inventory/views.py +56 -0
  7. irie/apps/prediction/forms.py +2 -1
  8. irie/apps/prediction/models.py +24 -0
  9. irie/apps/prediction/urls.py +5 -3
  10. irie/apps/prediction/views.py +101 -8
  11. irie/apps/static/assets/css/brace.css +0 -32
  12. irie/apps/static/assets/css/brace.css.map +1 -1
  13. irie/apps/static/assets/css/brace.min.css +1 -1
  14. irie/apps/templates/inventory/asset-on-map.html +457 -0
  15. irie/apps/templates/inventory/asset-profile.html +1 -2
  16. irie/apps/templates/inventory/asset-table.html +14 -0
  17. irie/apps/templates/inventory/map-inventory.html +136 -0
  18. irie/apps/templates/inventory/map-inventory2.html +143 -0
  19. irie/apps/templates/inventory/map-single-asset.html +0 -0
  20. irie/apps/templates/inventory/map-single-asset2.html +618 -0
  21. irie/apps/templates/inventory/map-terrain.html +214 -0
  22. irie/apps/templates/inventory/sensor-upload.html +1 -0
  23. irie/apps/templates/inventory/three-maps.html +229 -0
  24. irie/apps/templates/layouts/base.html +1 -0
  25. irie/apps/templates/prediction/predictor-upload.html +68 -22
  26. irie/apps/templates/site/index.html +36 -27
  27. irie/apps/templates/site/page-400-sidebar.html +31 -0
  28. irie/apps/templates/site/page-400.html +29 -0
  29. irie/apps/templates/site/page-404-sidebar.html +1 -1
  30. irie/apps/templates/site/page-404.html +1 -1
  31. irie/fhwa/__init__.py +132 -0
  32. irie/fhwa/__main__.py +79 -0
  33. irie/fhwa/fields/nbi001.py +61 -0
  34. irie/fhwa/fields/nbi001b.py +1 -0
  35. irie/fhwa/fields/nbi002.py +0 -0
  36. irie/fhwa/fields.py +32 -0
  37. irie/init/__main__.py +0 -4
  38. irie/init/calid.py +86 -3
  39. irie/init/getNBIData.py +1 -1
  40. irie/init/management/commands/init_assets.py +11 -11
  41. irie/init/management/commands/init_predictors.py +1 -1
  42. irie/init/management/commands/make_asset.py +0 -0
  43. {irie-0.0.42.dist-info → irie-0.0.44.dist-info}/METADATA +2 -2
  44. {irie-0.0.42.dist-info → irie-0.0.44.dist-info}/RECORD +48 -33
  45. {irie-0.0.42.dist-info → irie-0.0.44.dist-info}/WHEEL +1 -1
  46. irie/apps/inventory/CESMD.py +0 -81
  47. irie/apps/inventory/archive/arcGIS.py +0 -1175
  48. irie/apps/inventory/traffic.py +0 -175052
  49. /irie/apps/inventory/{calid.py → archive/calid.py} +0 -0
  50. {irie-0.0.42.dist-info → irie-0.0.44.dist-info}/entry_points.txt +0 -0
  51. {irie-0.0.42.dist-info → irie-0.0.44.dist-info}/top_level.txt +0 -0
@@ -18,7 +18,7 @@
18
18
  <meta property="twitter:card" content="summary_large_image">
19
19
  <meta property="twitter:url" content="{% url 'home' %}">
20
20
  <meta property="twitter:title" content="BRACE2 Platform">
21
- <meta property="twitter:description" content="The BRACE2 platform is a framework for structural health monitoring.">
21
+ <meta property="twitter:description" content="Bridge rapid assessment center for extreme events (BRACE2) platform for real-time structural health monitoring.">
22
22
 
23
23
  {# Favicon #}
24
24
  <link rel="apple-touch-icon" sizes="120x120" href="{{ ASSETS_ROOT }}/img/favicon/apple-touch-icon.png">
@@ -161,18 +161,17 @@ td.left-text{vertical-align:middle}
161
161
  </header>
162
162
 
163
163
  <main>
164
- <section class="section-header overflow-hidden pt-7 pt-lg-8 pb-9 pb-lg-12 bg-light">
164
+ <section class="section-header overflow-hidden pt-7 pt-lg-8 bg-white">
165
165
  <div class="container">
166
166
  <div class="row">
167
167
  <div class="col-12 text-center">
168
168
  <h1 class="fw-light">BRACE<sup class="superscript">2</sup></h1>
169
169
  <h2 class="lead fw-normal text-muted mb-5">
170
- Structural Health Monitoring
170
+ Bridge rapid assessment center for extreme events
171
171
  </h2>
172
172
  {# Button Modal #}
173
- <div class="d-flex align-items-center justify-content-center mb-5">
173
+ <div class="d-flex align-items-center justify-content-center mb-5 position-relative z-5">
174
174
  <a href="{% url 'asset_table' %}" class="btn btn-primary d-inline-flex align-items-center me-4">
175
- <svg class="icon icon-xs me-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M3 3a1 1 0 000 2v8a2 2 0 002 2h2.586l-1.293 1.293a1 1 0 101.414 1.414L10 15.414l2.293 2.293a1 1 0 001.414-1.414L12.414 15H15a2 2 0 002-2V5a1 1 0 100-2H3zm11 4a1 1 0 10-2 0v4a1 1 0 102 0V7zm-3 1a1 1 0 10-2 0v3a1 1 0 102 0V8zM8 9a1 1 0 00-2 0v2a1 1 0 102 0V9z" clip-rule="evenodd"></path></svg>
176
175
  Inventory
177
176
  </a>
178
177
  </div>
@@ -186,29 +185,42 @@ td.left-text{vertical-align:middle}
186
185
  </div>
187
186
  </div>
188
187
  </div>
189
- <div class="section pt-n10">
190
- <div class="container mt-n10 mt-lg-n12 z-2">
191
- <div class="row justify-content-center">
192
- <div class="col-12">
188
+ <div class="section pt-n12">
189
+ <div class="container mt-n6 mt-lg-n8">
190
+ <div class="row justify-content-center position-relative z-1">
191
+ <div class="col-10">
193
192
  <img src="{{ ASSETS_ROOT }}/img/predictors.png"
194
193
  alt="Predictors"
195
- {# style="width: 70vw;" #}
194
+ {# style="width: 60vw;" #}
196
195
  >
197
196
  </div>
198
197
  </div>
199
198
  </div>
200
199
  </div>
200
+ </div>
201
+ <figure class="position-absolute bottom-0 left-0 w-100 d-none d-md-block mb-n1">
202
+ <svg class="home-pattern" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 3000 185.4"><path d="M3000,0v185.4H0V0c496.4,115.6,996.4,173.4,1500,173.4S2503.6,115.6,3000,0z"></path></svg></figure>
203
+ </section>
204
+
205
+ <section>
206
+ <div class="container col-10">
207
+ <div class="text-center mb-5 pt-8">
208
+ <p>
209
+ <em>BRACE<sup class="superscript">2</sup></em> is a research project that aims to provide a platform for real-time structural health monitoring.
210
+ </p>
211
+ </div>
212
+
201
213
  <div class="row justify-content-between align-items-center mb-5 mb-lg-7">
202
214
  <div class="row justify-content-between align-items-center">
203
215
  <div class="col-lg-5 order-lg-2 mb-5 mb-lg-0">
204
- <h2 class="h1">Health Diagnosis</h2>
205
- <p>Heath metrics are generated in the wake of natural hazard events using leading-edge data-driven methods.</p>
216
+ <h3 class="">Health Diagnosis</h3>
217
+ <p>Heath metrics are generated in the wake of natural hazard events using leading-edge physics simulations and data-driven methods.</p>
206
218
  </div>
207
219
  <div class="col-lg-6 order-lg-1"><img src="{{ ASSETS_ROOT }}/img/metric.png"
208
220
  alt="Front pages overview"></div>
209
221
  </div>
210
222
  <div class="col-lg-5 mb-5 mb-lg-0">
211
- <h2 class="h1 d-flex align-items-center">Real-time notification</h2>
223
+ <h3 class="d-flex align-items-center">Real-time notification</h3>
212
224
  <p class="mb-4">PEER is partnering with the <em>California Strong Motion Intrumentation Program</em>
213
225
  to push sensor data to stakeholders in real-time.</p>
214
226
  </div>
@@ -217,17 +229,17 @@ td.left-text{vertical-align:middle}
217
229
  <div class="row justify-content-between align-items-center mb-4 mb-lg-7">
218
230
  <div class="row justify-content-between align-items-center">
219
231
  <div class="col-lg-5 order-lg-2 mb-5 mb-lg-0">
220
- <h2 class="h1">Digital Twins</h2>
232
+ <h3 class="">Digital Twins</h3>
221
233
  <p class="mb-4">The <em>IRiE</em> engine is used to realize high-fidelity digital twins that are backed by
222
- state-of-the-art analysis platforms like <a href="https://pypi.org/project/sees">OpenSees</a> for nonlinear finite element analysis and <em><a href="https://chrystalchern.github.io/mdof">mdof</a></em> for system identification.</p>
234
+ state-of-the-art analysis platforms like <a href="https://pypi.org/project/opensees">OpenSees</a> for nonlinear finite element analysis and <em><a href="https://chrystalchern.github.io/mdof">mdof</a></em> for system identification.</p>
223
235
  </div>
224
236
  <div class="col-lg-4 order-lg-1 card shadow"><img src="{{ ASSETS_ROOT }}/img/twin.png"
225
237
  alt="Digital twins"></div>
226
238
  </div>
227
239
  {% comment %}
228
240
  <div class="col-lg-5 order-lg-2 mb-5 mb-lg-0">
229
- <h2 class="h1 d-flex align-items-center"> Corridors<span
230
- class="badge-md mb-0 fs-6 badge ms-3 rounded-pill text-dark bg-secondary">New</span></h2>
241
+ <h3 class="d-flex align-items-center"> Corridors<span
242
+ class="badge-md mb-0 fs-6 badge ms-3 rounded-pill text-dark bg-secondary">New</span></h3>
231
243
  <p class="mb-4">Corridor-level health analysis and recovery planning has been implemented through collaborations at UC Berkeley and
232
244
  the <a href="https://dot.ca.gov/">California department of transportation</a> (Caltrans).</p>
233
245
  <a href="https://dot.ca.gov/-/media/dot-media/programs/research-innovation-system-information/documents/research-notes/task3798-rns-05-24-a11y.pdf"
@@ -242,23 +254,21 @@ td.left-text{vertical-align:middle}
242
254
  alt="Corridors"></div>
243
255
  {% endcomment %}
244
256
  </div>
245
-
246
257
  </div>
247
- <figure class="position-absolute bottom-0 left-0 w-100 d-none d-md-block mb-n2">
248
- <svg class="home-pattern" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 3000 185.4"><path d="M3000,0v185.4H0V0c496.4,115.6,996.4,173.4,1500,173.4S2503.6,115.6,3000,0z"></path></svg></figure>
249
258
  </section>
250
- <section class=tabs-section>
259
+
260
+ <section class="tabs-section">
251
261
  <div class="container align-items-center">
252
- <h2 class=tabs-title>Ecosystem</h2>
262
+ <h2 class="tabs-title">Ecosystem</h2>
253
263
  <div class=uikit-tab-wrapper>
254
264
  <p>The <em>IRiE</em> Ecosystem</p>
255
265
  <table>
256
266
  <tr>
257
267
  <td style=text-align:center>
258
- <a href="https://opensees.stairlab.io">
268
+ <a href="https://xara.so">
259
269
  <img class="first-column-layout"
260
270
  src="{{ ASSETS_ROOT }}/content_images/brace/opensees.jpg" alt="opensees"></a></td>
261
- <td class=full-center-text><a href="https://pypi.org/project/sees" >sees</a></td>
271
+ <td class=full-center-text><a href="https://pypi.org/project/xara" >xara</a></td>
262
272
  <td class=left-text>Direct and idiomatic bindings to <a href="https://github.com/claudioperez/OpenSeesRT" >
263
273
  <samp>OpenSeesRT</samp></a> kernel for finite element analysis.</td>
264
274
  </tr>
@@ -274,7 +284,7 @@ td.left-text{vertical-align:middle}
274
284
  {% endif %}
275
285
  <tr>
276
286
  <td style="text-align:center">
277
- <a href="https://chrystalchern.github.io/mdof">
287
+ <a href="https://mdof.chrystalchern.com">
278
288
  <img class="first-column-layout"
279
289
  src="{{ ASSETS_ROOT }}/content_images/brace/mdof.svg" alt="mdof">
280
290
  </a>
@@ -300,7 +310,6 @@ td.left-text{vertical-align:middle}
300
310
  </div>
301
311
  </div>
302
312
 
303
-
304
313
  <section class=tabs-section>
305
314
  <div class="container align-items-center">
306
315
  <hr>
@@ -335,7 +344,7 @@ td.left-text{vertical-align:middle}
335
344
  <div class="col mb-md-0">
336
345
  <div class="d-flex text-center justify-content-center align-items-center" role="contentinfo">
337
346
  <p class="fw-normal font-small mb-0">
338
- &copy; BRACE<sup class="superscript">2</sup> 2024 - Powered by <a target="_blank"
347
+ &copy; BRACE<sup class="superscript">2</sup> 2025 - Powered by <a target="_blank"
339
348
  href="https://pypi.org/project/irie">IRiE</a>.</p>
340
349
  </div>
341
350
  </div>
@@ -0,0 +1,31 @@
1
+ {% extends "layouts/base.html" %}
2
+
3
+ {% block title %} Error 400 {% endblock %}
4
+
5
+ {% block stylesheets %}{% endblock stylesheets %}
6
+
7
+ {% block content %}
8
+
9
+ <main>
10
+ <section class="vh-100 d-flex justify-content-center">
11
+ <div class="container">
12
+ <div class="row">
13
+ <div class="col-12 text-center d-flex align-items-center justify-content-center">
14
+ <div>
15
+ <img class="img-fluid w-75" src="{{ ASSETS_ROOT }}/img/illustrations/404.svg" alt="404 not found">
16
+ <h1 class="mt-5">Page not <span class="fw-bolder text-primary">found</span></h1>
17
+ <p class="lead my-4">It looks like you followed a bad link. If you think this is a problem with us, please tell us.</p>
18
+ <a href="/dashboard.html" class="btn btn-gray-800 d-inline-flex align-items-center justify-content-center mb-4">
19
+ <svg class="icon icon-xs me-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M7.707 14.707a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l2.293 2.293a1 1 0 010 1.414z" clip-rule="evenodd"></path></svg>
20
+ Back to dashboard
21
+ </a>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </section>
27
+ </main>
28
+
29
+ {% endblock content %}
30
+
31
+ {% block javascripts %}{% endblock javascripts %}
@@ -0,0 +1,29 @@
1
+ {% extends "layouts/base-fullscreen.html" %}
2
+
3
+ {% block title %} Error 400 {% endblock %}
4
+
5
+ {% block stylesheets %}{% endblock stylesheets %}
6
+
7
+ {% block content %}
8
+
9
+ <main>
10
+ <section class="vh-100 d-flex align-items-center justify-content-center">
11
+ <div class="container">
12
+ <div class="row">
13
+ <div class="col-12 text-center d-flex align-items-center justify-content-center">
14
+ <div>
15
+ <img class="img-fluid w-75" src="{{ ASSETS_ROOT }}/img/illustrations/404.svg" alt="404 not found">
16
+ <h1 class="mt-5">Bad <span class="fw-bolder text-primary">request</span></h1>
17
+ {% if message %}
18
+ <p class="lead my-4">{{ message }}</p>
19
+ {% endif %}
20
+ </div>
21
+ </div>
22
+ </div>
23
+ </div>
24
+ </section>
25
+ </main>
26
+
27
+ {% endblock content %}
28
+
29
+ {% block javascripts %}{% endblock javascripts %}
@@ -14,7 +14,7 @@
14
14
  <div>
15
15
  <img class="img-fluid w-75" src="{{ ASSETS_ROOT }}/img/illustrations/404.svg" alt="404 not found">
16
16
  <h1 class="mt-5">Page not <span class="fw-bolder text-primary">found</span></h1>
17
- <p class="lead my-4">Oops! Looks like you followed a bad link. If you think this is a problem with us, please tell us.</p>
17
+ <p class="lead my-4">It looks like you followed a bad link. If you think this is a problem with us, please tell us.</p>
18
18
  <a href="/dashboard.html" class="btn btn-gray-800 d-inline-flex align-items-center justify-content-center mb-4">
19
19
  <svg class="icon icon-xs me-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M7.707 14.707a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l2.293 2.293a1 1 0 010 1.414z" clip-rule="evenodd"></path></svg>
20
20
  Back to dashboard
@@ -14,7 +14,7 @@
14
14
  <div>
15
15
  <img class="img-fluid w-75" src="{{ ASSETS_ROOT }}/img/illustrations/404.svg" alt="404 not found">
16
16
  <h1 class="mt-5">Page not <span class="fw-bolder text-primary">found</span></h1>
17
- <p class="lead my-4">Oops! Looks like you followed a bad link. If you think this is a problem with us, please tell us.</p>
17
+ <p class="lead my-4">It looks like you followed a bad link. If you think this is a problem with us, please tell us.</p>
18
18
  <a href="/dashboard.html" class="btn btn-gray-800 d-inline-flex align-items-center justify-content-center mb-4">
19
19
  <svg class="icon icon-xs me-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M7.707 14.707a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l2.293 2.293a1 1 0 010 1.414z" clip-rule="evenodd"></path></svg>
20
20
  Back to dashboard
irie/fhwa/__init__.py ADDED
@@ -0,0 +1,132 @@
1
+ #===----------------------------------------------------------------------===#
2
+ #
3
+ # STAIRLab -- STructural Artificial Intelligence Laboratory
4
+ #
5
+ #===----------------------------------------------------------------------===#
6
+ #
7
+ import sys
8
+ import json
9
+ import requests
10
+ from tqdm import tqdm
11
+
12
+ def getBridgeList(headers, start_page=1, totalpages=3, pagesize=10, totalbridges=24, page_nums=None, **kwds):
13
+ url = 'https://infobridge.fhwa.dot.gov/Data/GetAllBridges'
14
+
15
+ payload = {
16
+ "isShowBridgesApplied": True,
17
+ "gridParam": {
18
+ "isShowBridgesApplied": True,
19
+ "IsFilterApplied": False,
20
+ "SelectedFilters": None,
21
+ "SortOrder": "asc",
22
+ "SortIndex": "STATE_CODE",
23
+ }
24
+ }
25
+
26
+ pages = []
27
+ def filter(row):
28
+ return int(row["STATE_CODE"]) > 0
29
+
30
+ if page_nums is None:
31
+ page_nums = range(start_page, totalpages + 1)
32
+
33
+ for pageno in page_nums:
34
+ try:
35
+ payload["gridParam"]["PageNumber"] = pageno
36
+ payload["gridParam"]["PageSize"] = pagesize
37
+
38
+ r = requests.post(url, headers=headers, data=json.dumps(payload))
39
+
40
+ if r.status_code == 200:
41
+ try:
42
+ resp = json.loads(eval(r.content.decode('utf-8'))) # [1:-1].replace("\\", ""))
43
+ except:
44
+ print(f"Failed to get page {pageno}", file=sys.stderr)
45
+ continue
46
+
47
+ bridges = [
48
+ {'BRIDGE_YEARLY_ID': row['BRIDGE_YEARLY_ID'],
49
+ 'STRUCTURE_NUMBER': row['STRUCTURE_NUMBER'].strip()}
50
+ for row in resp["Results"]["rows"] # if filter(row)
51
+ ]
52
+ pages.extend(bridges)
53
+ print(pageno, len(pages), len(bridges), resp["Results"]["rows"][-1]["STATE_NAME"], file=sys.stderr)
54
+
55
+ except KeyboardInterrupt:
56
+ break
57
+
58
+ return pages
59
+
60
+
61
+ def fetch_structure(structure: str,
62
+ year_id: str,
63
+ headers,
64
+ year=2024,
65
+ keep_query=False):
66
+
67
+ url = 'https://infobridge.fhwa.dot.gov/Data/getBridgeInformation'
68
+
69
+ _headers = headers.copy()
70
+ # payload = {
71
+ # "requestModel": {
72
+ # "SELECTED_YEAR_ID": None,
73
+ # "IS_NEW_RECORD": True,
74
+ # "Is_Overview_Bridge_Selected": False,
75
+ # "IS_NBI_TREE_SELECTED": False,
76
+ # "tabChange": False,
77
+ # "NEW_BRIDGE_ID": 58813,
78
+ # }
79
+ # }
80
+
81
+ payload = {
82
+ "requestModel":{
83
+ "SELECTED_TAB": "NBITab", # "OverviewTab", "NBETab"
84
+ "SELECTED_YEAR_ID": None,
85
+ "IS_NEW_RECORD": False,
86
+ "IS_YEAR_SELECTED": False,
87
+ # "SELECTED_YEAR": None,
88
+ "Is_Overview_Bridge_Selected": False,
89
+ "NEW_BRIDGE_ID": 0,
90
+ "STRUCTURE_NUMBER": None,
91
+ "STATE_NAME": None,
92
+ "STATE_CODE": 0,
93
+ "IS_EXPERIMENTAL": False,
94
+ "SELECTED_NDE_TAB": "General",
95
+ # "MERRA_ID": 0,
96
+ # "IS_NBI_TREE_SELECTED": False,
97
+ # "Folder_Name": None,
98
+ # "tabChange": False,
99
+ }
100
+ }
101
+
102
+
103
+ referer = 'https://infobridge.fhwa.dot.gov/Data/BridgeDetail/'
104
+
105
+
106
+ BRIDGE_YEARLY_ID = year_id
107
+ STRUCTURE_NUMBER = structure
108
+
109
+
110
+ _headers['referer'] = referer + str(BRIDGE_YEARLY_ID)
111
+
112
+ payload["requestModel"].update({
113
+ "SELECTED_YEAR": year,
114
+ "CURRENT_YEARLY_ID": str(BRIDGE_YEARLY_ID),
115
+ "BRIDGE_YEARLY_ID": str(BRIDGE_YEARLY_ID),
116
+ })
117
+
118
+ r = requests.post(url, data=json.dumps(payload), headers=_headers)
119
+
120
+ if r.status_code == 200:
121
+ htmlcontent = r.content.decode('utf-8')
122
+ return {
123
+ k: (
124
+ v if k != "Results" else {
125
+ kk: vv for kk, vv in v.items() if (kk != "NBIDataQuery" or keep_query)
126
+ }
127
+ ) for k, v in json.loads(htmlcontent).items()
128
+ }
129
+
130
+ else:
131
+ raise Exception(f"Failed to get data for {STRUCTURE_NUMBER}")
132
+
irie/fhwa/__main__.py ADDED
@@ -0,0 +1,79 @@
1
+ import json
2
+
3
+ if __name__ == '__main__':
4
+ user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0"
5
+ request_verification_token = 'CfDJ8M6CuWz5hhxGnmUVXw2yDHQlfeNDzVoF03IbAJ0p3LdaDW7poklPvy74ykYda-qwcrtUXD4rnNzn583Ug7PWbR9IlomGzQh1OQIw_pa9d5TNwdN5p77SDfIfz3yq1nWPzxemEn_8bbh7TGGK9FIwcRY'
6
+ cookie = "_ga=GA1.1.478241025.1718907711; _ga_0623JYSC1Q=GS1.1.1718922743.2.0.1718922743.0.0.0; _ga_VW1SFWJKBB=GS1.1.1730789269.3.0.1730789272.0.0.0; _ga_CSLL4ZEK4L=GS1.1.1730789269.3.0.1730789272.0.0.0; _ga_NQ5ZN114SB=GS1.1.1730789269.3.0.1730789272.0.0.0; .AspNetCore.Session=CfDJ8M6CuWz5hhxGnmUVXw2yDHRQxNlIdqc8pBGKOJhMcHphMelhCyOQD7cnzYLVUWcsfCE8KOO8TNogarX5FbmvNQeSW1pTphWgR%2B6RLzPiUWuR4yPiDmb6rg82isfHqoEBhFoziXpFlU2o9pMgQICLsy7WbaeZbSgOl6FTg5Y0vLQ5; __RequestVerificationToken=CfDJ8M6CuWz5hhxGnmUVXw2yDHQXNjHWpjZ61I-CMSrl0yWsdWpCyt2QhUoeZ2L2aY0sqNpGy-wrD8ToMph6-wbfcRPpqORdlVci0ghxWu-3i4PCuWsiOkq90E1WupEYErSXnhsQVwHHGcD63WI7qyXZd7w; _ga_GNYE9X3V7H=GS1.1.1730825963.2.1.1730825988.0.0.0"
7
+
8
+ headers = {
9
+ 'authority': 'infobridge.fhwa.dot.gov',
10
+ 'origin': 'https://infobridge.fhwa.dot.gov',
11
+ 'sec-fetch-site': 'same-origin',
12
+ 'sec-fetch-mode': 'cors',
13
+ 'accept-encoding': 'gzip, deflate, br',
14
+ 'accept-language': 'en-US,en;q=0.9',
15
+
16
+ '__requestverificationtoken': request_verification_token,
17
+ 'user-agent': user_agent,
18
+ 'cookie': cookie
19
+ }
20
+
21
+ if len(sys.argv) == 1:
22
+
23
+ headers.update({
24
+ 'x-requested-with': 'XMLHttpRequest',
25
+ 'content-type': 'application/json; charset=UTF-8',
26
+ 'accept': 'application/json, text/javascript, */*; q=0.01',
27
+ 'referer': 'https://infobridge.fhwa.dot.gov/Data',
28
+ })
29
+
30
+ bridgeTable = getBridgeList(headers, start_page=511, totalpages=808, pagesize=100)
31
+ print(json.dumps(bridgeTable, indent=2))
32
+ sys.exit()
33
+
34
+ elif sys.argv[1] == "-S":
35
+ headers.update({
36
+ 'datatype': 'json',
37
+ 'content-type': 'application/json; charset=UTF-8',
38
+ 'accept': 'application/json, text/plain, */*'
39
+ })
40
+ bridgeTable = json.load(open(sys.argv[1]))
41
+
42
+ # calids = list(map(str.strip, open("init/calid.txt").readlines()))
43
+ # bridgeTable = [i for i in bridgeTable if i["STRUCTURE_NUMBER"] in calids]
44
+
45
+
46
+ # print(json.dumps(nbi_data, indent=2))
47
+
48
+ else:
49
+ headers.update({
50
+ 'datatype': 'json',
51
+ 'content-type': 'application/json; charset=UTF-8',
52
+ 'accept': 'application/json, text/plain, */*'
53
+ })
54
+ bridgeTable = json.load(open(sys.argv[1]))
55
+
56
+ bridgeTable = [
57
+ i for i in bridgeTable
58
+ if " " in i["STRUCTURE_NUMBER"] and len(i["STRUCTURE_NUMBER"]) in {7, 8}
59
+ ]
60
+
61
+ # calids = list(map(str.strip, open("init/calid.txt").readlines()))
62
+ # bridgeTable = [i for i in bridgeTable if i["STRUCTURE_NUMBER"] in calids]
63
+ if len(sys.argv) > 3:
64
+ bridgeTable = [
65
+ i for i in bridgeTable
66
+ if i["STRUCTURE_NUMBER"] == sys.argv[3]
67
+ ]
68
+ if len(bridgeTable) == 0:
69
+ print(f"Structure {sys.argv[3]} not found", file=sys.stderr)
70
+ sys.exit(1)
71
+ else:
72
+ bridgeTable = [
73
+ i for i in bridgeTable
74
+ if " " in i["STRUCTURE_NUMBER"] and len(i["STRUCTURE_NUMBER"]) in {7, 8}
75
+ ]
76
+
77
+ nbi_data = getNBIData(headers, bridgeTable[:], years=(2024,)) #range(2020, 2024))
78
+ print(json.dumps(nbi_data, indent=2))
79
+
@@ -0,0 +1,61 @@
1
+ #
2
+ # Item:1
3
+ # Federal Information Processing Standards (FIPS) code for States
4
+ #
5
+ values = {
6
+ 1: "Alabama",
7
+ 2: "Alaska",
8
+ 4: "Arizona",
9
+ 5: "Arkansas",
10
+ 6: "California",
11
+ 8: "Colorado",
12
+ 9: "Connecticut",
13
+ 10: "Delaware",
14
+ 11: "District of Columbia",
15
+ 12: "Florida",
16
+ 13: "Georgia",
17
+ 14: "Guam",
18
+ 66: "Guam",
19
+ 15: "Hawaii",
20
+ 16: "Idaho",
21
+ 17: "Illinois",
22
+ 18: "Indiana",
23
+ 19: "Iowa",
24
+ 20: "Kansas",
25
+ 21: "Kentucky",
26
+ 22: "Louisiana",
27
+ 23: "Maine",
28
+ 24: "Maryland",
29
+ 25: "Massachusetts",
30
+ 26: "Michigan",
31
+ 27: "Minnesota",
32
+ 28: "Mississippi",
33
+ 29: "Missouri",
34
+ 30: "Montana",
35
+ 31: "Nebraska",
36
+ 32: "Nevada",
37
+ 33: "New Hampshire",
38
+ 34: "New Jersey",
39
+ 35: "New Mexico",
40
+ 36: "New York",
41
+ 37: "North Carolina",
42
+ 38: "North Dakota",
43
+ 39: "Ohio",
44
+ 40: "Oklahoma",
45
+ 41: "Oregon",
46
+ 70: "Palau",
47
+ 42: "Pennsylvania",
48
+ 43: "Puerto Rico",
49
+ 44: "Rhode Island",
50
+ 45: "South Carolina",
51
+ 46: "South Dakota",
52
+ 47: "Tennessee",
53
+ 48: "Texas",
54
+ 49: "Utah",
55
+ 50: "Vermont",
56
+ 51: "Virginia",
57
+ 53: "Washington",
58
+ 54: "West Virginia",
59
+ 55: "Wisconsin",
60
+ 56: "Wyoming"
61
+ }
@@ -0,0 +1 @@
1
+ # Region
File without changes
irie/fhwa/fields.py ADDED
@@ -0,0 +1,32 @@
1
+
2
+ def NBI_42a(key):
3
+ # https://www.fhwa.dot.gov/bridge/mtguide.pdf
4
+ table = {
5
+ "Building or plaza": "0",
6
+
7
+ "Other": "0",
8
+ "Highway": "1",
9
+ "Railroad": "2",
10
+ "Highway-railroad": "4",
11
+ "Highway-pedestrian": "5",
12
+ "Overpass structure at an interchange or second level of a multilevel interchange": "6",
13
+ "Fourth level (Interchange)": "8",
14
+ "Third level (Interchange)": "7",
15
+ }
16
+ return f"{table[key]} - {key}"
17
+
18
+ def NBI_42b(string):
19
+ """
20
+ "Highway, with or without pedestrian"
21
+ Highway-railroad
22
+ Highway-waterway
23
+ Highway-waterway-railroad
24
+ Other
25
+ Railroad
26
+ Railroad-waterway
27
+ Relief for waterway
28
+ Waterway
29
+ """
30
+
31
+ def NBI_43b(string):
32
+ pass
irie/init/__main__.py CHANGED
@@ -1,7 +1,6 @@
1
1
  import os
2
2
  import sys
3
3
  import pathlib
4
- import subprocess
5
4
 
6
5
  from django.core.management import execute_from_command_line, call_command
7
6
 
@@ -38,9 +37,6 @@ def init(argv):
38
37
  if "p" in actions:
39
38
  call_command("init_predictors")
40
39
 
41
-
42
-
43
-
44
40
  if __name__ == "__main__":
45
41
  init(sys.argv)
46
42