Skip to content

Conversation

@jacob6838
Copy link
Collaborator

@jacob6838 jacob6838 commented Dec 30, 2025

Adding pydantic models for WZDx field device feed

@jacob6838 jacob6838 marked this pull request as ready for review December 30, 2025 19:07
Base automatically changed from poetry to main January 6, 2026 00:50
Copy link
Member

@dmccoystephenson dmccoystephenson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue (blocking): The 'pydantic' module is not included in the requirements.txt file, requiring the user to install the module manually before the unit tests can be run.

After installing pydantic manually, I see the following error also:

.venv\Lib\site-packages\pydantic\networks.py:967: in import_email_validator                                                                                                                                                         
    raise ImportError("email-validator is not installed, run `pip install 'pydantic[email]'`") from e                                                                                                                               
E   ImportError: email-validator is not installed, run `pip install 'pydantic[email]'

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Pydantic models for the WZDx (Work Zone Data Exchange) field device feed specification, enabling structured validation and serialization of field device data. The implementation includes comprehensive models for various device types (arrow boards, cameras, traffic sensors, etc.) along with GeoJSON geometry support.

Key Changes

  • Introduced Pydantic v2 models for 8 field device types with discriminated union pattern for type-safe device property handling
  • Added GeoJSON geometry models (Point, LineString, MultiPoint, Polygon) with proper type validation
  • Updated date_tools.py to use identity comparison (is) instead of equality (!=) for type checking, improving code consistency

Reviewed changes

Copilot reviewed 31 out of 33 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
wzdx/tools/date_tools.py Refactored type comparisons to use is/is not operators and updated datetime boundary check comment for millisecond timestamp handling
wzdx/models/geometry/* Added GeoJSON geometry models with Literal type constraints and discriminated unions
wzdx/models/field_device_feed/field_device_core_details.py Core details model shared across all device types with required and optional fields
wzdx/models/field_device_feed/properties/* Device-specific property models for arrow boards, cameras, signals, sensors, beacons, signs, and markers
wzdx/models/field_device_feed/field_device_feature.py GeoJSON Feature wrapper for field devices
wzdx/models/field_device_feed/device_feed.py Top-level feed model containing metadata and device features
wzdx/models/feed_info/* Feed metadata models for publisher info and data sources
tests/models/field_device_feed_test.py Deserialization and serialization tests with real-world data
tests/data/models/* Test fixtures with sample field device feed JSON data
tests/tools/date_tools_test.py New unit tests for datetime_from_unix function boundary conditions
pyproject.toml Added pydantic[email] and email-validator dependencies
poetry.lock Updated lock file with new dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jacob6838
Copy link
Collaborator Author

Issue (blocking): The 'pydantic' module is not included in the requirements.txt file, requiring the user to install the module manually before the unit tests can be run.

After installing pydantic manually, I see the following error also:

.venv\Lib\site-packages\pydantic\networks.py:967: in import_email_validator                                                                                                                                                         
    raise ImportError("email-validator is not installed, run `pip install 'pydantic[email]'`") from e                                                                                                                               
E   ImportError: email-validator is not installed, run `pip install 'pydantic[email]'

The requirements.txt was a little out of date from poetry, I just regenerated it. The recommended way to import dependencies in this project is to use poetry commands, specifically

poetry install

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 31 out of 34 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 33 out of 36 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 33 out of 36 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@dmccoystephenson dmccoystephenson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me & the unit tests pass!

@jacob6838 jacob6838 merged commit 3d7030e into main Jan 7, 2026
8 checks passed
@jacob6838 jacob6838 deleted the icone-field-device-feed-models branch January 7, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants