{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Маршрут по опубликованному региональному приказу: перечень медицинских организаций и дословные пункты правил. verified у строки только после подписи страницы скана и второго проверяющего (data/review/scan_pages.yaml)",
  "type": "object",
  "properties": {
    "dataset": {
      "const": "routes"
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "region_id",
          "title",
          "act",
          "quotes",
          "units",
          "omitted",
          "source_ref",
          "verified",
          "verified_at",
          "audience",
          "districts",
          "amended_by",
          "related_acts",
          "scan_checked_pages"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^ru-[a-z]{2,3}(-children)?$"
          },
          "region_id": {
            "type": "string",
            "pattern": "^RU-[A-Z]{2,3}$"
          },
          "title": {
            "type": "string",
            "minLength": 1
          },
          "act": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "title",
              "number",
              "date",
              "eoNumber",
              "url"
            ],
            "properties": {
              "title": {
                "type": "string",
                "minLength": 1
              },
              "number": {
                "type": "string",
                "minLength": 1
              },
              "date": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "eoNumber": {
                "type": "string",
                "pattern": "^\\d{16}$"
              },
              "url": {
                "type": "string",
                "pattern": "^http://publication\\.pravo\\.gov\\.ru/document/\\d{16}$"
              }
            }
          },
          "quotes": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "point",
                "text_verbatim",
                "page",
                "verified",
                "scan_checked_at"
              ],
              "properties": {
                "point": {
                  "type": "string",
                  "minLength": 1
                },
                "text_verbatim": {
                  "type": "string",
                  "minLength": 1
                },
                "page": {
                  "type": "integer",
                  "minimum": 1
                },
                "verified": {
                  "type": "boolean"
                },
                "scan_checked_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                }
              }
            }
          },
          "units": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "n",
                "table",
                "org",
                "unit",
                "page",
                "ocr_fixed",
                "scan_checked_at",
                "verified"
              ],
              "properties": {
                "n": {
                  "type": "integer",
                  "minimum": 1
                },
                "table": {
                  "enum": [
                    "ambulatory",
                    "inpatient",
                    "home",
                    "children_ambulatory",
                    "children_inpatient",
                    "children_home",
                    "other"
                  ]
                },
                "org": {
                  "type": "string",
                  "minLength": 1
                },
                "unit": {
                  "type": "string",
                  "minLength": 1
                },
                "page": {
                  "type": "integer",
                  "minimum": 1
                },
                "ocr_fixed": {
                  "type": "boolean"
                },
                "sic": {
                  "type": "boolean"
                },
                "district": {
                  "type": "string",
                  "minLength": 1
                },
                "scan_checked_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "verified": {
                  "type": "boolean"
                },
                "part": {
                  "type": "integer",
                  "minimum": 1
                },
                "population": {
                  "type": "string",
                  "minLength": 1
                }
              }
            }
          },
          "omitted": {
            "type": "string"
          },
          "source_ref": {
            "type": "string",
            "minLength": 1
          },
          "verified": {
            "type": "boolean"
          },
          "verified_at": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "audience": {
            "enum": [
              "adults",
              "children"
            ]
          },
          "districts": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "name",
                "units",
                "page"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "units": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^[a-z_]+ \\d+(\\.\\d+)?$"
                  }
                },
                "page": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "amended_by": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "eoNumber",
                "number",
                "date",
                "title",
                "url",
                "note"
              ],
              "properties": {
                "eoNumber": {
                  "type": "string",
                  "pattern": "^\\d{16}$"
                },
                "number": {
                  "type": "string",
                  "minLength": 1
                },
                "date": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "title": {
                  "type": "string",
                  "minLength": 1
                },
                "url": {
                  "type": "string",
                  "pattern": "^http://publication\\.pravo\\.gov\\.ru/document/\\d{16}$"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "related_acts": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "eoNumber",
                "number",
                "date",
                "title",
                "url",
                "note"
              ],
              "properties": {
                "eoNumber": {
                  "type": "string",
                  "pattern": "^\\d{16}$"
                },
                "number": {
                  "type": "string",
                  "minLength": 1
                },
                "date": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "title": {
                  "type": "string",
                  "minLength": 1
                },
                "url": {
                  "type": "string",
                  "pattern": "^http://publication\\.pravo\\.gov\\.ru/document/\\d{16}$"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "scan_checked_pages": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1
            }
          },
          "superseded_refs": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "text_verbatim",
                "page",
                "note"
              ],
              "properties": {
                "text_verbatim": {
                  "type": "string",
                  "minLength": 1
                },
                "page": {
                  "type": "integer",
                  "minimum": 1
                },
                "note": {
                  "type": "string",
                  "minLength": 1
                }
              }
            }
          },
          "referrals": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "n",
                "org",
                "units",
                "page"
              ],
              "properties": {
                "n": {
                  "type": "integer",
                  "minimum": 1
                },
                "org": {
                  "type": "string",
                  "minLength": 1
                },
                "units": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^[a-z_]+ \\d+(\\.\\d+)?$"
                  }
                },
                "page": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          }
        }
      }
    }
  }
}
