compass.validation.location.CountyValidator#

class CountyValidator(structured_llm_caller, score_thresh=0.8, text_splitter=None)[source]#

Bases: object

COMPASS Ordinance County validator

Combines the logic of several validators into a single class.

Purpose:

Determine whether a document pertains to a specific county.

Responsibilities:
  1. Use a combination of heuristics and LLM queries to determine whether or not a document pertains to a particular county.

Key Relationships:

Uses a StructuredLLMCaller for LLM queries and delegates sub-validation to CountyNameValidator, CountyJurisdictionValidator, and URLValidator.

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

  • score_thresh (float, optional) – Score threshold to exceed when voting on content from raw pages. By default, 0.8.

  • text_splitter (langchain.text_splitter.TextSplitter, optional) – Optional text splitter instance to attach to doc (used for splitting out pages in an HTML document). By default, None.

Methods

check(doc, county, state)

Check if the document belongs to the county

async check(doc, county, state)[source]#

Check if the document belongs to the county

Parameters:
  • doc (elm.web.document.BaseDocument) – Document instance. Should contain a “source” key in the attrs that contains a URL (used for the URL validation check). Raw content will be parsed for county name and correct jurisdiction.

  • county (str) – County that document should belong to.

  • state (str) – State corresponding to county input.

Returns:

boolTrue if the doc contents pertain to the input county. False otherwise.