Skip to content

feat: Add measurement mapping support in Specs - #242

Merged
Ahalya-ni merged 9 commits into
masterfrom
feature/spec-measurement-mapping
Nov 18, 2026
Merged

Ahalya-ni merged 9 commits into
masterfrom
feature/spec-measurement-mapping

Conversation

@Ahalya-ni

@Ahalya-ni Ahalya-ni commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

What does this Pull Request accomplish?

User Story 4137170: Add measurementMapping in Python client

Adds measurement_mapping support to the Spec client:

  • New MeasurementMappingItem model (optional filter and result_filter) and measurement_mapping field on specification definitions, so it is available for create, get, query and update.
  • convert_specs_to_dataframe has a new measurement_mapping_format argument, like condition_format. Built-in formats:
    • normalize_measurement_mappings_per_column (default): one row per spec, with columns such as measurement_mapping[0].filter.
    • normalize_measurement_mappings_per_row: one row per mapping item.
    • summarize_measurement_mappings_as_a_string: one measurement_mapping column with a readable summary.
    • None leaves mappings out, and a custom function can be passed.

Why should this Pull Request be merged?

Lets users create, read, query, update and tabulate the mapping between a specification and its measurement data, including specs with multiple mapping items.

What testing has been done?

  • Added unit and integration tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Ahalya-ni Ahalya-ni changed the title feat(spec): add measurement mapping support feat: Add measurement mapping support in Specs Nov 13, 2026
@Ahalya-ni
Ahalya-ni requested a max review from Copilot November 13, 2026 06:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Nullable-response type errors and an export-order contract violation break required checks, while the new mapping tests also omit required dtype assertions.

3 open issues
What changed in this PR

Adds measurement mapping to the NI SystemLink Spec client so users can associate specifications with measurement data across create, read, query, and update operations.

Changes:

  • Adds a public mapping model, specification field, and query projection support.
  • Flattens the first mapping item into optional DataFrame columns.
  • Extends examples and tests for mapping creation, filtering, projection, and updates.

Validation was limited to a standalone AST check. Project tests, linting, type checks, builds, and credentialed integration tests were not run during this review.

File Description
tests/​spec/​test_spec_dataframe_utilitites.py Tests mapping flattening, partial values, and absent mappings.
tests/​integration/​spec/​test_spec.py Tests mapping persistence, clearing, filtering, and projection.
nisystemlink/​clients/​spec/​utilities/​_dataframe_utilities.py Flattens mapping fields into DataFrame columns.
nisystemlink/​clients/​spec/​models/​_specification.py Defines the mapping model and specification field.
nisystemlink/​clients/​spec/​models/​_query_specs.py Adds mapping projection and filter documentation.
nisystemlink/​clients/​spec/​models/​__init__.py Exports the new mapping model.
examples/​spec/​update_and_delete_specs.py Demonstrates updating a measurement mapping.
examples/​spec/​get_and_query_specs.py Demonstrates creating and querying mapped specifications.

Review effort: Max

Comment thread tests/integration/spec/test_spec.py Resolved
Ahalya-ni and others added 4 commits November 13, 2026 12:22
…rder

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Ahalya-ni
Ahalya-ni requested a review from hariram-ni November 13, 2026 12:08
Ahalya-ni and others added 2 commits November 16, 2026 10:24
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The unused mapping_columns variable triggers Flake8 F841 and leaves the parameterized column expectations unchecked.

1 open issue
3 resolved since last review

Review effort: Max

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Human assessment is needed to weigh consumer-facing ambiguity from the documented schema mismatch and the cross-product behavior of combined row formatters.

No open issues 🎉

1 resolved since last review

Review effort: Max

@Ahalya-ni
Ahalya-ni marked this pull request as ready for review November 16, 2026 09:23
@Ahalya-ni

Copy link
Copy Markdown
Contributor Author

Gentle reminder to review this PR

@rbell517 / @cameronwaterman / @spanglerco

Comment thread examples/spec/get_and_query_specs.py Resolved
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Ahalya-ni
Ahalya-ni merged commit c689339 into master Nov 18, 2026
17 checks passed
@Ahalya-ni
Ahalya-ni deleted the feature/spec-measurement-mapping branch November 18, 2026 02:40
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.

4 participants