{
    "$schema": "https://json-schema.org/draft/2020-12/schema#",
    "$vocabulary": {
        "https://json-schema.org/draft/2020-12/vocab/core": true,
        "https://json-schema.org/draft/2020-12/vocab/applicator": true,
        "https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
        "https://json-schema.org/draft/2020-12/vocab/validation": true,
        "https://json-schema.org/draft/2020-12/vocab/meta-data": true,
        "https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
        "https://json-schema.org/draft/2020-12/vocab/content": true
    },
    "$id": "https://www.medbiq.org/standards/curriculum-data-exchange/",
    "title": "Curriculum Inventory",
    "description": "Schema for MedBiq Curriculum Inventory",
    "schemaValidationNotes": [
        {
            "description": "common.schema.json implementation",
            "validated": true
        },
        {
            "description": "properties prefix '_'",
            "validated": true
        },
        {
            "description": "no missing attributes",
            "validated": true
        },
        {
            "description": "validate union types",
            "validated": true
        },
        {
            "description": "Schema validation using XML samples",
            "validated": false
        }
    ],
    "annotations": {
        "changeHistory": [
            "Changed keyword definition. It now uses type string instead of referencing external files."
        ]
    },
    "type": "object",
    "$defs": {
        "NonNullString": {
            "$ref": "http://medbiq.pixelbytellc.com/common.schema.json#/$defs/NonNullStringType"
        },
        "IDDomainType": {
            "type": "string",
            "format": "URI",
            "pattern": "^idd:\\S*:\\S*$"
        },
        "OrderType": {
            "type": "string",
            "enum": ["Ordered", "Unordered", "Parallel"]
        },
        "OneToTen": {
            "type": "integer",
            "exclusiveMinimum": 1,
            "exclusiveMaximum": 10
        },
        "StatusType": {
            "type": "string",
            "enum": ["successful", "unsuccessful"]
        },
        "EventReferenceType": {
            "type": "string",
            "pattern": "^\\s*/CurriculumInventory/Events/Event\\[@id\\s?=\\s?'[^']+'\\]\\s*$"
        },
        "AcademicLevelReferenceType": {
            "type": "string",
            "pattern": "^\\s*/CurriculumInventory/AcademicLevels/Level\\[@number\\s?=\\s?'(\\d|10)'\\]\\s*$"
        },
        "SequenceBlockReferencePatternType": {
            "type": "string",
            "pattern": "^\\s*/CurriculumInventory/Sequence/SequenceBlock\\[@id\\s?=\\s?'[^']+'\\]\\s*$"
        },
        "CompetencyObjectReferenceType": {
            "type": "string",
            "pattern": "^\\s*/CurriculumInventory/Expectations/CompetencyObject\\[lom:lom/lom:general/lom:identifier/lom:entry\\s?=\\s?'[^']+'\\]\\s*$"
        },
        "IntegrationBlockReferenceType": {
            "type": "string",
            "pattern": "^\\s*/CurriculumInventory/Integration/IntegrationBlock\\[@id\\s?=\\s?'[^']+'\\]\\s*$"
        },
        "EventDurationType": {
            "type": "string",
            "pattern": "^PT\\d+H\\d+M|PT\\d+H|PT\\d+M$"
        },
        "OneToHundred": {
            "type": "integer",
            "exclusiveMinimum": 1,
            "exclusiveMaximum": 100
        },
        "ClerkshipModelType": {
            "type": "string",
            "enum": ["integrated", "rotation"]
        },
        "RequiredType": {
            "type": "string",
            "enum": ["Required", "Optional", "Required In Track"]
        },
        "PurposeType": {
            "type": "string",
            "enum": ["Formative", "Summative"]
        },
        "VocabularyTermType": {
            "type": "string",
            "$ref": "#/$defs/NonNullString",
            "properties": {
                "_source": {
                    "type": "string"
                },
                "_sourceID": {
                    "type": "string"
                }
            }
        },
        "LevelType": {
            "type": "object",
            "properties": {
                "_Label": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_Description": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_number": {
                    "$ref": "#/$defs/OneToTen"
                }
            },
            "required": ["_Label", "_number"]
        },
        "AcademicLevelsType": {
            "type": "object",
            "properties": {
                "_LevelsInProgram": {
                    "$ref": "#/$defs/OneToTen"
                },
                "_Level": {
                    "$ref": "#/$defs/LevelType",
                    "type": "array",
                    "maxItems": 10
                }
            }
        },
        "EventsType": {
            "type": "object",
            "properties": {
                "_Event": {
                    "$ref": "#/$defs/EventType",
                    "type": "array"
                }
            }
        },
        "ExpectationsType": {
            "type": "object",
            "properties": {
                "_CompetencyObject": {
                    "$ref": "http://medbiq.pixelbytellc.com/competency-object/competencyobject.schema.json#/$defs/CompetencyObjectType",
                    "type": "array"
                },
                "_CompetencyFramework": {
                    "$ref": "http://medbiq.pixelbytellc.com/competency-framework/competencyframework.schema.json#/$defs/CompetencyFrameworkType",
                    "type": "array"
                }
            },
            "required": ["_CompetencyObject"]
        },
        "SequenceType": {
            "type": "object",
            "properties": {
                "_Description": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_SequenceBLock": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/SequenceBlockType"
                    }
                }
            },
            "required": ["_Description"]
        },
        "DatesType": {
            "type": "object",
            "properties": {
                "_StartDate": {
                    "type": "string",
                    "format": "date"
                },
                "_EndDate": {
                    "type": "string",
                    "format": "date"
                }
            }
        },
        "TimingType": {
            "type": "array",
            "maxItems": 2,
            "items": {
                "oneOf": [
                    {
                        "type": "string",
                        "format": "time"
                    },
                    {
                        "$ref": "#/$defs/DatesType"
                    }
                ]
            }
        },
        "SequenceBlockType": {
            "type": "object",
            "properties": {
                "_Title": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_Description": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_Timing": {
                    "$ref": "#/$defs/TimingType"
                },
                "_Level": {
                    "$ref": "#/$defs/AcademicLevelReferenceType"
                },
                "_ClerkshipModel": {
                    "$ref": "#/$defs/ClerkshipModelType"
                },
                "_CompetencyObjectReference": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/CompetencyObjectReferenceType"
                    }
                },
                "_Precondition": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_Postcondition": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_SequenceBlockEvent": {
                    "$ref": "#/$defs/SequenceBlockEventType"
                },
                "_SequenceBlockReference": {
                    "$ref": "#/$defs/SequenceBlockReferenceType"
                },
                "_id": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_required": {
                    "$ref": "#/$defs/RequiredType"
                },
                "_order": {
                    "$ref": "#/$defs/OrderType"
                },
                "_minimum": {
                    "type": "integer",
                    "exclusiveMinimum": 1
                },
                "_maximum": {
                    "type": "integer"
                },
                "_track": {
                    "type": "boolean",
                    "default": false
                }
            },
            "required": ["_Title", "_Timing", "_Level", "_id", "_required", "_order", "_minimum"]
        },
        "SequenceBlockReferenceType": {
            "$ref": "#/$defs/SequenceBlockReferencePatternType",
            "properties": {
                "_order": {
                    "type": "integer",
                    "exclusiveMinimum": 1
                }
            }
        },
        "IntegrationBlockType": {
            "type": "object",
            "properties": {
                "_Title": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_Description": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_CompetencyObjectReference": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/CompetencyObjectReferenceType"
                    }
                },
                "_EventReference": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/EventReferenceType"
                    }
                },
                "_SequenceBlockReference": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/SequenceBlockReferenceType"
                    }
                },
                "_id": {
                    "$ref": "#/$defs/NonNullString"
                }
            },
            "required": ["_Title", "_id"]
        },
        "IntegrationType": {
            "type": "object",
            "properties": {
                "_Description": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_IntegrationBlock": {
                    "$ref": "#/$defs/IntegrationBlockType"
                }
            },
            "required": ["_IntegrationBlock"]
        },
        "NonNullStringWithId": {
            "$ref": "#/$defs/NonNullString",
            "properties": {
                "_id": {
                    "type": "string"
                }
            }
        },
        "DomainID": {
            "type": "object",
            "properties": {
                "_domain": {
                    "$ref": "#/$defs/IDDomainType"
                }
            }
        },
        "ProgramType": {
            "type": "object",
            "properties": {
                "_ProgramName": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_ProgramID": {
                    "$ref": "#/$defs/DomainID"
                },
                "_EducationalContext": {
                    "$ref": "#/$defs/contextValues"
                },
                "_Profession": {
                    "$ref": "#/$defs/VocabularyTermType"
                },
                "_Specialty": {
                    "$ref": "#/$defs/VocabularyTermType"
                }
            },
            "required": ["_ProgramName", "_ProgramID"]
        },
        "SequenceBlockEventType": {
            "type": "object",
            "properties": {
                "_EventReference": {
                    "$ref": "#/$defs/EventReferenceType"
                },
                "_StartDate": {
                    "type": "string",
                    "format": "date"
                },
                "_EndDate": {
                    "type": "string",
                    "format": "date"
                },
                "_required": {
                    "type": "boolean"
                }
            },
            "required": ["_EventReference", "_required"]
        },
        "ObjectType": {
            "type": "object",
            "properties": {
                "_CompetencyObject": {
                    "$ref": "http://medbiq.pixelbytellc.com/competency-object/competencyobject.schema.json#/$defs/CompetencyObjectType"
                }
            }
        },
        "AssessmentMethodType": {
            "type": "object",
            "properties": {
                "_purpose": {
                    "$ref": "#/$defs/PurposeType"
                },
                "_source": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_sourceID": {
                    "$ref": "#/$defs/NonNullString"
                }
            },
            "required": ["_purpose"]
        },
        "InstructionalMethodType": {
            "type": "object",
            "properties": {
                "_primary": {
                    "type": "boolean"
                },
                "_source": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_sourceID": {
                    "$ref": "#/$defs/NonNullString"
                }
            },
            "required": ["_primary"]
        },
        "EventType": {
            "type": "object",
            "properties": {
                "_Title": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_EventDuration": {
                    "$ref": "#/$defs/EventDurationType"
                },
                "_Description": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_Keyword": {
                    "type": "array",
                    "items": {
                        "type": "string",
                        "additionalProperties": false
                    }
                },
                "_Interprofessional": {
                    "type": "boolean",
                    "default": false
                },
                "_CompetencyObjectReference": {
                    "items": {
                        "$ref": "#/$defs/CompetencyObjectReferenceType"
                    },
                    "type": "array"
                },
                "_ResourceType": {
                    "items": {
                        "$ref": "#/$defs/VocabularyTermType"
                    },
                    "type": "array"
                },
                "_InstructionalMethod": {
                    "$ref": "#/$defs/InstructionalMethodType"
                },
                "_AssessmentMethod": {
                    "$ref": "#/$defs/AssessmentMethodType"
                },
                "_id": {
                    "$ref": "#/$defs/NonNullString"
                }
            },
            "required": ["_Title", "_EventDuration", "_id"]
        },
        "CurriculumInventoryType": {
            "type": "object",
            "properties": {
                "_ReportID": {
                    "$ref": "#/$defs/DomainID"
                },
                "_Institution": {
                    "$ref": "http://medbiq.pixelbytellc.com/professional-profile/member.schema.json#/$defs/InstitutionInfoType"
                },
                "_Program": {
                    "$ref": "#/$defs/ProgramType"
                },
                "_Title": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_ReportDate": {
                    "type": "string",
                    "format": "date"
                },
                "_ReportingStartDate": {
                    "type": "string",
                    "format": "date"
                },
                "_ReportingEndDate": {
                    "type": "string",
                    "format": "date"
                },
                "_Language": {
                    "type": "string",
                    "pattern": "^[a-zA-Z]{2,8}(-[a-zA-Z]{2,8})*$"
                },
                "_Description": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_SupportingLink": {
                    "type": "string",
                    "format": "URI"
                },
                "_Events": {
                    "$ref": "#/$defs/EventsType"
                },
                "_Expectations": {
                    "$ref": "#/$defs/ExpectationsType"
                },
                "_AcademicLevels": {
                    "$ref": "#/$defs/AcademicLevelsType"
                },
                "_Sequence": {
                    "$ref": "#/$defs/SequenceType"
                },
                "_Integration": {
                    "$ref": "#/$defs/IntegrationType"
                },
                "_other": {
                    "type": "array",
                    "items": {
                        "type": "object"
                    },
                    "additionalProperties": true
                }
            },
            "required": [
                "_ReportID",
                "_Institution",
                "_Program",
                "_Title",
                "_ReportDate",
                "_ReportingStartDate",
                "_ReportingEndDate",
                "_Language",
                "_Description",
                "_Events",
                "_Expectations",
                "_AcademicLevels"
            ]
        },
        "contextValues": {
            "type": "string",
            "enum": [
                "patient education",
                "caregiver education",
                "primary education",
                "secondary education",
                "vocational training",
                "undergraduate education",
                "undergraduate professional education",
                "graduate professional education",
                "continuing professional development"
            ]
        }
    },
    "properties": {
        "CurriculumInventory": {
            "$ref": "#/$defs/CurriculumInventoryType"
        }
    }
}
