Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4cfd726
Re-naming wzdx translators and sample files
jacob6838 Mar 13, 2025
28f01df
Creating CWZ 1.0 schema
jacob6838 Mar 13, 2025
7eed847
Updating CWZ translator for compliance with v1 spec
jacob6838 Mar 18, 2025
dac03f2
Writing cwz feed unit tests
jacob6838 Mar 18, 2025
59d412d
Update ci.yml
jacob6838 Mar 18, 2025
0104538
Updating version to 1.4.0-rc.1
jacob6838 Mar 18, 2025
b2198cf
Removing duplicate BoundingBox definition
jacob6838 Mar 28, 2025
e5adebb
Fixing add_ids event_type removal
jacob6838 Mar 28, 2025
d25db1d
Removing $id and $schema from cwz schema
jacob6838 Mar 28, 2025
ac214fc
re-working cwz schema definitions location
jacob6838 Mar 28, 2025
232a974
Fixing bugs for alternating traffic and incorrect geometry directions
jacob6838 Aug 8, 2025
566923e
Finalizing alternating-one-way processing
jacob6838 Aug 13, 2025
68dc1f4
Updating unit tests
jacob6838 Aug 13, 2025
7b09767
Updating README with CWZ references
jacob6838 Aug 13, 2025
dda3982
Updating cwz/wzdx production sample messages
jacob6838 Aug 13, 2025
f166de2
Adding unit tests for get_lane_impacts
jacob6838 Aug 13, 2025
628d9f1
Removing prints and re-adding try/catch
jacob6838 Aug 15, 2025
bac0659
Fixing warnings
jacob6838 Aug 15, 2025
a11466a
Updating comments and validating dec determination
jacob6838 Aug 15, 2025
f097493
Correctly making route dec methods static
jacob6838 Aug 15, 2025
a90f1b0
Creating enum types and implementing in translators
jacob6838 Sep 11, 2025
413baea
Applying enum types and removing unused code
jacob6838 Sep 11, 2025
64c1427
applying enum types and removing unused code
jacob6838 Sep 11, 2025
60020d7
Updating spellcheck
jacob6838 Sep 11, 2025
54dc302
Cleaning up tests, fixing cwz test file name
jacob6838 Sep 11, 2025
e2608a1
Finalizing enum integration and fixing unit tests
jacob6838 Sep 12, 2025
55f5800
Updating env.sh GIS endpoint
jacob6838 Sep 12, 2025
613d5ff
Removing unnecessary logging
jacob6838 Sep 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
python3 -m coverage xml --omit="/opt/*,/root/*,/tmp/*,/usr/*,/var/*,**/__init__.py"

- name: Archive Code Coverage Results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: build_api
path: cov.xml
72 changes: 54 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Work_Zone

