feat: standardize algorithm measurement results

This commit is contained in:
2026-08-14 00:12:53 +08:00
parent ac1387debc
commit 185dd36bf3
15 changed files with 1273 additions and 19 deletions

View File

@@ -0,0 +1,115 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://massive-cloud.local/schemas/algorithm-measurement-result-1.0.json",
"title": "宏量点云算法测量结果输出契约 1.0",
"type": "object",
"required": ["schemaVersion", "measurementContractVersion", "status"],
"properties": {
"schemaVersion": { "type": "integer", "minimum": 1 },
"measurementContractVersion": { "const": "1.0" },
"status": { "enum": ["completed", "error"] },
"message": { "type": "string" },
"context": {
"type": "object",
"properties": {
"inspectionObject": {
"type": "string",
"pattern": "^[a-z][a-z0-9_-]*$"
},
"inspectionObjectName": { "type": "string", "minLength": 1 }
},
"additionalProperties": true
},
"measurements": {
"type": "array",
"items": { "$ref": "#/$defs/measurement" }
},
"errorStats": { "type": "object" },
"overlay3d": { "type": "object" },
"images": {
"type": "array",
"items": { "type": "string", "minLength": 1 }
},
"files": {
"type": "array",
"items": { "type": "string", "minLength": 1 }
},
"derivedPointClouds": { "type": "array" },
"extra": {
"type": "object",
"properties": {
"intermediateMetrics": {
"type": "array",
"items": { "$ref": "#/$defs/intermediateMetric" }
}
},
"additionalProperties": true
}
},
"allOf": [
{
"if": {
"properties": { "status": { "const": "completed" } },
"required": ["status"]
},
"then": { "required": ["measurements"] }
}
],
"additionalProperties": true,
"$defs": {
"metricCode": {
"type": "string",
"pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)*$"
},
"measurement": {
"type": "object",
"required": ["taskNo", "metricCode", "name", "value", "status"],
"properties": {
"taskNo": {
"type": "string",
"pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$"
},
"metricCode": { "$ref": "#/$defs/metricCode" },
"name": {
"type": "string",
"minLength": 1,
"not": { "pattern": "^任务\\s*[0-9]+" }
},
"position": { "type": "string", "minLength": 1 },
"value": { "type": ["number", "null"] },
"unit": { "type": "string", "minLength": 1 },
"theoreticalValue": { "type": "number" },
"baseline": { "type": "number", "exclusiveMinimum": 0 },
"tolerance": { "type": "number", "minimum": 0 },
"toleranceLower": { "type": "number" },
"toleranceUpper": { "type": "number" },
"toleranceLabel": { "type": "string", "minLength": 1 },
"status": { "enum": ["pass", "warning", "fail"] },
"qualityFlags": {
"type": "array",
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
}
},
"additionalProperties": true
},
"intermediateMetric": {
"type": "object",
"required": ["metricCode", "name", "value"],
"properties": {
"metricCode": { "$ref": "#/$defs/metricCode" },
"name": { "type": "string", "minLength": 1 },
"value": { "type": ["number", "null"] },
"unit": { "type": "string", "minLength": 1 }
},
"not": {
"anyOf": [
{ "required": ["taskNo"] },
{ "required": ["status"] },
{ "required": ["tolerance"] }
]
},
"additionalProperties": true
}
}
}