{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aicdapi-com/json-schema/aicdapi-com-research-coverage-envelope-schema.json",
  "title": "ResearchCoverageEnvelope",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aicdapi-com-research-coverage-api-openapi.yml#/components/schemas/ResearchCoverageEnvelope",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "data",
    "meta"
  ],
  "properties": {
    "data": {
      "type": "array",
      "maxItems": 20,
      "items": {
        "oneOf": [
          {
            "$ref": "#/$defs/CityResearchCoverage"
          },
          {
            "$ref": "#/$defs/CountyResearchCoverage"
          }
        ]
      }
    },
    "meta": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "catalogVersion",
        "researchDate",
        "ingestionVerified",
        "statusDefinitions",
        "scope",
        "pagination"
      ],
      "properties": {
        "catalogVersion": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}\\.[a-f0-9]{12}$"
        },
        "researchDate": {
          "type": "string",
          "format": "date"
        },
        "ingestionVerified": {
          "type": "boolean",
          "const": false
        },
        "statusDefinitions": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "M",
            "D",
            "P",
            "R",
            "U",
            "N"
          ],
          "properties": {
            "M": {
              "type": "string"
            },
            "D": {
              "type": "string"
            },
            "P": {
              "type": "string"
            },
            "R": {
              "type": "string"
            },
            "U": {
              "type": "string"
            },
            "N": {
              "type": "string"
            }
          }
        },
        "scope": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "name",
            "counties",
            "rosterCheckedDate",
            "censusStatusVintage",
            "method",
            "caveat"
          ],
          "properties": {
            "name": {
              "type": "string",
              "const": "NCTCOG 16-county region"
            },
            "counties": {
              "type": "array",
              "minItems": 16,
              "maxItems": 16,
              "items": {
                "type": "string"
              }
            },
            "rosterCheckedDate": {
              "type": "string",
              "format": "date"
            },
            "censusStatusVintage": {
              "type": "string",
              "format": "date"
            },
            "method": {
              "type": "string"
            },
            "caveat": {
              "type": "string"
            }
          }
        },
        "pagination": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "limit",
            "returned",
            "nextCursor"
          ],
          "properties": {
            "limit": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20
            },
            "returned": {
              "type": "integer",
              "minimum": 0,
              "maximum": 20
            },
            "nextCursor": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 4096
            }
          }
        }
      }
    }
  },
  "$defs": {
    "CityResearchCoverage": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "researchId",
        "jurisdictionSlug",
        "name",
        "active",
        "municipalityType",
        "censusPlaceGeoid",
        "counties",
        "regionCounties",
        "primaryRegionCounty",
        "censusStatus",
        "sourceUrls",
        "rosterLimits",
        "families"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "city"
        },
        "researchId": {
          "type": "string",
          "pattern": "^city:48[0-9]{5}$"
        },
        "jurisdictionSlug": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "active": {
          "type": "boolean"
        },
        "municipalityType": {
          "type": "string",
          "enum": [
            "city",
            "town",
            "village"
          ]
        },
        "censusPlaceGeoid": {
          "type": "string",
          "pattern": "^48[0-9]{5}$"
        },
        "counties": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string"
          }
        },
        "regionCounties": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string"
          }
        },
        "primaryRegionCounty": {
          "type": "string"
        },
        "censusStatus": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "functionalStatus",
            "placeClass",
            "vintage"
          ],
          "properties": {
            "functionalStatus": {
              "type": "string"
            },
            "placeClass": {
              "type": "string"
            },
            "vintage": {
              "type": "string",
              "format": "date"
            }
          }
        },
        "sourceUrls": {
          "$ref": "#/$defs/ResearchSourceUrls"
        },
        "rosterLimits": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "boundaryYear",
            "boundarySource",
            "directoryListed",
            "websiteVerification",
            "verificationNotes"
          ],
          "properties": {
            "boundaryYear": {
              "type": "string"
            },
            "boundarySource": {
              "type": "string"
            },
            "directoryListed": {
              "type": "boolean"
            },
            "websiteVerification": {
              "type": "string"
            },
            "verificationNotes": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "families": {
          "type": "array",
          "minItems": 1,
          "maxItems": 10,
          "items": {
            "$ref": "#/$defs/ResearchCoverageFamily"
          }
        }
      }
    },
    "CountyResearchCoverage": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "researchId",
        "jurisdictionSlug",
        "countySlug",
        "name",
        "active",
        "sourceUrls",
        "families"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "county"
        },
        "researchId": {
          "type": "string",
          "pattern": "^county:[a-z]+(?:-[a-z]+)*$"
        },
        "jurisdictionSlug": {
          "type": "string"
        },
        "countySlug": {
          "$ref": "#/$defs/DfwCountySlug"
        },
        "name": {
          "type": "string"
        },
        "active": {
          "type": "boolean",
          "const": true
        },
        "sourceUrls": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "roster"
          ],
          "properties": {
            "roster": {
              "type": "string",
              "format": "uri"
            }
          }
        },
        "families": {
          "type": "array",
          "minItems": 1,
          "maxItems": 11,
          "items": {
            "$ref": "#/$defs/ResearchCoverageFamily"
          }
        }
      }
    },
    "DfwCountySlug": {
      "type": "string",
      "enum": [
        "collin",
        "dallas",
        "denton",
        "ellis",
        "erath",
        "hood",
        "hunt",
        "johnson",
        "kaufman",
        "navarro",
        "palo-pinto",
        "parker",
        "rockwall",
        "somervell",
        "tarrant",
        "wise"
      ]
    },
    "ResearchCoverageAlternative": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "sourceUrl"
      ],
      "properties": {
        "title": {
          "type": "string"
        },
        "status": {
          "$ref": "#/$defs/ResearchCoverageStatus"
        },
        "sourceUrl": {
          "type": "string",
          "format": "uri"
        },
        "checkedDate": {
          "type": "string",
          "format": "date"
        },
        "method": {
          "type": "string"
        },
        "evidence": {
          "type": "string"
        },
        "constraints": {
          "type": "string"
        }
      }
    },
    "ResearchCoverageFamily": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "familyId",
        "status",
        "evidenceScope",
        "checkedDate",
        "sourceUrl",
        "method",
        "evidence",
        "constraints",
        "alternatives"
      ],
      "properties": {
        "familyId": {
          "$ref": "#/$defs/ResearchCoverageFamilyId"
        },
        "status": {
          "$ref": "#/$defs/ResearchCoverageStatus"
        },
        "evidenceScope": {
          "$ref": "#/$defs/ResearchEvidenceScope"
        },
        "checkedDate": {
          "type": "string",
          "format": "date"
        },
        "sourceUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "method": {
          "type": "string"
        },
        "evidence": {
          "type": "string"
        },
        "constraints": {
          "type": "string"
        },
        "alternatives": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ResearchCoverageAlternative"
          }
        },
        "subtype": {
          "type": "string"
        },
        "subtypes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ResearchCoverageSubtype"
          }
        },
        "coverageStart": {
          "type": "string",
          "format": "date"
        },
        "coverageEnd": {
          "type": "string",
          "format": "date"
        },
        "recordCount": {
          "type": "integer",
          "minimum": 0
        },
        "coverageQueryUrl": {
          "type": "string",
          "format": "uri"
        },
        "countQueryUrl": {
          "type": "string",
          "format": "uri"
        },
        "liveSourceFollowup": {
          "type": "string"
        },
        "freshness": {
          "$ref": "#/$defs/ResearchCoverageFreshness"
        },
        "custodian": {
          "type": "string"
        },
        "history": {
          "type": "string"
        },
        "cost": {
          "type": "string"
        },
        "updateFrequency": {
          "type": "string"
        },
        "familyConstraints": {
          "type": "string"
        }
      }
    },
    "ResearchCoverageFamilyId": {
      "type": "string",
      "enum": [
        "city.permits",
        "city.planning_gis",
        "city.laws_governance",
        "city.finance",
        "city.procurement",
        "city.service_code",
        "city.public_safety",
        "city.health_licenses",
        "city.infrastructure",
        "city.elections_notices",
        "county.property_tax",
        "county.land_records",
        "county.courts",
        "county.procurement",
        "county.finance",
        "county.elections",
        "county.development",
        "county.gis_infrastructure",
        "county.public_safety",
        "county.health_environment",
        "county.government_records"
      ]
    },
    "ResearchCoverageFreshness": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "note": {
          "type": "string"
        },
        "latestOpenedSample": {
          "type": "string",
          "format": "date-time"
        },
        "latestFilingSample": {
          "type": "string",
          "format": "date-time"
        },
        "latestSampleRecord": {
          "type": "string"
        },
        "sourceHistoryClaim": {
          "type": "string"
        },
        "futureStatusAnomaly": {
          "type": "string",
          "format": "date-time"
        },
        "fullHistoryVerified": {
          "type": "boolean"
        }
      }
    },
    "ResearchCoverageStatus": {
      "type": "string",
      "enum": [
        "M",
        "D",
        "P",
        "R",
        "U",
        "N"
      ],
      "description": "Dated evidence level, not production ingestion status."
    },
    "ResearchCoverageSubtype": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "status",
        "reason"
      ],
      "properties": {
        "type": {
          "type": "string"
        },
        "status": {
          "$ref": "#/$defs/ResearchCoverageStatus"
        },
        "reason": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "ResearchEvidenceScope": {
      "type": "string",
      "enum": [
        "named_subtype_only",
        "source_discovery_only",
        "access_or_reuse_restriction",
        "unresolved",
        "not_applicable"
      ]
    },
    "ResearchSourceUrls": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "official",
        "openData",
        "websiteDiscovery",
        "roster",
        "censusStatus",
        "countyMembership"
      ],
      "properties": {
        "official": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "openData": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "websiteDiscovery": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "roster": {
          "type": "string",
          "format": "uri"
        },
        "censusStatus": {
          "type": "string",
          "format": "uri"
        },
        "countyMembership": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  }
}