diff --git a/.gitignore b/.gitignore index 912e592..5367109 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,6 @@ icone_to_wzdx_test.geojson icone_wzdx_translated_output_message.geojson cotrip_translated_output_message.geojson cotrip_wzdx_translated_output_message.geojson -.vscode/settings.json *.pyc *.geojson test-output.xml diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..3ce0510 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,56 @@ +{ + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, + "editor.formatOnPaste": false, + "prettier.useEditorConfig": false, + "prettier.useTabs": false, + "prettier.configPath": ".vscode/.prettierrc.json", + "[python]": { + "editor.defaultFormatter": "ms-python.black-formatter", + "editor.formatOnSave": true + }, + "cSpell.ignorePaths": ["*.json"], + "cSpell.words": [ + "bdist", + "brng", + "cdot", + "codot", + "creationtime", + "Dataflows", + "dateutil", + "ellps", + "endtime", + "geopy", + "Geotab", + "hexidecimal", + "Hilgers", + "icone", + "inputfile", + "ipin", + "millis", + "navjoy", + "orjson", + "outputfile", + "pcms", + "pjson", + "polyline", + "polylines", + "protobuf", + "pypi", + "pyproj", + "pytest", + "pytz", + "restriping", + "rtdh", + "sdist", + "setuptools", + "srzmap", + "starttime", + "Trafficade", + "updatetime", + "USDOT", + "xmltodict" + ] +} diff --git a/wzdx/monitoring/experimental/main.py b/wzdx/monitoring/experimental/main.py index 88349a9..6be8cd5 100644 --- a/wzdx/monitoring/experimental/main.py +++ b/wzdx/monitoring/experimental/main.py @@ -31,7 +31,7 @@ def upload_logs(contents, path, bucket_name): blob.upload_from_string(contents) logging.info(f"{path} uploaded to {bucket_name}") else: - logging.warn(f"blob already exists for {path}") + logging.warning(f"blob already exists for {path}") return True except Exception as e: logging.error( diff --git a/wzdx/sample_files/enhanced/icone/wzdx_translated_output_message.json b/wzdx/sample_files/enhanced/icone/wzdx_translated_output_message.json new file mode 100644 index 0000000..5a498cb --- /dev/null +++ b/wzdx/sample_files/enhanced/icone/wzdx_translated_output_message.json @@ -0,0 +1,62 @@ +{ + "feed_info": { + "publisher": "CDOT", + "version": "4.2", + "license": "https://creativecommons.org/publicdomain/zero/1.0/", + "data_sources": [ + { + "data_source_id": "f7806c58-6492-4386-b12f-1b8c4a5404f7", + "organization_name": "CDOT", + "update_date": "2024-11-08T00:00:17Z", + "update_frequency": 300, + "contact_name": "Heather Pickering-Hilgers", + "contact_email": "heather.pickeringhilgers@state.co.us" + } + ], + "update_date": "2024-11-08T00:00:17Z", + "update_frequency": 300, + "contact_name": "Heather Pickering-Hilgers", + "contact_email": "heather.pickeringhilgers@state.co.us" + }, + "type": "FeatureCollection", + "features": [ + { + "id": "U13632784_20241107235100", + "type": "Feature", + "properties": { + "core_details": { + "event_type": "work-zone", + "data_source_id": "f7806c58-6492-4386-b12f-1b8c4a5404f7", + "road_names": ["025A"], + "direction": "unknown", + "description": "Roadwork - Caution [iCone]", + "creation_date": "2024-11-07T23:51:00Z", + "update_date": "2024-11-07T23:51:50Z" + }, + "start_date": "2024-11-07T23:51:00Z", + "end_date": "2024-11-14T23:58:00Z", + "is_start_date_verified": false, + "is_end_date_verified": false, + "is_start_position_verified": false, + "is_end_position_verified": false, + "location_method": "channel-device-method", + "vehicle_impact": "all-lanes-open", + "route_details_start": { + "Route": "025A", + "Measure": 227.23, + "MMin": 0.0, + "MMax": 385.223, + "Distance": 5.92 + }, + "condition_1": true + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [-104.9880685, 39.9740377], + [-104.9880685, 39.9740377] + ] + } + } + ] +} diff --git a/wzdx/sample_files/enhanced/planned_events/wzdx_translated_output_message.json b/wzdx/sample_files/enhanced/planned_events/wzdx_translated_output_message.json new file mode 100644 index 0000000..9673248 --- /dev/null +++ b/wzdx/sample_files/enhanced/planned_events/wzdx_translated_output_message.json @@ -0,0 +1,171 @@ +{ + "feed_info": { + "publisher": "CDOT", + "version": "4.2", + "license": "https://creativecommons.org/publicdomain/zero/1.0/", + "data_sources": [ + { + "data_source_id": "0c21decf-d9b4-402b-9d3d-f5d7fe7b6463", + "organization_name": "CDOT", + "update_date": "2024-11-07T23:17:40Z", + "update_frequency": 300, + "contact_name": "Heather Pickering-Hilgers", + "contact_email": "heather.pickeringhilgers@state.co.us" + } + ], + "update_date": "2024-11-07T23:17:40Z", + "update_frequency": 300, + "contact_name": "Heather Pickering-Hilgers", + "contact_email": "heather.pickeringhilgers@state.co.us" + }, + "type": "FeatureCollection", + "features": [ + { + "id": "be0ba431-66a4-557e-b801-8fa8804c00d7", + "type": "Feature", + "properties": { + "core_details": { + "event_type": "work-zone", + "data_source_id": "0c21decf-d9b4-402b-9d3d-f5d7fe7b6463", + "road_names": [ + "I-70" + ], + "direction": "westbound", + "name": "OpenTMS-Event20643308360_westbound", + "description": "Between Exit 263: Colorado Mills Parkway (West Pleasant View) and C-470 (Golden) from Mile Point 262 to Mile Point 260. Both shoulders closed due to road construction. Starting November 12, 2024 at 7:00AM MST until November 12, 2024 at about 6:00PM MST. Full schedule below: \u00e2\u20ac\u00a2 November 12, 7:00AM - November 12, 6:00PM", + "update_date": "2024-11-07T21:09:35Z" + }, + "start_date": "2024-11-12T14:00:00Z", + "end_date": "2024-11-13T01:00:00Z", + "is_start_date_verified": false, + "is_end_date_verified": false, + "is_start_position_verified": false, + "is_end_position_verified": false, + "location_method": "channel-device-method", + "work_zone_type": "static", + "vehicle_impact": "some-lanes-closed", + "lanes": [ + { + "order": 1, + "type": "shoulder", + "status": "closed" + }, + { + "order": 2, + "type": "general", + "status": "open" + }, + { + "order": 3, + "type": "general", + "status": "open" + }, + { + "order": 4, + "type": "general", + "status": "open" + }, + { + "order": 5, + "type": "shoulder", + "status": "closed" + } + ], + "beginning_cross_street": "Exit 263: Colorado Mills Parkway (West Pleasant View)", + "ending_cross_street": "C-470 (Golden)", + "types_of_work": [ + { + "type_name": "roadway-creation", + "is_architectural_change": true + } + ], + "beginning_milepost": 262.0, + "ending_milepost": 260.0, + "route_details_start": { + "Route": "070A_DEC", + "Measure": 262.0, + "MMin": 0.0, + "MMax": 449.589, + "Distance": 1.06 + }, + "route_details_end": { + "Route": "070A_DEC", + "Measure": 260.0, + "MMin": 0.0, + "MMax": 449.589, + "Distance": 1.08 + }, + "condition_1": true + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -105.16586083999994, + 39.734858632000055 + ], + [ + -105.16638882599995, + 39.73443766200006 + ], + [ + -105.16854799099997, + 39.73271605700006 + ], + [ + -105.17077491299995, + 39.73094029200007 + ], + [ + -105.17293965199997, + 39.72943332800003 + ], + [ + -105.17468559199995, + 39.72842892500006 + ], + [ + -105.17580481399995, + 39.727785029000074 + ], + [ + -105.17843878399998, + 39.72609999900004 + ], + [ + -105.17993813899994, + 39.72512450600004 + ], + [ + -105.18206644899999, + 39.723739730000034 + ], + [ + -105.18563422299997, + 39.72141816000004 + ], + [ + -105.18769294899994, + 39.72000476800008 + ], + [ + -105.18847369599996, + 39.71936694800007 + ], + [ + -105.18984140499998, + 39.718052475000036 + ], + [ + -105.190781717, + 39.71695507100003 + ], + [ + -105.19270413899994, + 39.714462801000025 + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/wzdx/tools/cdot_geospatial_api.py b/wzdx/tools/cdot_geospatial_api.py index 96dd339..c7fdd7d 100644 --- a/wzdx/tools/cdot_geospatial_api.py +++ b/wzdx/tools/cdot_geospatial_api.py @@ -165,7 +165,7 @@ def get_route_and_measure( startMeasure = measure endMeasure = measure + step if (endMeasure > mMax) or (startMeasure < mMin): - logging.warn( + logging.warning( "get_route_and_measure bearing computation failed, measure out of bounds. MMin: {mMin}, MMax: {mMax}, startMeasure: {startMeasure}, endMeasure: {endMeasure}, step: {step}" ) return route_details @@ -246,7 +246,7 @@ def get_route_geometry_ahead( latLng = self.get_point_at_measure(routeId, startMeasure) routeDetails = self.get_route_and_measure(latLng, heading) if not latLng or not routeDetails: - logging.warn( + logging.warning( "get_route_geometry_ahead failed to get route details for routeId: {routeId}, startMeasure: {startMeasure}, heading: {heading}" ) return None @@ -381,12 +381,12 @@ def _make_cached_web_request( url, timeout=timeout * 2, retryOnTimeout=False ) else: - logging.warn( + logging.warning( f"Geospatial Request Timed Out for {source} with url : {url}. Timeout: {timeout}. Error: {e}" ) return None except requests.exceptions.RequestException as e: - logging.warn( + logging.warning( f"Geospatial Request Failed for {source} with url : {url}. Timeout: {timeout}. Error: {e}" ) return None