{
    "$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/educational-achievement",
    "title": "Educational Achievement",
    "description": "Schema for MedBiq Educational Achievement",
    "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
        }
    ],
    "type": "object",
    "$defs": {
        "NonNullStringType": {
            "$ref": "http://medbiq.pixelbytellc.com/common.schema.json#/$defs/NonNullStringType"
        },
        "NonNullLanguageStringType": {
            "$ref": "http://medbiq.pixelbytellc.com/common.schema.json#/$defs/NonNullLanguageStringType"
        },
        "ReferenceType": {
            "$ref": "http://medbiq.pixelbytellc.com/common.schema.json#/$defs/ReferenceType"
        },
        "EmbeddedCompetencyType": {
            "type": "string",
            "pattern": "\\s*/EducationalAchievement/AchievementInContext/Expectations/CompetencyObject\\[lom:lom/lom:general/lom:identifier/lom:entry\\s?=\\s?'[^']+'\\]\\s*"
        },
        "AcademicLevelReferenceType": {
            "type": "string",
            "pattern": "\\s*/EducationalAchievement/AchievementInContext/AcademicLevels/Level\\[@number\\s?=\\s?'(\\d|10)'\\]"
        },
        "SequenceBlockReferenceType": {
            "type": "string",
            "pattern": "\\s*/EducationalAchievement/AchievementInContext/Sequence/SequenceBlock\\[@id\\s?=\\s?'[^']+'\\]\\s*"
        },
        "EventReferenceType": {
            "type": "string",
            "pattern": "\\s*/EducationalAchievement/AchievementInContext/Events/Event\\[@id\\s?=\\s?'[^']*'\\]\\s*"
        },
        "PerformanceFrameworkReferenceType": {
            "type": "string",
            "pattern": "\\s*/EducationalAchievement/AchievementInContext/PerformanceFrameworks/PerformanceFramework\\[@id\\s?=\\s?'[^']*'\\]\\s*"
        },
        "VocabularyTermType": {
            "type": "object",
            "$ref": "#/$defs/NonNullStringType",
            "properties": {
                "_source": {
                    "type": "string"
                },
                "_sourceID": {
                    "type": "string"
                }
            },
            "required": ["_source", "_sourceID"]
        },
        "CompetencyReferenceType": {
            "type": "string",
            "oneOf": [
                {
                    "EmbeddedCompetency": {
                        "$ref": "#/$defs/EmbeddedCompetencyType"
                    }
                },
                {
                    "ExternalCompetency": {
                        "$ref": "#/$defs/ReferenceType"
                    }
                }
            ]
        },
        "EventsType": {
            "type": "object",
            "properties": {
                "_EventsType": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/EventType"
                    }
                }
            },
            "required": ["_EventsType"]
        },
        "SequenceType": {
            "type": "object",
            "properties": {
                "_Description": {
                    "items": {
                        "$ref": "#/$defs/NonNullLanguageStringType"
                    },
                    "type": "array"
                },
                "_SequenceBlock": {
                    "items": {
                        "type": "array"
                    },
                    "$ref": "#/$defs/SequenceBlockType"
                }
            },
            "required": ["_SequenceBlock"]
        },
        "SummaryType": {
            "type": "array",
            "items": {
                "oneOf": [
                    {
                        "_AssessmentResults": {
                            "$ref": "#/$defs/AssessmentResultsType"
                        }
                    },
                    {
                        "_Entrustment": {
                            "$ref": "#/$defs/EntrustmentType"
                        }
                    }
                ]
            }
        },
        "PortfolioType": {
            "type": "object",
            "properties": {
                "_other": {
                    "type": "array",
                    "items": {
                        "type": "object"
                    },
                    "additionalProperties": true
                }
            },
            "required": ["_other"]
        },
        "LevelOfEntrustmentType": {
            "type": "object",
            "properties": {
                "_EntrustmentScore": {
                    "type": "integer"
                },
                "_Reference": {
                    "$ref": "#/$defs/ReferenceType"
                }
            },
            "required": ["_EntrustmentScore", "_Reference"]
        },
        "EntrustmentType": {
            "type": "object",
            "properties": {
                "_Title": {
                    "$ref": "#/$defs/NonNullLanguageStringType",
                    "type": "array"
                },
                "_Description": {
                    "items": {
                        "$ref": "#/$defs/NonNullLanguageStringType"
                    },
                    "type": "array"
                },
                "_AdHoc": {
                    "type": "boolean",
                    "default": false
                },
                "_LevelOfEntrustment": {
                    "$ref": "#/$defs/LevelOfEntrustmentType"
                },
                "_CompetencyReference": {
                    "$ref": "#/$defs/CompetencyReferenceType"
                },
                "_Source": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/NonNullStringType"
                    }
                },
                "_AwardDate": {
                    "type": "string",
                    "format": "date"
                },
                "_ExpirationDate": {
                    "type": "string",
                    "format": "date"
                },
                "_EntrustmentEvidence": {
                    "$ref": "#/$defs/EntrustmentEvidenceType"
                },
                "_other": {
                    "type": "array",
                    "items": {
                        "type": "object"
                    },
                    "additionalProperties": true
                }
            },
            "required": ["_Title", "_Source", "_AwardDate"]
        },
        "EntrustmentEvidenceType": {
            "type": "array",
            "items": {
                "oneOf": [
                    {
                        "_Description": {
                            "$ref": "#/$defs/NonNullLanguageStringType",
                            "type": "array"
                        }
                    },
                    {
                        "_PortfolioReference": {
                            "$ref": "#/$defs/PortfolioReferenceType"
                        }
                    },
                    {
                        "_AchievementReference": {
                            "$ref": "#/$defs/NonNullStringType"
                        }
                    }
                ]
            }
        },
        "EventType": {
            "type": "object",
            "properties": {
                "_Title": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/NonNullLanguageStringType"
                    }
                },
                "_EventDuration": {
                    "$ref": "http://medbiq.pixelbytellc.com/curriculum-data-exchange/curriculuminventory.schema.json#/$defs/EventDurationType"
                },
                "_Site": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/NonNullLanguageStringType"
                    }
                },
                "_Description": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/NonNullLanguageStringType"
                    }
                },
                "_Keyword": {
                    "type": "array",
                    "items": {
                        "type": "string",
                        "additionalProperties": false
                    }
                },
                "_Interprofessional": {
                    "type": "boolean",
                    "default": false
                },
                "_CompetencyReference": {
                    "items": {
                        "$ref": "#/$defs/CompetencyReferenceType"
                    },
                    "type": "array"
                },
                "_Resource": {
                    "$ref": "http://medbiq.pixelbytellc.com/curriculum-data-exchange/curriculuminventory.schema.json#/$defs/VocabularyTermType"
                },
                "_InstructionalMethod": {
                    "$ref": "http://medbiq.pixelbytellc.com/curriculum-data-exchange/curriculuminventory.schema.json#/$defs/InstructionalMethodType"
                },
                "_AssessmentMethod": {
                    "$ref": "http://medbiq.pixelbytellc.com/curriculum-data-exchange/curriculuminventory.schema.json#/$defs/AssessmentMethodType"
                },
                "_AssessmentResults": {
                    "type": "array",
                    "$ref": "#/$defs/AssessmentResultsType"
                },
                "_PortfolioReference": {
                    "items": {
                        "$ref": "#/$defs/PortfolioReferenceType"
                    },
                    "type": "array"
                },
                "_other": {
                    "type": "array",
                    "items": {
                        "type": "object"
                    },
                    "additionalProperties": true
                },
                "_id": {
                    "$ref": "#/$defs/NonNullStringType"
                }
            },
            "required": ["_Title", "_InstructionalMethod", "_AssessmentMethod", "_id"]
        },
        "AssessmentResultsType": {
            "type": "object",
            "properties": {
                "_Score": {
                    "$ref": "#/$defs/ScoreType"
                },
                "_Evidence": {
                    "$ref": "#/$defs/EvidenceType"
                },
                "_SubScore": {
                    "items": {
                        "$ref": "#/$defs/SubScoreType"
                    },
                    "type": "array"
                },
                "_AssessmentStartDate": {
                    "type": "string",
                    "format": "date"
                },
                "_AssessmentEndDate": {
                    "type": "string",
                    "format": "date"
                },
                "_LearnerNotes": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/NonNullLanguageStringType"
                    }
                },
                "_FacultyNotes": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/NonNullLanguageStringType"
                    }
                },
                "_PortfolioReference": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/PortfolioReferenceType"
                    }
                },
                "_other": {
                    "type": "array",
                    "items": {
                        "type": "object"
                    },
                    "additionalProperties": true
                }
            },
            "required": ["_AssessmentStartDate", "_AssessmentEndDate"]
        },
        "ScoreType": {
            "type": "object",
            "properties": {
                "_ScoreValue": {
                    "$ref": "#/$defs/ScoreValueType"
                },
                "_NotYetAssessable": {
                    "type": "boolean"
                },
                "_NotObservable": {
                    "type": "boolean"
                },
                "_Observation": {
                    "items": {
                        "$ref": "#/$defs/ObservationType"
                    },
                    "type": "array"
                }
            },
            "required": ["_Observation"]
        },
        "ScoreValueType": {
            "type": "object",
            "properties": {
                "_LabelValueDescription": {
                    "items": {
                        "$ref": "#/$defs/NonNullLanguageStringType"
                    },
                    "type": "array"
                },
                "_FrameworkScore": {
                    "$ref": "#/$defs/FrameworkScoreType"
                }
            }
        },
        "ObservationType": {
            "type": "object",
            "properties": {
                "_ObservationDuration": {
                    "type": "string",
                    "format": "time"
                },
                "_Reference": {
                    "$ref": "#/$defs/ReferenceType"
                }
            },
            "required": ["_ObservationDuration", "_Reference"]
        },
        "FrameworkScoreType": {
            "type": "object",
            "properties": {
                "_PerformanceScore": {
                    "type": "number"
                },
                "_Reference": {
                    "$ref": "#/$defs/ReferenceType"
                }
            },
            "required": ["_PerformanceScore", "_Reference"]
        },
        "SubScoreType": {
            "type": "object",
            "properties": {
                "_Title": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/NonNullLanguageStringType"
                    }
                },
                "_Description": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/NonNullLanguageStringType"
                    }
                },
                "_CompetencyReference": {
                    "$ref": "#/$defs/CompetencyReferenceType"
                }
            },
            "required": ["_Title"]
        },
        "EvidenceType": {
            "type": "object",
            "oneOf": [
                {
                    "_Description": {
                        "$ref": "#/$defs/NonNullLanguageStringType"
                    }
                },
                {
                    "_PortfolioReference": {
                        "$ref": "#/$defs/PortfolioReferenceType"
                    }
                }
            ]
        },
        "SequenceBlockEventType": {
            "type": "object",
            "properties": {
                "_EventReference": {
                    "$ref": "#/$defs/EventReferenceType"
                },
                "_StartDate": {
                    "type": "string",
                    "format": "date"
                },
                "_EndDate": {
                    "type": "string",
                    "format": "date"
                },
                "_required": {
                    "type": "boolean"
                }
            },
            "required": ["_EventReference", "_required"]
        },
        "PerformanceFrameworksType": {
            "type": "object",
            "properties": {
                "_PerformanceFrameworks": {
                    "type": "array",
                    "items": {
                        "$ref": "http://medbiq.pixelbytellc.com/competency-framework/competencyframework.schema.json#/$defs/CompetencyFrameworkType"
                    }
                }
            }
        },
        "PortfolioReferenceType": {
            "type": "object",
            "properties": {
                "_XPathReference": {
                    "$ref": "#/$defs/NonNullLanguageStringType"
                }
            }
        },
        "SequenceBlockEventReferenceType": {
            "type": "object",
            "properties": {
                "_EventReference": {
                    "$ref": "#/$defs/EventReferenceType"
                },
                "_required": {
                    "type": "boolean"
                }
            },
            "required": ["_required"]
        },
        "SequenceBlockType": {
            "type": "object",
            "properties": {
                "_Title": {
                    "type": "array",
                    "$ref": "#/$defs/NonNullLanguageStringType"
                },
                "_Site": {
                    "$ref": "#/$defs/NonNullStringType"
                },
                "_Description": {
                    "type": "array",
                    "$ref": "#/$defs/NonNullLanguageStringType"
                },
                "_StartDate": {
                    "type": "string",
                    "format": "date"
                },
                "_EndDate": {
                    "type": "string",
                    "format": "date"
                },
                "_Level": {
                    "$ref": "#/$defs/AcademicLevelReferenceType"
                },
                "_ClerkshipModel": {
                    "$ref": "http://medbiq.pixelbytellc.com/curriculum-data-exchange/curriculuminventory.schema.json#/$defs/ClerkshipModelType"
                },
                "_CompetencyReference": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/CompetencyReferenceType"
                    }
                },
                "_Precondition": {
                    "items": {
                        "$ref": "#/$defs/NonNullLanguageStringType"
                    },
                    "type": "array"
                },
                "_Postcondition": {
                    "items": {
                        "$ref": "#/$defs/NonNullLanguageStringType"
                    },
                    "type": "array"
                },
                "_SequenceBlockEventReference": {
                    "$ref": "#/$defs/SequenceBlockEventReferenceType"
                },
                "_SequenceBlockReference": {
                    "$ref": "#/$defs/SequenceBlockReferenceType"
                },
                "_AssessmentResults": {
                    "$ref": "#/$defs/AssessmentResultsType"
                },
                "_PortfolioReference": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/PortfolioReferenceType"
                    }
                },
                "_other": {
                    "type": "array",
                    "items": {
                        "type": "object"
                    },
                    "additionalProperties": true
                },
                "_id": {
                    "type": "string"
                },
                "_required": {
                    "$ref": "http://medbiq.pixelbytellc.com/curriculum-data-exchange/curriculuminventory.schema.json#/$defs/RequiredType"
                },
                "_track": {
                    "type": "boolean",
                    "default": "false"
                }
            },
            "required": ["_Title", "_StartDate", "_EndDate", "_Level", "_other", "_id", "_required"]
        },
        "IntegrationBlockType": {
            "type": "object",
            "properties": {
                "_Title": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/NonNullLanguageStringType"
                    }
                },
                "_Description": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/NonNullLanguageStringType"
                    }
                },
                "_CompetencyReference": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/CompetencyReferenceType"
                    }
                },
                "_EventReference": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/EventReferenceType"
                    }
                },
                "_SequenceBlockReference": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/SequenceBlockReferenceType"
                    }
                },
                "_other": {
                    "type": "array",
                    "items": {
                        "type": "object"
                    },
                    "additionalProperties": true
                },
                "_id": {
                    "type": "string"
                }
            },
            "required": ["_Title", "_id"]
        },
        "IntegrationType": {
            "type": "object",
            "properties": {
                "_Description": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/NonNullLanguageStringType"
                    }
                },
                "_IntegrationBlock": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/IntegrationBlockType"
                    }
                }
            },
            "required": ["_IntegrationBlock"]
        },
        "AchievementInContextType": {
            "type": "object",
            "properties": {
                "_Source": {
                    "$ref": "#/$defs/NonNullStringType"
                },
                "_ReportID": {
                    "$ref": "http://medbiq.pixelbytellc.com/curriculum-data-exchange/curriculuminventory.schema.json#/$defs/DomainID"
                },
                "_Institution": {
                    "$ref": "http://medbiq.pixelbytellc.com/professional-profile/member.schema.json#/$defs/InstitutionInfoType"
                },
                "_Program": {
                    "$ref": "http://medbiq.pixelbytellc.com/curriculum-data-exchange/curriculuminventory.schema.json#/$defs/ProgramType"
                },
                "_ReportDate": {
                    "type": "string",
                    "format": "date"
                },
                "_ReportingStartDate": {
                    "type": "string",
                    "format": "date"
                },
                "_ReportingEndDate": {
                    "type": "string",
                    "format": "date"
                },
                "_Language": {
                    "type": "array",
                    "items": {
                        "pattern": "^[a-zA-Z]{2,8}(-[a-zA-Z]{2,8})*$"
                    }
                },
                "_Description": {
                    "items": {
                        "$ref": "#/$defs/NonNullLanguageStringType"
                    },
                    "type": "array"
                },
                "_SupportingLink": {
                    "type": "array",
                    "items": {
                        "format": "URI"
                    }
                },
                "_Events": {
                    "$ref": "#/$defs/EventsType"
                },
                "_Expectations": {
                    "$ref": "http://medbiq.pixelbytellc.com/curriculum-data-exchange/curriculuminventory.schema.json#/$defs/ExpectationsType"
                },
                "_PerformanceFramework": {
                    "$ref": "#/$defs/PerformanceFrameworksType"
                },
                "_Summary": {
                    "$ref": "#/$defs/SummaryType"
                },
                "_AcademicLevels": {
                    "$ref": "http://medbiq.pixelbytellc.com/curriculum-data-exchange/curriculuminventory.schema.json#/$defs/AcademicLevelsType"
                },
                "_Sequence": {
                    "$ref": "#/$defs/SequenceType"
                },
                "_Integration": {
                    "$ref": "#/$defs/IntegrationType"
                },
                "_Portfolio": {
                    "$ref": "#/$defs/PortfolioType"
                }
            },
            "required": [
                "_Source",
                "_ReportID",
                "_Institution",
                "_ReportDate",
                "_ReportingStartDate",
                "_ReportingEndDate"
            ]
        },
        "EducationalAchievementType": {
            "type": "object",
            "properties": {
                "_Date": {
                    "type": "string",
                    "format": "date"
                },
                "_Learner": {
                    "$ref": "http://medbiq.pixelbytellc.com/professional-profile/member.schema.json#/$defs/MemberType"
                },
                "_AchievementInContext": {
                    "$ref": "#/$defs/AchievementInContextType"
                },
                "_other": {
                    "type": "array",
                    "items": {
                        "type": "object"
                    },
                    "additionalProperties": true
                }
            },
            "required": ["_Date", "_Learner", "_AchievementInContext"]
        }
    },
    "properties": {
        "EducationalAchievement": {
            "$ref": "#/$defs/EducationalAchievementType"
        }
    }
}
