| { |
| "$schema": "https://json-schema.org/draft/2020-12/schema", |
| "$id": "schedule-parser-schema-v1", |
| "title": "PocketTrials fallback schedule parser output", |
| "type": "object", |
| "additionalProperties": false, |
| "required": [ |
| "schema_version", |
| "status", |
| "reference_event", |
| "phases", |
| "window", |
| "issues", |
| "overall_confidence" |
| ], |
| "properties": { |
| "schema_version": {"const": "schedule-parser-schema-v1"}, |
| "status": {"enum": ["parsed", "ambiguous", "unsupported"]}, |
| "reference_event": {"$ref": "#/$defs/inferenceReferenceEvent"}, |
| "phases": { |
| "type": "array", |
| "maxItems": 4, |
| "items": {"$ref": "#/$defs/inferencePhase"} |
| }, |
| "window": { |
| "oneOf": [ |
| {"type": "null"}, |
| {"$ref": "#/$defs/inferenceWindow"} |
| ] |
| }, |
| "issues": { |
| "type": "array", |
| "items": {"$ref": "#/$defs/inferenceIssue"} |
| }, |
| "overall_confidence": {"type": "number", "minimum": 0, "maximum": 1} |
| }, |
| "$defs": { |
| "unit": {"enum": ["day", "week", "month", "year"]}, |
| "referenceType": { |
| "enum": [ |
| "C1D1", |
| "REGISTRATION", |
| "RANDOMIZATION", |
| "TREATMENT_START", |
| "ENROLLMENT", |
| "OTHER", |
| "UNSPECIFIED" |
| ] |
| }, |
| "expected": { |
| "type": "object", |
| "additionalProperties": false, |
| "required": ["status", "reference_event", "phases", "window", "issues"], |
| "properties": { |
| "status": {"enum": ["parsed", "ambiguous", "unsupported"]}, |
| "reference_event": {"$ref": "#/$defs/expectedReferenceEvent"}, |
| "phases": { |
| "type": "array", |
| "maxItems": 4, |
| "items": {"$ref": "#/$defs/expectedPhase"} |
| }, |
| "window": { |
| "oneOf": [ |
| {"type": "null"}, |
| {"$ref": "#/$defs/expectedWindow"} |
| ] |
| }, |
| "issues": { |
| "type": "array", |
| "uniqueItems": true, |
| "items": {"type": "string", "minLength": 1} |
| } |
| } |
| }, |
| "expectedReferenceEvent": { |
| "type": "object", |
| "additionalProperties": false, |
| "required": ["type", "source_text"], |
| "properties": { |
| "type": {"$ref": "#/$defs/referenceType"}, |
| "source_text": {"type": ["string", "null"]} |
| } |
| }, |
| "expectedInterval": { |
| "type": "object", |
| "additionalProperties": false, |
| "required": ["value", "unit", "source_text"], |
| "properties": { |
| "value": {"type": "number", "exclusiveMinimum": 0}, |
| "unit": {"$ref": "#/$defs/unit"}, |
| "source_text": {"type": "string", "minLength": 1} |
| } |
| }, |
| "expectedBoundary": { |
| "type": "object", |
| "additionalProperties": false, |
| "required": ["type", "value", "unit", "source_text"], |
| "properties": { |
| "type": {"enum": ["absolute", "duration", "indefinite"]}, |
| "value": {"type": ["number", "null"]}, |
| "unit": { |
| "oneOf": [{"$ref": "#/$defs/unit"}, {"type": "null"}] |
| }, |
| "source_text": {"type": ["string", "null"]} |
| } |
| }, |
| "expectedPhase": { |
| "type": "object", |
| "additionalProperties": false, |
| "required": ["interval", "boundary"], |
| "properties": { |
| "interval": {"$ref": "#/$defs/expectedInterval"}, |
| "boundary": {"$ref": "#/$defs/expectedBoundary"} |
| } |
| }, |
| "expectedWindow": { |
| "type": "object", |
| "additionalProperties": false, |
| "required": ["before_days", "after_days", "source_text"], |
| "properties": { |
| "before_days": {"type": "integer", "minimum": 0}, |
| "after_days": {"type": "integer", "minimum": 0}, |
| "source_text": {"type": "string", "minLength": 1} |
| } |
| }, |
| "confidence": {"type": "number", "minimum": 0, "maximum": 1}, |
| "inferenceReferenceEvent": { |
| "type": "object", |
| "additionalProperties": false, |
| "required": ["type", "source_text", "confidence"], |
| "properties": { |
| "type": {"$ref": "#/$defs/referenceType"}, |
| "source_text": {"type": ["string", "null"]}, |
| "confidence": {"$ref": "#/$defs/confidence"} |
| } |
| }, |
| "inferenceInterval": { |
| "type": "object", |
| "additionalProperties": false, |
| "required": ["value", "unit", "source_text", "confidence"], |
| "properties": { |
| "value": {"type": "number", "exclusiveMinimum": 0}, |
| "unit": {"$ref": "#/$defs/unit"}, |
| "source_text": {"type": "string"}, |
| "confidence": {"$ref": "#/$defs/confidence"} |
| } |
| }, |
| "inferenceBoundary": { |
| "type": "object", |
| "additionalProperties": false, |
| "required": ["type", "value", "unit", "source_text", "confidence"], |
| "properties": { |
| "type": {"enum": ["absolute", "duration", "indefinite"]}, |
| "value": {"type": ["number", "null"]}, |
| "unit": { |
| "oneOf": [{"$ref": "#/$defs/unit"}, {"type": "null"}] |
| }, |
| "source_text": {"type": ["string", "null"]}, |
| "confidence": {"$ref": "#/$defs/confidence"} |
| } |
| }, |
| "inferencePhase": { |
| "type": "object", |
| "additionalProperties": false, |
| "required": ["interval", "boundary", "confidence"], |
| "properties": { |
| "interval": {"$ref": "#/$defs/inferenceInterval"}, |
| "boundary": {"$ref": "#/$defs/inferenceBoundary"}, |
| "confidence": {"$ref": "#/$defs/confidence"} |
| } |
| }, |
| "inferenceWindow": { |
| "type": "object", |
| "additionalProperties": false, |
| "required": ["before_days", "after_days", "source_text", "confidence"], |
| "properties": { |
| "before_days": {"type": "integer", "minimum": 0}, |
| "after_days": {"type": "integer", "minimum": 0}, |
| "source_text": {"type": "string"}, |
| "confidence": {"$ref": "#/$defs/confidence"} |
| } |
| }, |
| "inferenceIssue": { |
| "type": "object", |
| "additionalProperties": false, |
| "required": ["type", "message", "source_text", "confidence"], |
| "properties": { |
| "type": {"type": "string", "minLength": 1}, |
| "message": {"type": "string", "minLength": 1}, |
| "source_text": {"type": ["string", "null"]}, |
| "confidence": {"$ref": "#/$defs/confidence"} |
| } |
| } |
| } |
| } |
|
|
|
|