|
| 1 | +{ |
| 2 | + "$schema": "https://json-schema.org/draft/2020-12/schema", |
| 3 | + "$id": "https://reva.local/contracts/bdx-review-payload.schema.json", |
| 4 | + "title": "BdxReviewPayload", |
| 5 | + "type": "object", |
| 6 | + "required": ["document", "sourceSpans", "fields", "lineItems", "reconciliation"], |
| 7 | + "additionalProperties": false, |
| 8 | + "$defs": { |
| 9 | + "bbox": { "type": "object", "required": ["x", "y", "width", "height"], "additionalProperties": false, "properties": { "x": { "type": "number", "minimum": 0, "maximum": 1 }, "y": { "type": "number", "minimum": 0, "maximum": 1 }, "width": { "type": "number", "minimum": 0, "maximum": 1 }, "height": { "type": "number", "minimum": 0, "maximum": 1 } } }, |
| 10 | + "point": { "type": "object", "required": ["x", "y"], "additionalProperties": false, "properties": { "x": { "type": "number", "minimum": 0, "maximum": 1 }, "y": { "type": "number", "minimum": 0, "maximum": 1 } } }, |
| 11 | + "citation": { "type": "object", "required": ["sourceSpanId", "page", "bbox", "role"], "additionalProperties": false, "properties": { "sourceSpanId": { "type": "string", "minLength": 1 }, "page": { "type": "integer", "minimum": 1 }, "bbox": { "$ref": "#/$defs/bbox" }, "quote": { "type": ["string", "null"] }, "role": { "enum": ["value", "label", "header", "row", "control-total", "supporting"] } } }, |
| 12 | + "provenance": { "type": "object", "required": ["method", "stepId", "citations"], "additionalProperties": false, "properties": { "method": { "enum": ["digital_parse", "csv_parse", "excel_parse", "paddle_ocr", "schema_mapping", "llm_proposal", "merge", "manual"] }, "stepId": { "type": "string", "minLength": 1 }, "model": { "type": ["string", "null"] }, "promptVersion": { "type": ["string", "null"] }, "citations": { "type": "array", "items": { "$ref": "#/$defs/citation" } } } }, |
| 13 | + "fieldValue": { "type": "object", "required": ["key", "label", "value", "status", "confidence", "provenance"], "additionalProperties": false, "properties": { "key": { "type": "string" }, "label": { "type": "string" }, "value": { "type": "string" }, "rawText": { "type": ["string", "null"] }, "status": { "enum": ["detected", "expected", "missing", "conflict", "low_confidence", "user_confirmed"] }, "confidence": { "type": "number", "minimum": 0, "maximum": 1 }, "provenance": { "$ref": "#/$defs/provenance" } } } |
| 14 | + }, |
| 15 | + "properties": { |
| 16 | + "document": { "type": "object", "required": ["id", "filename", "pages"], "additionalProperties": false, "properties": { "id": { "type": "string" }, "filename": { "type": "string" }, "pages": { "type": "array", "items": { "type": "object", "required": ["page", "imageUrl", "width", "height", "rotation"], "additionalProperties": false, "properties": { "page": { "type": "integer", "minimum": 1 }, "imageUrl": { "type": "string" }, "width": { "type": "number" }, "height": { "type": "number" }, "rotation": { "enum": [0, 90, 180, 270] } } } } } }, |
| 17 | + "sourceSpans": { "type": "array", "items": { "type": "object", "required": ["id", "documentId", "page", "pageWidth", "pageHeight", "rotation", "bbox", "text"], "additionalProperties": false, "properties": { "id": { "type": "string" }, "documentId": { "type": "string" }, "page": { "type": "integer", "minimum": 1 }, "pageWidth": { "type": "number" }, "pageHeight": { "type": "number" }, "rotation": { "enum": [0, 90, 180, 270] }, "bbox": { "$ref": "#/$defs/bbox" }, "polygon": { "type": "array", "items": { "$ref": "#/$defs/point" } }, "text": { "type": "string" }, "ocrConfidence": { "type": ["number", "null"], "minimum": 0, "maximum": 1 }, "blockId": { "type": ["string", "null"] }, "tableId": { "type": ["string", "null"] }, "rowIndex": { "type": ["integer", "null"], "minimum": 0 }, "columnIndex": { "type": ["integer", "null"], "minimum": 0 } } } }, |
| 18 | + "fields": { "type": "array", "items": { "$ref": "#/$defs/fieldValue" } }, |
| 19 | + "lineItems": { "type": "array", "items": { "type": "object", "required": ["id", "rowNumber", "fields", "rowCitationIds"], "additionalProperties": false, "properties": { "id": { "type": "string" }, "rowNumber": { "type": "integer", "minimum": 1 }, "fields": { "type": "array", "items": { "$ref": "#/$defs/fieldValue" } }, "rowCitationIds": { "type": "array", "items": { "type": "string" } } } } }, |
| 20 | + "reconciliation": { "type": "array", "items": { "type": "object", "required": ["id", "name", "expected", "detected", "delta", "tolerance", "status", "explanation", "citations"], "additionalProperties": false, "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "expected": { "$ref": "#/$defs/fieldValue" }, "detected": { "$ref": "#/$defs/fieldValue" }, "delta": { "type": "number" }, "tolerance": { "type": "number" }, "status": { "enum": ["pass", "fail", "warning", "not_applicable"] }, "explanation": { "type": "string" }, "citations": { "type": "array", "items": { "$ref": "#/$defs/citation" } } } } } |
| 21 | + } |
| 22 | +} |
0 commit comments