Background
Measures are the fundamental building block of the grid builder. More specifically a measure is a datapoint or set of datapoints that relates to a serial number either at the process entry level or component instance level:- Process Entry Level: data related to a serial number via ****a process entry
- Component Instance Level: data that’s inherently tied to the serial number via the
unique_identifierstable
Measures Context
To utilize measures anywhere in the app you can wrap components in a<MeasuresProvider>
useMeasures hook to access the context
Identifying Measures
Since measures currently aren’t stored in any table they don’t have a primary key. Instead we identify measures either through aMeasureKey object or a hash of that object:
Loading Measures
Interface
ThehandleAddSelectedKey method from useMeasures adds a new measure key to the list of selected measure keys and triggers loading in the data. the <MeasureKeySelector> component can also be used to tho this and comes with a pre-built UI
Under the Hood
UniqueIdentifierWithMeasures
When a new measure key gets added to the selectedMeasureKeys list, this triggers a fetches which load data into uniqueIdentifiersWithMeasures, the list of component instances of the selected component, which is of type UniqueIdentifierWithMeasures
- When the component ID is provided to the measures provider, it loads the component instances of that component as well as a genealogy object containing component instances and links (basically the nodes and edges in the tree). This information exists before any measure keys are selected
- After a measure key is added, the measures provider fetches all the data for that measure and then inserts the data into the
measuresarrays inuniqueIdentifiersWithMeasures. Note that thesemeasuresarrays are build of objects containing the measure key andvaluesByIdentifier- a map ofuniqueIdentifierIdtoMeasureValuesWithAggregation. The reason for this is any given measure might apply to one or more members or the root component instance’s genealogy. For example a Drone might have 4 motors. If we want to load motor Max RPM onto the done, we’d be loading a single measure onto 4 members of the drone. In this case each drone’svaluesByIdentifierobject for the Max RPM measure key would have 4 key value pairs:
MeasureValuesWithAggregation
As you may have noted, valuesByIdentifier is not as simple as mapping a UUID to a string / number. Here we’re mapping a UUID to yet another object of type MeasureValuesWithAggregation. There are two reasons for needing this additional complexity:
- A particular measure might have several retests even for a particular component instance. In the case of the drone motors, the process measuring Max RPM may have been run multiple times.
- The data being loaded is often more complex than just a string or a number, it often has additional metadata like pass/fail, USL, LSL, unit, a linked UUID, etc.
MeasureValuesWithAggregation:
MeasureKey. Aggregations can be one of the following:
Filtering and Sorting Measures
The measures system provides robust filtering and sorting capabilities to help users analyze data effectively.Filtering
Filtering is implemented using thefilterBy array in the measures context. Each filter condition is represented by a MeasureFilterCondition object:
setFilterBy function from the useMeasures hook. The testFilter function in filters.ts evaluates these conditions against the measure values.
Sorting
Sorting is handled through thesortBy array in the measures context. Each sort condition is defined by a MeasureSortCondition:
setSortBy function from useMeasures can be used to update the sort order.
Displaying Measures
Grid View
TheMeasuresGrid component provides a tabular view of measures data. It utilizes AG Grid for efficient rendering and supports features like:
- Custom cell rendering based on measure type
- Handling of blank data with explanations
- Support for retests and aggregations
Graph View
For visualizing measure data, the system includesMeasuresGraphScatter and MeasuresGraphLine components. These leverage charting libraries to display data trends and relationships between different measures.
Advanced Features
Time Operators
Time operators allow for temporal analysis of measures. They can be set using theMeasureTimeOperator interface:
MeasureKeyTimeOperatorModal component provides a UI for configuring these operators.
Aggregations
Besides theMeasureAggregationOperator used for individual measures, the system also supports group aggregations through the GroupAggregationOperator:

