{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "definitions": {
        "adminDivision": {
            "properties": {
                "coordinates": {
                    "properties": {
                        "lat": {
                            "type": "number"
                        },
                        "lon": {
                            "type": "number"
                        }
                    },
                    "type": "object"
                },
                "deprecated": {
                    "type": "boolean"
                },
                "id": {
                    "type": [
                        "string",
                        "number"
                    ]
                },
                "name": {
                    "type": "string"
                },
                "ochaId": {
                    "type": "string"
                }
            },
            "required": [
                "id",
                "name"
            ],
            "type": "object"
        },
        "changeLog": {
            "items": {
                "properties": {
                    "rev": {
                        "type": "string"
                    },
                    "timestamp": {
                        "type": "integer"
                    },
                    "user": {
                        "$ref": "#/definitions/user"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "contact": {
            "properties": {
                "address": {
                    "type": "string"
                },
                "age": {
                    "properties": {
                        "category": {
                            "enum": [
                                "child",
                                "adult"
                            ]
                        },
                        "months": {
                            "maximum": 11,
                            "minimum": 0,
                            "type": "number"
                        },
                        "years": {
                            "maximum": 121,
                            "minimum": 0,
                            "type": "number"
                        }
                    },
                    "type": "object"
                },
                "category": {
                    "type": "string"
                },
                "doc_type": {
                    "enum": [
                        "contact"
                    ],
                    "type": "string"
                },
                "gender": {
                    "enum": [
                        "F",
                        "M",
                        "unknown"
                    ]
                },
                "location": {
                    "$ref": "#/definitions/location"
                },
                "organisation": {
                    "type": "string"
                },
                "phoneNo": {
                    "faker": "phone.phoneNumber",
                    "type": "string"
                },
                "preferredLanguages": {
                    "type": "array"
                },
                "role": {
                    "type": "string"
                },
                "ward": {
                    "$ref": "#/definitions/ward"
                }
            },
            "required": [
                "doc_type",
                "phoneNo"
            ],
            "type": "object"
        },
        "dispatch": {
            "type": "object"
        },
        "location": {
            "properties": {
                "adminDivision1": {
                    "$ref": "#/definitions/adminDivision"
                },
                "adminDivision2": {
                    "$ref": "#/definitions/adminDivision"
                },
                "adminDivision3": {
                    "$ref": "#/definitions/adminDivision"
                },
                "adminDivision4": {
                    "$ref": "#/definitions/adminDivision"
                }
            },
            "type": "object"
        },
        "patient": {
            "description": "a patient registered by the Call Center",
            "properties": {
                "address": {
                    "type": "string"
                },
                "age": {
                    "properties": {
                        "category": {
                            "enum": [
                                "infant",
                                "child",
                                "adult"
                            ]
                        },
                        "months": {
                            "maximum": 11,
                            "minimum": 0,
                            "type": "number"
                        },
                        "years": {
                            "maximum": 121,
                            "minimum": 0,
                            "type": "number"
                        }
                    },
                    "type": "object"
                },
                "causeOfDeath": {
                    "enum": [
                        "trauma or accident",
                        "fever",
                        "maternal death",
                        "still death",
                        "other"
                    ]
                },
                "dateOfDeath": {
                    "_format": "date-time",
                    "type": "string"
                },
                "doc_type": {
                    "enum": [
                        "patient"
                    ],
                    "type": "string"
                },
                "gender": {
                    "enum": [
                        "F",
                        "M",
                        "unknown"
                    ]
                },
                "household": {
                    "properties": {
                        "child": {
                            "type": "boolean"
                        },
                        "disabledPerson": {
                            "type": "boolean"
                        },
                        "pregnantWoman": {
                            "type": "boolean"
                        }
                    },
                    "type": "object"
                },
                "id": {
                    "type": "number"
                },
                "location": {
                    "$ref": "#/definitions/location"
                },
                "patientName": {
                    "type": "string"
                },
                "phoneNo": {
                    "type": "string"
                },
                "status": {
                    "enum": [
                        "dead",
                        "alive"
                    ],
                    "type": "string"
                },
                "symptomsOn": {
                    "_format": "date-time",
                    "type": "string"
                },
                "ward": {
                    "$ref": "#/definitions/ward"
                }
            },
            "required": [
                "location",
                "age",
                "status",
                "household",
                "doc_type"
            ],
            "title": "Patient",
            "type": "object"
        },
        "quarantine": {
            "properties": {
                "actionTaken": {
                    "enum": [
                        "falseSecurityPresent",
                        "nutritionNotified",
                        "securityNotified",
                        "personTransferred",
                        "collectedByBurialTeam",
                        "falseFoodDelivered"
                    ]
                },
                "dateResponded": {
                    "_format": "date-time",
                    "type": "string"
                },
                "officer": {
                    "type": "string"
                },
                "phoneNo": {
                    "type": "string"
                }
            },
            "type": "object"
        },
        "response": {
            "swabId": {
                "type": "string"
            },
            "type": "object"
        },
        "swabbing": {
            "description": "sample taken from patient",
            "properties": {
                "collectorName": {
                    "description": "swabbing collector's name",
                    "type": "string"
                },
                "date": {
                    "_format": "date-time",
                    "type": "string"
                },
                "location": {
                    "description": "location where the swabbing has taken place",
                    "type": "string"
                },
                "serialNumber": {
                    "type": "string"
                },
                "suggestedOn": {
                    "_format": "date-time",
                    "description": "when the swabbing was suggested to be performed",
                    "type": "string"
                }
            },
            "type": "object"
        },
        "user": {
            "properties": {
                "fullName": {
                    "type": "string"
                },
                "username": {
                    "type": "string"
                }
            },
            "type": "object"
        },
        "ward": {
            "maxLength": 3,
            "type": "string"
        }
    },
    "description": "An Ebola case registered by the call centre",
    "properties": {
        "callDetails": {
            "type": "string"
        },
        "callId": {
            "type": "string"
        },
        "callNature": {
            "enum": [
                "death",
                "suspect",
                "sick",
                "health information",
                "quarantine",
                "security threat",
                "prank call",
                "other",
                "non ebola"
            ]
        },
        "callNatureOther": {
            "type": "string"
        },
        "callback": {
            "properties": {
                "completedAt": {
                    "_format": "date-time",
                    "type": "string"
                },
                "required": {
                    "type": "boolean"
                },
                "requiredAt": {
                    "_format": "date-time",
                    "type": "string"
                }
            },
            "type": "object"
        },
        "caseStatus": {
            "type": "string"
        },
        "changeLog": {
            "$ref": "#/definitions/changeLog"
        },
        "contact": {
            "$ref": "#/definitions/contact"
        },
        "createdBy": {
            "$ref": "#/definitions/user"
        },
        "createdOn": {
            "_format": "date-time",
            "type": "string"
        },
        "dispatch": {
            "$ref": "#/definitions/dispatch"
        },
        "doc_type": {
            "pattern": "^case$",
            "type": "string"
        },
        "duplicateIDs": {
            "items": {
                "type": "string"
            },
            "type": "array"
        },
        "isFollowUpCall": {
            "type": "boolean"
        },
        "patient": {
            "$ref": "#/definitions/patient"
        },
        "quarantine": {
            "$ref": "#/definitions/quarantine"
        },
        "reponseLine": {
            "type": "string"
        },
        "requestedHealthInfo": {
            "type": "object"
        },
        "response": {
            "$ref": "#/definitions/response"
        },
        "responseLine": {
            "enum": [
                "117"
            ],
            "type": "string"
        },
        "sameCallPatients": {
            "type": "array"
        },
        "swabbing": {
            "$ref": "#/definitions/swabbing"
        },
        "version": {
            "_format": "semver",
            "type": "string"
        }
    },
    "required": [
        "doc_type",
        "version",
        "createdOn",
        "contact",
        "createdBy",
        "patient",
        "response",
        "dispatch",
        "callNature",
        "responseLine"
    ],
    "title": "Case",
    "type": "object"
}