Skip to content

Commit ec74bcc

Browse files
authored
Replace read_data with read_measurement_value and read_condition_value. (#120)
* Update read_data() to use read_measurement_value and read_condition_value Signed-off-by: Michael Johansen <michael.johansen@emerson.com> * Fix unit tests and linting errors. Signed-off-by: Michael Johansen <michael.johansen@emerson.com> * Remove unused grpc conversion method. Signed-off-by: Michael Johansen <michael.johansen@emerson.com> * Scrub moniker references from datastore-python. Signed-off-by: Michael Johansen <michael.johansen@emerson.com> * Clean up tests. Bump minor version due to read_data changes. Signed-off-by: Michael Johansen <michael.johansen@emerson.com> * Rename read_data to match lower level functions. Signed-off-by: Michael Johansen <michael.johansen@emerson.com> * Fix a comment. Signed-off-by: Michael Johansen <michael.johansen@emerson.com> * Update examples and jupyter notebooks to use the new read methods. Signed-off-by: Michael Johansen <michael.johansen@emerson.com> * Fix formatting error in example. Signed-off-by: Michael Johansen <michael.johansen@emerson.com> * Try again to fix format error. Signed-off-by: Michael Johansen <michael.johansen@emerson.com> * Allow local ni-datastore dependency temporarily Signed-off-by: Michael Johansen <michael.johansen@emerson.com> * Address review feedback. Leave moniker param unassigned. Fix comment. Signed-off-by: Michael Johansen <michael.johansen@emerson.com> --------- Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
1 parent 3f6284b commit ec74bcc

29 files changed

Lines changed: 449 additions & 912 deletions

docs/reference/ni-data-store.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ Each step belongs to a TestResult and can contain multiple measurements and cond
5959
A **PublishedMeasurement** represents actual measurement data captured during a test step. This is the core data entity that stores the measured values, whether they are simple scalars, complex waveforms, or other data types.
6060

6161
**Fields:**
62-
- `moniker` (Moniker) - Data location identifier for retrieving the actual measurement values
6362
- `published_conditions` (list) - Environmental conditions present during measurement
6463
- `id` (string) - Unique identifier for this measurement
6564
- `test_result_id` (string) - ID of the associated TestResult
@@ -98,7 +97,6 @@ A **PublishedMeasurement** represents actual measurement data captured during a
9897
A **PublishedCondition** represents environmental or contextual information that was present during test execution. Conditions capture the state of the test environment, input parameters, or other contextual data that might affect measurement results.
9998

10099
**Fields:**
101-
- `moniker` (Moniker) - Data location identifier for retrieving the condition value
102100
- `id` (string) - Unique identifier for this condition
103101
- `name` (string) - Name of the condition (e.g., "Temperature", "Supply Voltage")
104102
- `condition_type` (string) - Type/category of the condition (e.g., "Environment", "Input Parameter")

examples/notebooks/extension-attributes/extension_attributes.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
"published_measurements = data_store_client.query_measurements(\"$filter=name eq 'scope reading'\")\n",
174174
"found_measurement = next(iter(published_measurements), None)\n",
175175
"if found_measurement is not None:\n",
176-
" waveform = data_store_client.read_data(found_measurement, expected_type=AnalogWaveform)\n",
176+
" waveform = data_store_client.read_measurement_value(found_measurement, expected_type=AnalogWaveform)\n",
177177
" print(f\"published data is: {waveform.raw_data}\")"
178178
]
179179
},

examples/notebooks/overview/publish_measurement.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@
266266
" badge_number = operator.extension[\"badge_number\"]\n",
267267
" print(f\"operator {operator.name}'s badge number is: {badge_number}\")\n",
268268
"\n",
269-
" waveform = data_store_client.read_data(found_measurement, expected_type=AnalogWaveform)\n",
269+
" waveform = data_store_client.read_measurement_value(found_measurement, expected_type=AnalogWaveform)\n",
270270
" print(f\"published data is: {waveform.raw_data}\")"
271271
]
272272
},
@@ -295,7 +295,7 @@
295295
],
296296
"metadata": {
297297
"kernelspec": {
298-
"display_name": "ni-datastore-py3.10",
298+
"display_name": ".venv",
299299
"language": "python",
300300
"name": "python3"
301301
},
@@ -309,7 +309,7 @@
309309
"name": "python",
310310
"nbconvert_exporter": "python",
311311
"pygments_lexer": "ipython3",
312-
"version": "3.10.11"
312+
"version": "3.11.7"
313313
}
314314
},
315315
"nbformat": 4,

examples/notebooks/voltage-regulator/publish_waveforms.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,14 @@
240240
"condition = next(iter(conditions), None)\n",
241241
"condition_values = []\n",
242242
"if condition is not None:\n",
243-
" condition_data = data_store_client.read_data(condition, expected_type=Vector)\n",
243+
" condition_data = data_store_client.read_condition_value(condition, expected_type=Vector)\n",
244244
" units = condition_data.units\n",
245245
" for val in condition_data:\n",
246246
" condition_values.append(str(val) + units)\n",
247247
"measurements = data_store_client.query_measurements(odata_query=f\"$filter=stepid eq {step_id}\")\n",
248248
"sorted_measurements = sorted(measurements, key=lambda m: m.parametric_index)\n",
249249
"for measurement in sorted_measurements:\n",
250-
" waveform = data_store_client.read_data(measurement, expected_type=AnalogWaveform)\n",
250+
" waveform = data_store_client.read_measurement_value(measurement, expected_type=AnalogWaveform)\n",
251251
" color = colors[measurement.parametric_index]\n",
252252
" timing = waveform.timing\n",
253253
" fig.add_trace(go.Scatter(\n",

examples/overview/poetry.lock

Lines changed: 38 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/overview/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ grpcio-tools = [
5555
types-grpcio = ">=1.0"
5656
types-protobuf = ">=4.21"
5757
# Uncomment to use local ni-datastore code
58-
# ni-datastore = {path = "../..", develop = true}
58+
ni-datastore = {path = "../..", develop = true}
5959
datastore-utilities = { path = "../../utilities", develop = true }
6060

6161
[tool.poetry.group.lint.dependencies]

examples/overview/src/overview.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ def query_data(published_measurement_id: str) -> None:
111111
operator = metadata_store_client.get_operator(test_result.operator_id)
112112
print(f"operator: {operator}")
113113

114-
waveform = data_store_client.read_data(found_measurement, expected_type=AnalogWaveform)
114+
waveform = data_store_client.read_measurement_value(
115+
found_measurement, expected_type=AnalogWaveform
116+
)
115117
print(f"published data is: {waveform.raw_data}")
116118

117119

0 commit comments

Comments
 (0)