compass.validation.location.CountyJurisdictionValidator#

class CountyJurisdictionValidator(structured_llm_caller)[source]#

Bases: LocationValidator

Validator that checks whether text applies at the county level

Parameters:

structured_llm_caller (StructuredLLMCaller) – StructuredLLMCaller instance. Used for structured validation queries.

Methods

check(content, **fmt_kwargs)

Check if the content passes the validation

Attributes

META_SCORE_KEY

SYSTEM_MESSAGE

LLM system message describing validation task

SYSTEM_MESSAGE = 'You extract structured data from legal text. Return your answer in JSON format with exactly three keys: `"x"`, `"y"`, and `"explanation"`.\n\n1. **`"x"` (boolean):**\n- Set this to `true` **only if** the text **explicitly states** that the legal regulations apply to a jurisdiction **other than** {county} County.\n- This includes cases where the regulations apply to **a subdivision** (e.g., a township or city within {county} County) or **a broader scope** (e.g., a state-wide or national regulation).\n- Set this to `false` if the regulations apply specifically to **{county} County-level governance**, to **all unincorporated areas** of {county} County, **or** if there is **not enough information** to determine the jurisdiction scope.\n\n2. **`"y"` (boolean):**\n- Set this to `true` **only if** the text **explicitly states** that the regulations apply to **more than one county**\n- Set this to `false` if the regulations apply to a **single county only** or if there is **not enough information** to determine the number of counties affected.\n\n3. **`"explanation"` (string):**\n- If either `"x"` or `"y"` is `true`, provide a short explanation **citing the specific text** that led to this conclusion.\n- If **both** are `false`, explain that there was not enough information to determine otherwise.\n\n### **Example Output:**\n\n#### Correct Cases:\n\n**Case 1 (Not Enough Information - Default to `False`)**\nInput text: `"This ordinance applies to wind energy systems."`\n```json\n{{\n  "x": false,\n  "y": false,\n  "explanation": "The legal text does not provide enough information to determine whether it applies beyond {county} County or to multiple counties."\n}}\n\n**Case 2 (Explicitly Applies to a City)**\nInput text: `"This ordinance applies the city of Sturgis."`\n```json\n{{\n  "x": true,\n  "y": false,\n  "explanation": "The legal text explicitly states that it applies to the city of Sturgis, which is a subdivision of a county."\n}}\n\n**Case 3 (Explicitly Applies to Multiple Counties)**\nInput text: `"These regulations apply to all counties in {state}."`\n```json\n{{\n  "x": false,\n  "y": true,\n  "explanation": "The legal text explicitly states that it applies to multiple (all) counties in {state}."\n}}\n\n**Case 4 (Explicitly Applies to {county} County, {state})**\nInput text: `"This ordinance applies to {county} County, {state}."`\n```json\n{{\n  "x": false,\n  "y": false,\n  "explanation": "The legal text explicitly states that it applies to {county} County, {state}."\n}}\n'#

LLM system message describing validation task

async check(content, **fmt_kwargs)#

Check if the content passes the validation

The exact validation is outlined in the class SYSTEM_MESSAGE.

Parameters:
  • content (str) – Document content to validate.

  • **fmt_kwargs – Keyword arguments to be passed to SYSTEM_MESSAGE.format().

Returns:

boolTrue if the content passes the validation check, False otherwise.