Reference source · 0.1.0-dev.11
archive.schema.json
schemas/archive.schema.json · Download original file
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "urn:oprp:experimental:0.1:archive",
"title": "OPRP reference full archive and encrypted backup",
"description": "Structural legacy/expanded archive format. Source signature, digests, patient membership, receipt binding, clinical history and profile limitations require separate verification.",
"oneOf": [
{
"$ref": "#/$defs/archive"
},
{
"$ref": "#/$defs/encryptedBackup"
}
],
"$defs": {
"archive": {
"type": "object",
"additionalProperties": false,
"required": [
"payload",
"signature",
"source_credential",
"status_evidence"
],
"properties": {
"payload": {
"$ref": "./exchange.schema.json#/$defs/base64url",
"maxLength": 699051
},
"signature": {
"$ref": "./exchange.schema.json#/$defs/base64url",
"minLength": 4412,
"maxLength": 4412
},
"source_credential": {
"$ref": "./exchange.schema.json#/$defs/credential"
},
"status_evidence": {
"$ref": "./trust.schema.json#/$defs/signedStatus"
}
}
},
"encryptedBackup": {
"type": "object",
"additionalProperties": false,
"required": [
"v",
"suite",
"nonce",
"ciphertext",
"tag"
],
"properties": {
"v": {
"const": "0.1"
},
"suite": {
"const": "OPRP-BACKUP-A256GCM"
},
"nonce": {
"$ref": "./exchange.schema.json#/$defs/base64url",
"minLength": 16,
"maxLength": 16
},
"ciphertext": {
"$ref": "./exchange.schema.json#/$defs/base64url",
"maxLength": 1100000
},
"tag": {
"$ref": "./exchange.schema.json#/$defs/base64url",
"minLength": 22,
"maxLength": 22
}
}
},
"manifest": {
"type": "object",
"additionalProperties": false,
"required": [
"v",
"profile",
"archive_id",
"source",
"patient",
"created_at",
"credential_digest",
"resources",
"receipts",
"retained_events",
"audits",
"prior_archives",
"coverage",
"content_digest"
],
"properties": {
"v": {
"const": "0.1"
},
"profile": {
"enum": [
"oprp-reference-r4-patient-labs",
"oprp-reference-r4-expanded"
]
},
"archive_id": {
"$ref": "./exchange.schema.json#/$defs/identifier"
},
"source": {
"$ref": "./exchange.schema.json#/$defs/identifier"
},
"patient": {
"$ref": "./exchange.schema.json#/$defs/identifier"
},
"created_at": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"credential_digest": {
"$ref": "./exchange.schema.json#/$defs/base64url"
},
"resources": {
"type": "array",
"minItems": 1,
"maxItems": 1000,
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"resource",
"version",
"digest"
],
"properties": {
"resource": {
"type": "object"
},
"version": {
"type": "integer",
"minimum": 1,
"maximum": 9007199254740991
},
"digest": {
"$ref": "./exchange.schema.json#/$defs/base64url"
},
"deleted": {
"const": true
}
}
}
},
"receipts": {
"type": "array",
"maxItems": 1000,
"items": {
"type": "object"
}
},
"retained_events": {
"type": "array",
"maxItems": 1000,
"items": {
"type": "object"
}
},
"audits": {
"type": "array",
"maxItems": 1000,
"items": {
"type": "object"
}
},
"prior_archives": {
"type": "array",
"maxItems": 1000,
"items": {
"$ref": "#/$defs/archive"
}
},
"coverage": {
"type": "object",
"additionalProperties": false,
"required": [
"complete_record",
"complete_history",
"retry_receipts"
],
"properties": {
"complete_record": {
"const": true
},
"complete_history": {
"const": false
},
"retry_receipts": {
"const": true
}
}
},
"content_digest": {
"$ref": "./exchange.schema.json#/$defs/base64url"
},
"handoffs": {
"type": "array",
"maxItems": 4,
"items": {
"$ref": "./migration.schema.json#/$defs/handoff"
}
},
"clinical_history": {
"type": "array",
"maxItems": 1000,
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"resource",
"version",
"deleted",
"provenance"
],
"properties": {
"resource": {
"type": "object",
"required": [
"resourceType"
],
"properties": {
"resourceType": {
"enum": [
"Condition",
"AllergyIntolerance",
"MedicationStatement",
"Encounter",
"Procedure",
"Immunization"
]
}
},
"additionalProperties": true
},
"version": {
"type": "integer",
"minimum": 1
},
"deleted": {
"type": "boolean"
},
"provenance": {
"type": "object",
"additionalProperties": false,
"required": [
"app",
"actor",
"accepted_at",
"operation_id"
],
"properties": {
"app": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"actor": {
"type": [
"string",
"null"
]
},
"accepted_at": {
"type": "integer",
"minimum": 0
},
"operation_id": {
"type": "string",
"minLength": 1,
"maxLength": 200
}
}
}
}
}
}
},
"allOf": [
{
"if": {
"properties": {
"profile": {
"const": "oprp-reference-r4-expanded"
}
}
},
"then": {
"required": [
"clinical_history"
]
}
}
]
}
}
}