603 lines
19 KiB
JSON
603 lines
19 KiB
JSON
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"$id": "https://example.com/schema/procedure.json",
|
|
"title": "Procedure Configuration Schema",
|
|
"description": "Schema for intelligent calibrator procedure configuration. Structure: Procedure → TestTaskGroup/ResultDisplay → TestActivityGroup → TestAction",
|
|
"type": "object",
|
|
"required": ["procedure", "tables"],
|
|
"properties": {
|
|
"procedure": {
|
|
"type": "object",
|
|
"description": "Main procedure definition",
|
|
"required": ["id", "name", "version", "activitySequence"],
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"description": "Unique procedure identifier"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Procedure display name"
|
|
},
|
|
"version": {
|
|
"type": "string",
|
|
"description": "Procedure version"
|
|
},
|
|
"document": {
|
|
"type": "string",
|
|
"description": "Procedure documentation in HTML/Markdown"
|
|
},
|
|
"metadata": {
|
|
"type": "object",
|
|
"description": "Additional procedure metadata"
|
|
},
|
|
"activitySequence": {
|
|
"type": "array",
|
|
"description": "Top-level activity sequence: testTaskGroups and resultDisplays",
|
|
"items": {
|
|
"anyOf": [
|
|
{ "$ref": "#/$defs/testTaskGroup" },
|
|
{ "$ref": "#/$defs/resultDisplay" },
|
|
{ "$ref": "#/$defs/activityReference" }
|
|
]
|
|
},
|
|
"minItems": 1
|
|
}
|
|
}
|
|
},
|
|
"tables": {
|
|
"type": "object",
|
|
"description": "Reusable table definitions for data storage and display",
|
|
"additionalProperties": { "$ref": "#/$defs/tableDefinition" }
|
|
},
|
|
"testTaskGroups": {
|
|
"type": "object",
|
|
"description": "Reusable test task group definitions",
|
|
"additionalProperties": { "$ref": "#/$defs/testTaskGroup" }
|
|
},
|
|
"testActivityGroups": {
|
|
"type": "object",
|
|
"description": "Reusable test activity group definitions",
|
|
"additionalProperties": { "$ref": "#/$defs/testActivityGroup" }
|
|
},
|
|
"testActions": {
|
|
"type": "object",
|
|
"description": "Reusable test action definitions",
|
|
"additionalProperties": { "$ref": "#/$defs/testAction" }
|
|
},
|
|
"resultDisplays": {
|
|
"type": "object",
|
|
"description": "Reusable result display definitions",
|
|
"additionalProperties": { "$ref": "#/$defs/resultDisplay" }
|
|
},
|
|
"fieldDefinitions": {
|
|
"type": "object",
|
|
"description": "Reusable field definitions for tables",
|
|
"additionalProperties": { "$ref": "#/$defs/fieldDefinition" }
|
|
}
|
|
},
|
|
"$defs": {
|
|
"testTaskGroup": {
|
|
"type": "object",
|
|
"description": "Top-level test task group containing multiple test activity groups",
|
|
"required": ["id", "name", "stages"],
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"description": "Unique test task group identifier"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Test task group display name"
|
|
},
|
|
"metadata": {
|
|
"type": "object",
|
|
"description": "Additional metadata"
|
|
},
|
|
"stages": {
|
|
"type": "array",
|
|
"description": "Ordered sequence of test activity groups (stages)",
|
|
"items": {
|
|
"anyOf": [
|
|
{ "$ref": "#/$defs/testActivityGroup" },
|
|
{ "$ref": "#/$defs/groupReference" }
|
|
]
|
|
},
|
|
"minItems": 1
|
|
}
|
|
}
|
|
},
|
|
"resultDisplay": {
|
|
"type": "object",
|
|
"description": "Result display activity for showing test results",
|
|
"required": ["id"],
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"description": "Unique result display identifier"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Result display title"
|
|
},
|
|
"document": {
|
|
"type": "string",
|
|
"description": "Display instructions in HTML/Markdown"
|
|
},
|
|
"tableRefs": {
|
|
"type": "array",
|
|
"items": { "$ref": "#/$defs/tableReference" }
|
|
}
|
|
}
|
|
},
|
|
"testActivityGroup": {
|
|
"type": "object",
|
|
"description": "Test activity group containing multiple test actions",
|
|
"required": ["id", "name", "actions"],
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"description": "Unique activity group identifier"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Activity group display name"
|
|
},
|
|
"document": {
|
|
"type": "string",
|
|
"description": "Documentation in HTML/Markdown"
|
|
},
|
|
"metadata": {
|
|
"type": "object",
|
|
"description": "Additional metadata"
|
|
},
|
|
"tableRefs": {
|
|
"type": "array",
|
|
"items": { "$ref": "#/$defs/tableReference" }
|
|
},
|
|
"actions": {
|
|
"type": "array",
|
|
"description": "Array of test actions in this group, or references to them",
|
|
"items": {
|
|
"anyOf": [
|
|
{ "$ref": "#/$defs/testAction" },
|
|
{ "$ref": "#/$defs/testActionReference" }
|
|
]
|
|
},
|
|
"minItems": 1
|
|
}
|
|
}
|
|
},
|
|
"testAction": {
|
|
"type": "object",
|
|
"description": "Individual test action (measurement, check, or data acquisition)",
|
|
"required": ["id", "document", "mode"],
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"description": "Unique test action identifier"
|
|
},
|
|
"document": {
|
|
"type": "string",
|
|
"description": "Instructions/documentation in HTML/Markdown"
|
|
},
|
|
"mode": {
|
|
"type": "string",
|
|
"enum": ["manual", "auto"],
|
|
"description": "Execution mode: manual requires user input, auto attempts automatic data acquisition"
|
|
},
|
|
"functionType": {
|
|
"type": "string",
|
|
"description": "Function type for this test action (e.g., RESISTANCE_4WIRE, VOLTAGE_V, etc.)"
|
|
},
|
|
"channel": {
|
|
"type": "string",
|
|
"enum": ["input1", "input2", "output1", "output2"],
|
|
"description": "Channel used for this test action: input1, input2, output1, or output2"
|
|
},
|
|
"functionParameters": {
|
|
"description": "Function-specific parameters as key-value pairs",
|
|
"oneOf": [
|
|
{
|
|
"type": "object"
|
|
},
|
|
{
|
|
"type": "array"
|
|
}
|
|
]
|
|
},
|
|
"metadata": { "type": "object" },
|
|
"dataFields": {
|
|
"type": "array",
|
|
"items": { "$ref": "#/$defs/fieldSelector" }
|
|
},
|
|
"validationCriteria": { "type": "object" },
|
|
"uploadStrategy": {
|
|
"type": "string",
|
|
"enum": ["immediate", "onComplete", "inherit"],
|
|
"default": "inherit",
|
|
"description": "Data upload strategy for this action: immediate (upload after action), onComplete (upload with table), inherit (use table's strategy)"
|
|
},
|
|
"uploadFields": {
|
|
"type": "array",
|
|
"description": "Specific fields to upload immediately after this action completes",
|
|
"items": { "type": "string" }
|
|
}
|
|
},
|
|
"allOf": [
|
|
{
|
|
"oneOf": [
|
|
{
|
|
"properties": { "mode": { "const": "auto" } },
|
|
"required": ["functionType", "functionParameters"],
|
|
"description": "Auto mode check items must define functionType and functionParameters"
|
|
},
|
|
{
|
|
"properties": { "mode": { "const": "manual" } }
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"oneOf": [
|
|
{
|
|
"properties": {
|
|
"functionType": {
|
|
"enum": [
|
|
"DATA_ACQUISITION",
|
|
"DATA_ACQUISITION_WITH_VALIDATION"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{ "required": ["channel"] }
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"tableDefinition": {
|
|
"type": "object",
|
|
"description": "Table definition for data storage (grid or form layout)",
|
|
"required": ["id", "name"],
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"description": "Unique table identifier"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Table display name"
|
|
},
|
|
"description": {
|
|
"type": "string",
|
|
"description": "Table description"
|
|
},
|
|
"tableType": {
|
|
"type": "string",
|
|
"enum": ["grid", "form", "series"],
|
|
"default": "grid",
|
|
"description": "Table layout type: grid for row-column table, form for key-value layout, series for time-series data recording"
|
|
},
|
|
"layoutConfig": {
|
|
"type": "object",
|
|
"description": "Layout configuration for form-type tables",
|
|
"properties": {
|
|
"totalColumns": {
|
|
"type": "integer",
|
|
"default": 12,
|
|
"description": "Total columns in grid system (typically 12)"
|
|
}
|
|
}
|
|
},
|
|
"isShared": { "type": "boolean", "default": false },
|
|
"uploadStrategy": {
|
|
"type": "string",
|
|
"enum": ["immediate", "grouped", "byRow", "onComplete"],
|
|
"default": "onComplete",
|
|
"description": "Data upload strategy: immediate (per field), grouped (per group), byRow (per row), onComplete (entire table)"
|
|
},
|
|
"uploadGroups": {
|
|
"type": "array",
|
|
"description": "Upload groups for grouped upload strategy, supporting field groups or specific cells by row-column position",
|
|
"items": { "$ref": "#/$defs/fieldSelector" }
|
|
},
|
|
"columnHeaders": {
|
|
"type": "array",
|
|
"description": "Column headers for grid-type tables, or references to them",
|
|
"items": {
|
|
"anyOf": [
|
|
{ "$ref": "#/$defs/fieldDefinition" },
|
|
{ "$ref": "#/$defs/fieldDefinitionReference" }
|
|
]
|
|
}
|
|
},
|
|
"rowHeaders": {
|
|
"type": "array",
|
|
"description": "Row headers for grid-type tables",
|
|
"items": {
|
|
"type": "object",
|
|
"required": ["id", "name"],
|
|
"properties": {
|
|
"id": { "type": "string" },
|
|
"name": { "type": "string" }
|
|
}
|
|
}
|
|
},
|
|
"staticCells": {
|
|
"type": "array",
|
|
"description": "Static content entries for tables. Each entry selects one or more cells/fields via fieldSelector and renders fixed text.",
|
|
"items": {
|
|
"type": "object",
|
|
"field": {
|
|
"type": "string",
|
|
"description": "Field ID (for form-type tables)"
|
|
},
|
|
"row": {
|
|
"oneOf": [
|
|
{ "type": "string", "description": "Row ID" },
|
|
{
|
|
"type": "integer",
|
|
"description": "Row index (0-based)"
|
|
}
|
|
]
|
|
},
|
|
"column": {
|
|
"oneOf": [
|
|
{ "type": "string", "description": "Column ID" },
|
|
{
|
|
"type": "integer",
|
|
"description": "Column index (0-based)"
|
|
}
|
|
]
|
|
},
|
|
"content": {
|
|
"type": "string",
|
|
"description": "Static text content to display. When targeting form fields, the field is treated as read-only and shows this fixed value."
|
|
},
|
|
"oneOf": [
|
|
{ "required": ["field", "content"] },
|
|
{ "required": ["row", "column", "content"] }
|
|
]
|
|
}
|
|
},
|
|
"fields": {
|
|
"type": "array",
|
|
"description": "Fields for form-type and time-series tables, or references to them",
|
|
"items": {
|
|
"anyOf": [
|
|
{ "$ref": "#/$defs/fieldDefinition" },
|
|
{ "$ref": "#/$defs/fieldDefinitionReference" }
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"oneOf": [
|
|
{
|
|
"properties": { "tableType": { "const": "form" } },
|
|
"required": ["fields"],
|
|
"description": "Form-type tables must define fields"
|
|
},
|
|
{
|
|
"properties": { "tableType": { "const": "grid" } },
|
|
"required": ["columnHeaders", "rowHeaders"],
|
|
"description": "Grid-type tables must define columnHeaders and rowHeaders"
|
|
},
|
|
{
|
|
"properties": { "tableType": { "const": "series" } },
|
|
"required": ["fields"],
|
|
"description": "Time-series tables must define fields"
|
|
}
|
|
]
|
|
},
|
|
"fieldDefinition": {
|
|
"type": "object",
|
|
"description": "Field definition for table columns or form fields",
|
|
"required": ["id", "name"],
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"description": "Unique field identifier"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Field display name"
|
|
},
|
|
"type": {
|
|
"type": "string",
|
|
"enum": [
|
|
"numeric",
|
|
"text",
|
|
"selection",
|
|
"boolean",
|
|
"datetime",
|
|
"calculated"
|
|
]
|
|
},
|
|
"defaultValue": {
|
|
"description": "Default value for the field"
|
|
},
|
|
"options": {
|
|
"type": "array",
|
|
"description": "Options for selection type fields"
|
|
},
|
|
"formula": {
|
|
"type": "string",
|
|
"description": "Formula for calculated type fields"
|
|
},
|
|
"validationRules": {
|
|
"type": "object",
|
|
"properties": {
|
|
"min": { "type": "number" },
|
|
"max": { "type": "number" },
|
|
"precision": { "type": "integer", "minimum": 0 },
|
|
"pattern": { "type": "string" },
|
|
"minLength": { "type": "integer", "minimum": 0 },
|
|
"maxLength": { "type": "integer", "minimum": 0 },
|
|
"required": { "type": "boolean" }
|
|
}
|
|
},
|
|
"isRequired": { "type": "boolean", "default": false },
|
|
"isReadOnly": { "type": "boolean", "default": false },
|
|
"unit": { "type": "string" },
|
|
"description": { "type": "string" },
|
|
"uploadImmediately": {
|
|
"type": "boolean",
|
|
"default": false,
|
|
"description": "Whether to upload this field immediately after value change"
|
|
},
|
|
"layoutConfig": {
|
|
"type": "object",
|
|
"description": "Layout configuration for form-type tables",
|
|
"properties": {
|
|
"labelSpan": {
|
|
"type": "integer",
|
|
"minimum": 1,
|
|
"maximum": 11,
|
|
"default": 1,
|
|
"description": "Columns occupied by field label"
|
|
},
|
|
"valueSpan": {
|
|
"type": "integer",
|
|
"minimum": 1,
|
|
"maximum": 11,
|
|
"default": 11,
|
|
"description": "Columns occupied by field value"
|
|
},
|
|
"rowSpan": {
|
|
"type": "integer",
|
|
"minimum": 1,
|
|
"default": 1,
|
|
"description": "Rows occupied by this field"
|
|
},
|
|
"order": {
|
|
"type": "integer",
|
|
"description": "Display order in form layout"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"oneOf": [
|
|
{
|
|
"properties": { "type": { "const": "selection" } },
|
|
"required": ["options"],
|
|
"description": "Selection-type fields must define options"
|
|
},
|
|
{
|
|
"properties": { "type": { "const": "calculated" } },
|
|
"required": ["formula"],
|
|
"description": "Calculated-type fields must define formula"
|
|
},
|
|
{
|
|
"properties": {
|
|
"type": {
|
|
"enum": ["numeric", "text", "boolean", "datetime"]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"fieldSelector": {
|
|
"type": "object",
|
|
"description": "Selector for table fields or cells, supporting both form-type (field IDs) and grid-type (row-column positions) tables",
|
|
"properties": {
|
|
"tableRef": { "$ref": "#/$defs/tableReference" },
|
|
"fields": {
|
|
"type": "array",
|
|
"items": { "type": "string" },
|
|
"description": "Array of field IDs (for form-type tables)"
|
|
},
|
|
"cells": {
|
|
"type": "array",
|
|
"description": "Array of specific cells by row-column position (for grid-type tables)",
|
|
"items": {
|
|
"type": "object",
|
|
"required": ["row", "column"],
|
|
"properties": {
|
|
"row": {
|
|
"oneOf": [
|
|
{ "type": "string", "description": "Row ID" },
|
|
{ "type": "integer", "description": "Row index (0-based)" }
|
|
]
|
|
},
|
|
"column": {
|
|
"oneOf": [
|
|
{ "type": "string", "description": "Column ID" },
|
|
{
|
|
"type": "integer",
|
|
"description": "Column index (0-based)"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"ignore": {
|
|
"type": "boolean",
|
|
"default": false,
|
|
"description": "Whether to skip this field when filling table data from function return values"
|
|
}
|
|
},
|
|
"oneOf": [
|
|
{ "required": ["fields"] },
|
|
{ "required": ["cells"] },
|
|
{
|
|
"properties": { "ignore": { "const": true } },
|
|
"required": ["ignore"]
|
|
}
|
|
]
|
|
},
|
|
"activityReference": {
|
|
"type": "object",
|
|
"description": "Reference to a top-level activity (testTaskGroup or resultDisplay)",
|
|
"required": ["$ref"],
|
|
"properties": {
|
|
"$ref": {
|
|
"type": "string",
|
|
"pattern": "^#/(testTaskGroups|resultDisplays)/.+$",
|
|
"description": "JSON Pointer to a testTaskGroup or resultDisplay"
|
|
}
|
|
}
|
|
},
|
|
"groupReference": {
|
|
"type": "object",
|
|
"description": "Reference to a test activity group",
|
|
"required": ["$ref"],
|
|
"properties": {
|
|
"$ref": {
|
|
"type": "string",
|
|
"pattern": "^#/testActivityGroups/.+$",
|
|
"description": "JSON Pointer to a testActivityGroup"
|
|
}
|
|
}
|
|
},
|
|
"testActionReference": {
|
|
"type": "object",
|
|
"description": "Reference to a test action",
|
|
"required": ["$ref"],
|
|
"properties": {
|
|
"$ref": {
|
|
"type": "string",
|
|
"pattern": "^#/testActions/.+$",
|
|
"description": "JSON Pointer to a testAction"
|
|
}
|
|
}
|
|
},
|
|
"fieldDefinitionReference": {
|
|
"type": "object",
|
|
"description": "Reference to a field definition",
|
|
"required": ["$ref"],
|
|
"properties": {
|
|
"$ref": {
|
|
"type": "string",
|
|
"pattern": "^#/fieldDefinitions/.+$",
|
|
"description": "JSON Pointer to a fieldDefinition"
|
|
}
|
|
}
|
|
},
|
|
"tableReference": {
|
|
"type": "string",
|
|
"pattern": "^#/tables/.+$",
|
|
"description": "JSON Pointer to a table definition (e.g., #/tables/myTable)"
|
|
}
|
|
}
|
|
}
|