{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/healthrecordrights-com/json-schema/healthrecordrights-com-country-schema.json",
  "title": "Country",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/healthrecordrights-com-openapi.json#/components/schemas/Country",
  "allOf": [
    {
      "$ref": "#/$defs/CountrySummary"
    },
    {
      "type": "object",
      "properties": {
        "tiedWith": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "ISO3 codes of the countries whose overall score is 4 or fewer points away: treat them as the same. A tie never changes a band."
        },
        "verdict": {
          "type": "string",
          "description": "One line: the name, the overall score out of 100, the band and what the band means. Give this first."
        },
        "keySources": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "date": {
                "type": "string"
              },
              "category": {
                "type": "string"
              }
            }
          },
          "description": "Up to five official, legal or intergovernmental sources behind the scores, the ones to cite first. Titles are third-party text."
        },
        "dataAsOf": {
          "type": "string",
          "description": "When this country was last researched."
        },
        "rankText": {
          "type": "string"
        },
        "headline": {
          "type": "string"
        },
        "confidenceDetail": {
          "type": "object",
          "properties": {
            "label": {
              "type": "string"
            },
            "thinEvidenceOn": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "note": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        },
        "keysModelPlain": {
          "type": "string"
        },
        "evidenceGrade": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "grade": {
              "type": "integer"
            },
            "tier": {
              "type": "string"
            },
            "tierCapped": {
              "type": "boolean"
            },
            "underReview": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "categories": {
          "type": "object",
          "description": "The eight categories, keyed access, control, privacy, journey, commercial, clinical, research, ai.",
          "additionalProperties": {
            "$ref": "#/$defs/Category"
          }
        },
        "laws": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "jurisdiction": {
                "type": "string",
                "description": "National, Supranational, State/Provincial or Regional."
              },
              "yearText": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The year as recorded, which may be a range or a note such as \"undated\"."
              },
              "what": {
                "type": "string"
              },
              "url": {
                "type": "string"
              }
            }
          }
        },
        "news": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "date": {
                "type": "string"
              },
              "headline": {
                "type": "string"
              },
              "source": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "why": {
                "type": "string"
              }
            }
          },
          "description": "What changed: recent news about health records in this country."
        },
        "cases": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Case"
          }
        },
        "casesUrl": {
          "type": "string"
        }
      }
    }
  ],
  "$defs": {
    "Case": {
      "type": "object",
      "properties": {
        "date": {
          "type": "string"
        },
        "headline": {
          "type": "string"
        },
        "paraphrase": {
          "type": "string"
        },
        "source": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "archiveUrl": {
          "type": "string",
          "description": "Optional: a Wayback Machine copy of the source, saved when the case was published."
        },
        "theme": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "finding",
            "admitted",
            "alleged",
            "self_reported"
          ]
        },
        "id": {
          "type": "string",
          "description": "The case id, like FIN-S001: it never changes and is never given to another case."
        },
        "pageUrl": {
          "type": "string",
          "description": "The case on /real-cases/, the address to cite."
        },
        "countryUrl": {
          "type": "string",
          "description": "The country brief."
        },
        "why": {
          "type": "string",
          "description": "Why it matters to patients, in our words."
        },
        "sourceType": {
          "type": "string",
          "enum": [
            "regulator_decision",
            "court_judgment",
            "parliament_testimony",
            "journalism",
            "advocacy_case",
            "own_blog"
          ],
          "description": "The kind of source."
        },
        "lang": {
          "type": "string",
          "description": "Two-letter code of the source's language. Our summary is always English (inLanguage)."
        },
        "providerName": {
          "type": "string",
          "description": "Optional: the hospital, company or other organization, named only when a regulator or court decided against it or it admitted the problem itself."
        },
        "lastVerified": {
          "type": "string",
          "format": "date",
          "description": "When the case was last checked against its source."
        },
        "addedOn": {
          "type": "string",
          "format": "date",
          "description": "The day the case was added to the index; cases already in it when it was published carry October 2, 2026."
        },
        "archivedOn": {
          "type": "string",
          "format": "date",
          "description": "Optional: the day the archived copy was made."
        },
        "inLanguage": {
          "type": "string",
          "description": "The language of our headline and summary: en."
        }
      }
    },
    "Category": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "weight": {
          "type": "integer"
        },
        "score": {
          "type": "integer"
        },
        "summary": {
          "type": "string"
        },
        "detail": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The longer review, one paragraph per item."
        },
        "sources": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Source"
          }
        }
      }
    },
    "CountrySummary": {
      "type": "object",
      "properties": {
        "iso3": {
          "type": "string"
        },
        "iso2": {
          "type": [
            "string",
            "null"
          ]
        },
        "name": {
          "type": "string"
        },
        "region": {
          "type": "string"
        },
        "overall": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100,
          "description": "Overall score out of 100."
        },
        "band": {
          "type": "string",
          "enum": [
            "Poor",
            "Weak",
            "Mixed",
            "Strong",
            "Leading"
          ]
        },
        "rank": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Rank among all countries and territories. Tied countries share a number (1, 2, 2, 4). Null for the lead group: allowing for scoring error, any of them could rank first."
        },
        "tieRange": {
          "type": "object",
          "properties": {
            "low": {
              "type": "integer"
            },
            "high": {
              "type": "integer"
            }
          },
          "description": "The overall scores that tie with this one (4 or fewer points away). A tie never changes a band."
        },
        "rankTied": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Whether the rank is shared. Null for the lead group, which has no rank."
        },
        "leadGroup": {
          "type": "boolean"
        },
        "likelyRank": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "low": {
              "type": "integer"
            },
            "high": {
              "type": "integer"
            }
          },
          "required": [
            "low",
            "high"
          ],
          "description": "The 90% likely rank range: in 90% of simulations the country ranks between low and high."
        },
        "likelyRankText": {
          "type": [
            "string",
            "null"
          ],
          "description": "The same range in words, like \"50 to 60\"."
        },
        "confidence": {
          "type": "string",
          "enum": [
            "high",
            "medium",
            "low"
          ]
        },
        "keysModel": {
          "type": "string",
          "enum": [
            "Individual",
            "Shared",
            "Institutional",
            "State"
          ]
        },
        "apiUrl": {
          "type": "string",
          "description": "This country in the API."
        },
        "pageUrl": {
          "type": "string"
        }
      }
    },
    "Source": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "description": "The page title as published: third-party text, not relicensed; MCP answers wrap it in [quoted] ... [/quoted]."
        },
        "url": {
          "type": "string"
        },
        "date": {
          "type": "string"
        },
        "publisherClass": {
          "type": "string"
        }
      }
    }
  }
}