deepstack-api-v2-contracts / schemas /evidence-pack-items.schema.json
mcauduro's picture
DeepStack API v2 contracts, package 7726f3ef2d6c (CC-BY-4.0)
1e3bc19 verified
Raw History Blame Contribute Delete
3.36 kB
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "evidence-pack-items.schema.json",
"title": "EvidencePackItems",
"description": "The items an EvidencePackRef binds: content_hash is sha256 (ml-v1 canonical) of {as_of, policy_version, phase, items} exactly as listed here, so the record is verifiable against its ref without the search. Items travel beside the ref (the stream's evidence event, a cache), never inside it. Only what passed the time and rights filters is here; rank is the position after fusion and reranking.",
"type": "object",
"additionalProperties": false,
"required": ["schema_version", "pack_id", "content_hash", "as_of", "policy_version", "phase", "items"],
"properties": {
"schema_version": { "$ref": "common.schema.json#/$defs/schema_version" },
"pack_id": { "$ref": "common.schema.json#/$defs/id" },
"content_hash": { "$ref": "common.schema.json#/$defs/sha256" },
"as_of": { "$ref": "common.schema.json#/$defs/utc" },
"policy_version": { "$ref": "common.schema.json#/$defs/id" },
"phase": { "$ref": "common.schema.json#/$defs/phase" },
"items": {
"type": "array",
"items": { "$ref": "#/$defs/item" }
}
},
"$defs": {
"clock": {
"description": "An instant in UTC, or a day (the motor's availability clock has day precision; a day resolves to its END, 23:59:59.999999 UTC, so a point-in-time cut earlier that day excludes it).",
"type": "string",
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|\\+00:00))?$"
},
"optional_clock": {
"type": ["string", "null"],
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|\\+00:00))?$"
},
"item": {
"type": "object",
"additionalProperties": false,
"required": ["evidence_id", "source_id", "source_url", "span", "clocks", "rights_purposes", "polarity", "lang", "rank", "score", "reasons"],
"properties": {
"evidence_id": { "$ref": "common.schema.json#/$defs/id" },
"source_id": { "$ref": "common.schema.json#/$defs/id" },
"source_url": { "$ref": "common.schema.json#/$defs/https_url" },
"span": { "type": "string", "minLength": 1, "maxLength": 600 },
"clocks": {
"type": "object",
"additionalProperties": false,
"required": ["available_at", "published_at", "captured_at"],
"properties": {
"available_at": { "$ref": "#/$defs/clock" },
"published_at": { "$ref": "#/$defs/optional_clock" },
"captured_at": { "$ref": "#/$defs/optional_clock" }
}
},
"rights_purposes": {
"type": "array",
"uniqueItems": true,
"items": { "enum": ["read", "process", "external_provider", "train", "retain", "publish"] }
},
"polarity": {
"description": "common.schema.json#/$defs/polarity, or null when the passage carries no stance.",
"enum": ["bull", "bear", "neutral", null]
},
"lang": { "type": ["string", "null"], "pattern": "^[a-z]{2}$" },
"rank": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
"score": { "type": "number" },
"reasons": { "type": "array", "items": { "type": "string", "maxLength": 64 } }
}
}
}
}