This is an open source, proof of concept solution for translating work zone data in the form of CDOT Planned Events, iCone device, and NavJOY 568 form data to the standardized [WZDx 4.2 format](https://github.com/usdot-jpo-ode/wzdx/tree/release/v4.2). This project was developed for CDOT. A unique translator has been developed for each of these message types. These translators read in the source message, parse out specific fields, and generate a WZDx message. For more information on these message formats and the data mappings between these messages and the WZDx format, see the [documentation](wzdx/docs). sample_files are located [here](wzdx/sample_files). All these translators are built to run from the command line and from GCP Dataflows, hosted within the CDOT RTDH WZDX environment. These translators are used to generate the CDOT Production WZDx data feed, which is published on the USDOT [WZDx Data Exchange Feed Registry](https://datahub.transportation.gov/Roadways-and-Bridges/Work-Zone-Data-Exchange-WZDx-Feed-Registry/69qe-yiui/data_preview)
This is an open source, proof of concept solution for translating work zone data in the form of CDOT Planned Events, iCone device, and NavJOY 568 form data to the standardized [CWZ 1.0 format](wzdx/docs/508_CWZ_Standard_draft_v01_00_FINAL_Revised.pdf) as well as the [WZDx 4.2 format](https://github.com/usdot-jpo-ode/wzdx/tree/release/v4.2). This project was developed for CDOT. A unique translator has been developed for each of these message types. These translators read in the source message, parse out specific fields, and generate a CWZ/WZDx message. For more information on these message formats and the data mappings between these messages and the included formats, see the [documentation](wzdx/docs). sample_files are located [here](wzdx/sample_files). All these translators are built to run from the command line and from GCP Dataflows, hosted within the CDOT RTDH environment. These translators are used to generate the CDOT Production CWZ and WZDx data feeds, which are published on the USDOT [WZDx Data Exchange Feed Registry](https://datahub.transportation.gov/Roadways-and-Bridges/Work-Zone-Data-Exchange-WZDx-Feed-Registry/69qe-yiui/data_preview)

The Google CloudPlatform deployment for the CDOT Planned Event WZDx translator is outlined below:
The Google CloudPlatform deployment for the CDOT Planned Event WZDx translators are outlined below. The CWZ translator functions in a similar manner, but is not shown here.
![GCP Planned Events](wzdx/docs/CDOT%20WZDx%20translators%20-%20Planned%20Events.png)

On top of these translators, combination scripts have been written to integrate WZDx messages from multiple separate sources, including CDOT Planned Events, iCone, and NavJOY. Each of these sources has unique data fields that are not present in the other sources, and the combination script is designed to merge these fields into a single WZDx message. The combination script is also built to run from the command line and from GCP Dataflows, hosted within the CDOT RTDH environment. The combination script is designed to run after the individual translators have generated their WZDx messages, and the output of the combination script is a single WZDx message that contains all of the data from the individual sources. When fields from multiple sources overlap, the combination script is designed to prioritize the data from the source with the most complete information. Geotab data is also integrated for mobile work zones, so that when a vehicle is detected in a "planned-moving-area" work zone, the work zone is changed to a "moving" work zone, using the current location of the vehicle plus a buffer distance ahead.
Expand All @@ -24,17 +24,17 @@ The build package tar.gz file will be located in the dist folder.

## Running the Translators Locally

This set of WZDx message translators is set up to be implemented in GCP with App Engines and Dataflows. It is also set up with raw, standard, and enhanced (WZDx) data feeds. This means that to take a raw icone document and generate a WZDx message, the raw icone xml document must first be converted to 1 or multiple standard json messages (based on CDOT RTDH specification), and then each standard message may be converted into a single WZDx message. At this point, this data can be combined with other WZDx messages, through the [combination scripts](wzdx/experimental_combination/)
This set of CWZ and WZDx message translators is set up to be implemented in GCP with App Engines and Dataflows. It is also set up with raw, standard, and enhanced data feeds. This means that to take a raw icone document and generate a CWZ or WZDx message, the raw icone xml document must first be converted to 1 or multiple standard json messages (based on CDOT RTDH specification), and then each standard message may be converted into a single enhanced message. At this point, this data can be combined with other CWZ/WZDx messages, through the [combination scripts](wzdx/experimental_combination/)

### Prerequisites

Requires:

- Python 3.8 (or higher)
- Python 3.12 (or higher)

### Environment Setup

This code requires Python 3.8 or a higher version. If you haven’t already, download Python and pip. You can install the required packages by running the following command:
This code requires Python 3.12 or a higher version. If you haven’t already, download Python and pip. You can install the required packages by running the following command:

```
pip install -r requirements.txt
Expand All @@ -46,13 +46,13 @@ Please set up the following environment variable for your local computer before

Runtime Environment Variables:

| Name | Value | Description |
| :--------------------------- | :------------------------------------------------------------------------------------------------------: | ---------------------------------------------------: |
| contact_name | Heather Pickering-Hilgers | name of WZDx feed contact |
| contact_email | heather.pickeringhilgers@state.co.us | email of WZDx feed contact |
| publisher | CDOT | name of the organization issuing the WZDx feed |
| CDOT_GEOSPATIAL_API_BASE_URL | https://dtdapps.colorado.gov/server/rest/services/LRS/Routes_withDEC/MapServer/exts/CdotLrsAccessRounded | GIS server endpoint used for geospatial api |
| NAMESPACE_UUID | 00000000-0000-0000-0000-000000000000 | UUID used to pseudo-randomly tag all UUIDs generated |
| Name | Value | Description |
| :--------------------------- | :---------------------------------------------------------------------------------------------------: | ---------------------------------------------------: |
| contact_name | Heather Pickering-Hilgers | name of WZDx feed contact |
| contact_email | heather.pickeringhilgers@state.co.us | email of WZDx feed contact |
| publisher | CDOT | name of the organization issuing the WZDx feed |
| CDOT_GEOSPATIAL_API_BASE_URL | https://dtdapps.codot.gov/server/rest/services/LRS/Routes_withDEC/MapServer/exts/CdotLrsAccessRounded | GIS server endpoint used for geospatial api |
| NAMESPACE_UUID | 00000000-0000-0000-0000-000000000000 | UUID used to pseudo-randomly tag all UUIDs generated |

Example usage:
for mac computer run the following script to initialize the environment variable:
Expand All @@ -73,16 +73,28 @@ Example usage:
python -m wzdx.raw_to_standard.planned_events 'wzdx/sample_files/raw/planned_events/I70_resurfacing_2024_11_07.json'
```

#### Standard to CWZ Conversion

```
python -m wzdx.standard_to_cwz.{standard translator} inputfile.json --outputFile outputfile.geojson
```

Example usage:

```
python -m wzdx.standard_to_cwz.planned_events_translator 'wzdx/sample_files/standard/planned_events/standard_planned_event_OpenTMS-Event20643308360_westbound.json'
```

#### Standard to WZDx Conversion

```
python -m wzdx.standard_to_enhanced.{standard translator} inputfile.json --outputFile outputfile.geojson
python -m wzdx.standard_to_wzdx.{standard translator} inputfile.json --outputFile outputfile.geojson
```

Example usage:

```
python -m wzdx.standard_to_enhanced.planned_events_translator 'wzdx/sample_files/standard/planned_events/standard_planned_event_OpenTMS-Event20643308360_westbound.json'
python -m wzdx.standard_to_wzdx.planned_events_translator 'wzdx/sample_files/standard/planned_events/standard_planned_event_OpenTMS-Event20643308360_westbound.json'
```

### Execution for iCone translator
Expand All @@ -99,16 +111,28 @@ Example usage:
python -m wzdx.raw_to_standard.icone 'wzdx/sample_files/raw/icone/icone_ftp_20241107-235100.xml'
```

#### Standard to CWZ Conversion

```
python -m wzdx.standard_to_cwz.icone_translator inputfile.json --outputFile outputfile.geojson
```

Example usage:

```
python -m wzdx.standard_to_cwz.icone_translator 'wzdx/sample_files/standard/icone/standard_icone_U13632784_20241107235100_1731023924_unknown.json'
```

#### Standard to WZDx Conversion

```
python -m wzdx.standard_to_enhanced.icone_translator inputfile.json --outputFile outputfile.geojson
python -m wzdx.standard_to_wzdx.icone_translator inputfile.json --outputFile outputfile.geojson
```

Example usage:

```
python -m wzdx.standard_to_enhanced.icone_translator 'wzdx/sample_files/standard/icone/standard_icone_U13632784_20241107235100_1731023924_unknown.json'
python -m wzdx.standard_to_wzdx.icone_translator 'wzdx/sample_files/standard/icone/standard_icone_U13632784_20241107235100_1731023924_unknown.json'
```

### Execution for NavJoy 568 translator
Expand All @@ -129,16 +153,28 @@ Example usage:
python -m wzdx.raw_to_standard.navjoy_568 'wzdx/sample_files/raw/navjoy/direction_test_2.json'
```

#### Standard to CWZ Conversion

```
python -m wzdx.standard_to_cwz.navjoy_translator inputfile.json --outputFile outputfile.geojson
```

Example usage:

```
python -m wzdx.standard_to_cwz.navjoy_translator 'wzdx/sample_files/standard/navjoy/standard_568_Form568-cb0fdaf0-c27a-4bef-aabd-442615dfb2d6_1638373455_westbound.json'
```

#### Standard to WZDx Conversion

```
python -m wzdx.standard_to_enhanced.navjoy_translator inputfile.json --outputFile outputfile.geojson
python -m wzdx.standard_to_wzdx.navjoy_translator inputfile.json --outputFile outputfile.geojson
```

Example usage:

```
python -m wzdx.standard_to_enhanced.navjoy_translator 'wzdx/sample_files/standard/navjoy/standard_568_Form568-cb0fdaf0-c27a-4bef-aabd-442615dfb2d6_1638373455_westbound.json'
python -m wzdx.standard_to_wzdx.navjoy_translator 'wzdx/sample_files/standard/navjoy/standard_568_Form568-cb0fdaf0-c27a-4bef-aabd-442615dfb2d6_1638373455_westbound.json'
```

### Combine WZDx Messages
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pathlib
from setuptools import setup, find_packages

VERSION = "1.3.1"
VERSION = "1.4.2"
DESCRIPTION = "CDOT Work Zone WZDx Translators"
HERE = pathlib.Path(__file__).parent
README = (HERE / "README.md").read_text()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,21 +330,22 @@
"MMax": 449.589,
"MMin": 0.0,
"Measure": 60.0,
"Route": "070A_DEC",
"Route": "070A",
},
"route_details_start": {
"Distance": 0.91,
"MMax": 449.589,
"MMin": 0.0,
"Measure": 50.0,
"Route": "070A_DEC",
"Route": "070A",
},
"condition_1": False,
"beginning_milepost": 50.0,
"ending_milepost": 60.0,
"beginning_cross_street": "CO 65",
"ending_cross_street": "US 6",
"valid": False,
"vehicle_impact": "all-lanes-closed",
},
},
}
Expand Down
Loading
Loading