{
    "definitions": {
        "contact": {
            "properties": {
                "contact": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                }
            },
            "type": "object"
        },
        "result_limit": {
            "properties": {
                "isotope": {
                    "type": "string"
                },
                "type": {
                    "enum": [
                        "limit"
                    ]
                },
                "unit": {
                    "$ref": "#/definitions/units"
                },
                "value": {
                    "items": {
                        "type": "number"
                    },
                    "maxItems": 2,
                    "minItems": 1,
                    "type": "array"
                }
            },
            "required": [
                "type",
                "isotope",
                "unit",
                "value"
            ],
            "type": "object"
        },
        "result_measurement": {
            "properties": {
                "isotope": {
                    "type": "string"
                },
                "type": {
                    "enum": [
                        "measurement"
                    ]
                },
                "unit": {
                    "$ref": "#/definitions/units"
                },
                "value": {
                    "items": {
                        "type": "number"
                    },
                    "maxItems": 3,
                    "minItems": 1,
                    "type": "array"
                }
            },
            "required": [
                "type",
                "isotope",
                "unit",
                "value"
            ],
            "type": "object"
        },
        "result_range": {
            "properties": {
                "isotope": {
                    "type": "string"
                },
                "type": {
                    "enum": [
                        "range"
                    ]
                },
                "unit": {
                    "$ref": "#/definitions/units"
                },
                "value": {
                    "items": {
                        "type": "number"
                    },
                    "maxItems": 3,
                    "minItems": 1,
                    "type": "array"
                }
            },
            "required": [
                "type",
                "isotope",
                "unit",
                "value"
            ],
            "type": "object"
        },
        "units": {
            "enum": [
                "pct",
                "g/g",
                "ppm",
                "ppb",
                "ppt",
                "ppq",
                "Bq",
                "Bq/kg",
                "Bq/unit",
                "Bq/m",
                "Bq/cm",
                "Bq/m2",
                "Bq/cm2",
                "Bq/m3",
                "Bq/cm3",
                "mBq",
                "mBq/kg",
                "mBq/unit",
                "mBq/m",
                "mBq/cm",
                "mBq/m2",
                "mBq/cm2",
                "mBq/m3",
                "mBq/cm3",
                "uBq",
                "uBq/kg",
                "uBq/unit",
                "uBq/m",
                "uBq/cm",
                "uBq/m2",
                "uBq/cm2",
                "uBq/m3",
                "uBq/cm3",
                "nBq",
                "nBq/kg",
                "nBq/unit",
                "nBq/m",
                "nBq/cm",
                "nBq/m2",
                "nBq/cm2",
                "nBq/m3",
                "nBq/cm3",
                "pBq",
                "pBq/kg",
                "pBq/unit",
                "pBq/m",
                "pBq/cm",
                "pBq/m2",
                "pBq/cm2",
                "pBq/m3",
                "pBq/cm3",
                "g",
                "g/kg",
                "g/unit",
                "g/m",
                "g/cm",
                "g/m2",
                "g/cm2",
                "g/m3",
                "g/cm3",
                "mg",
                "mg/kg",
                "mg/unit",
                "mg/m",
                "mg/cm",
                "mg/m2",
                "mg/cm2",
                "mg/m3",
                "mg/cm3",
                "ug",
                "ug/kg",
                "ug/unit",
                "ug/m",
                "ug/cm",
                "ug/m2",
                "ug/cm2",
                "ug/m3",
                "ug/cm3",
                "ng",
                "ng/kg",
                "ng/unit",
                "ng/m",
                "ng/cm",
                "ng/m2",
                "ng/cm2",
                "ng/m3",
                "ng/cm3",
                "pg",
                "pg/kg",
                "pg/unit",
                "pg/m",
                "pg/cm",
                "pg/m2",
                "pg/cm2",
                "pg/m3",
                "pg/cm3"
            ]
        },
        "user": {
            "properties": {
                "description": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "type": {
                    "type": "string"
                },
                "unit": {
                    "type": "string"
                },
                "value": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "number"
                        }
                    ]
                }
            },
            "required": [
                "name",
                "type"
            ],
            "type": "object"
        }
    },
    "description": "MADF 3.0",
    "properties": {
        "data_source": {
            "properties": {
                "input": {
                    "properties": {
                        "contact": {
                            "type": "string"
                        },
                        "date": {
                            "anyOf": [
                                {
                                    "pattern": "[0-9]{4}-[0-9]{2}-[0-9]{2}",
                                    "type": "string"
                                },
                                {
                                    "pattern": "[0-9]{4}-[0-9]{2}-[0-9]{1}",
                                    "type": "string"
                                },
                                {
                                    "pattern": "[0-9]{4}-[1-2]{1}-[0-9]{2}",
                                    "type": "string"
                                },
                                {
                                    "pattern": "[0-9]{4}-[1-2]{1}-[0-9]{1}",
                                    "type": "string"
                                },
                                {
                                    "pattern": "[0-9]{4}-[0-9]{2}",
                                    "type": "string"
                                },
                                {
                                    "pattern": "[0-9]{4}-[0-9]{1}",
                                    "type": "string"
                                },
                                {
                                    "pattern": "[0-9]{4}",
                                    "type": "string"
                                }
                            ],
                            "type": "string"
                        },
                        "name": {
                            "type": "string"
                        },
                        "notes": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "name",
                        "contact",
                        "date"
                    ],
                    "type": "object"
                },
                "reference": {
                    "type": "string"
                },
                "user": {
                    "items": {
                        "$ref": "#/definitions/user"
                    },
                    "type": "array"
                }
            },
            "type": "object"
        },
        "grouping": {
            "type": "string"
        },
        "measurement": {
            "properties": {
                "date": {
                    "items": {
                        "anyOf": [
                            {
                                "pattern": "[0-9]{4}-[0-9]{2}-[0-9]{2}",
                                "type": "string"
                            },
                            {
                                "pattern": "[0-9]{4}-[0-9]{2}-[0-9]{1}",
                                "type": "string"
                            },
                            {
                                "pattern": "[0-9]{4}-[1-2]{1}-[0-9]{2}",
                                "type": "string"
                            },
                            {
                                "pattern": "[0-9]{4}-[1-2]{1}-[0-9]{1}",
                                "type": "string"
                            },
                            {
                                "pattern": "[0-9]{4}-[0-9]{2}",
                                "type": "string"
                            },
                            {
                                "pattern": "[0-9]{4}-[0-9]{1}",
                                "type": "string"
                            },
                            {
                                "pattern": "[0-9]{4}",
                                "type": "string"
                            },
                            {
                                "pattern": "^$",
                                "type": "string"
                            }
                        ]
                    },
                    "maxItems": 2,
                    "minItems": 0,
                    "type": "array"
                },
                "institution": {
                    "type": "string"
                },
                "practitioner": {
                    "$ref": "#/definitions/contact"
                },
                "requestor": {
                    "$ref": "#/definitions/contact"
                },
                "results": {
                    "items": {
                        "oneOf": [
                            {
                                "$ref": "#/definitions/result_measurement"
                            },
                            {
                                "$ref": "#/definitions/result_range"
                            },
                            {
                                "$ref": "#/definitions/result_limit"
                            }
                        ]
                    },
                    "type": "array"
                },
                "technique": {
                    "type": "string"
                },
                "user": {
                    "items": {
                        "$ref": "#/definitions/user"
                    },
                    "type": "array"
                }
            },
            "type": "object"
        },
        "sample": {
            "properties": {
                "description": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "owner": {
                    "$ref": "#/definitions/contact"
                },
                "source": {
                    "type": "string"
                },
                "user": {
                    "items": {
                        "$ref": "#/definitions/user"
                    },
                    "type": "array"
                }
            },
            "required": [
                "name",
                "description"
            ],
            "type": "object"
        },
        "specification": {
            "type": "string"
        },
        "type": {
            "type": "string"
        }
    },
    "required": [
        "grouping",
        "specification",
        "type",
        "sample",
        "data_source",
        "measurement"
    ],
    "type": "object"
}