Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions compass/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
"""Ordinance document download and structured data extraction"""

from dotenv import load_dotenv

from ._version import __version__
from .utilities.logs import setup_logging_levels, COMPASS_DEBUG_LEVEL

# Temporarily import to register plugins
# Can drop once plugins register themselves
from .extraction import (
COMPASSGeoHeatPumpExtractor,
COMPASSGeoElectricityExtractor,
COMPASSGeoRMPExtractor,
COMPASSSmallWindExtractor,
COMPASSSolarExtractor,
COMPASSWindExtractor,
TexasWaterRightsExtractor,
)

load_dotenv()
setup_logging_levels()
10 changes: 6 additions & 4 deletions compass/_cli/finalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from rich.theme import Theme
from rich.console import Console

from compass.plugin.registry import PLUGIN_REGISTRY
from compass.utilities import Directories
from compass.utilities.io import load_config
from compass.utilities.jurisdictions import Jurisdiction
Expand Down Expand Up @@ -66,7 +67,7 @@ def finalize(config):
console.print("Compiling databases...")
jurisdictions = jurisdictions.get("jurisdictions", [])

_compile_db(jurisdictions, dirs)
_compile_db(jurisdictions, dirs, tech)

console.print("Saving meta info...")
num_jurisdictions_searched = len(jurisdictions)
Expand All @@ -88,7 +89,7 @@ def finalize(config):
console.print(f"✅ Finalized COMPASS run in {dirs.out!s}!")


def _compile_db(jurisdictions, dirs):
def _compile_db(jurisdictions, dirs, tech):
"""Merge all jurisdiction dbs into one"""
all_doc_infos = []
for jur_info in jurisdictions:
Expand Down Expand Up @@ -117,5 +118,6 @@ def _compile_db(jurisdictions, dirs):
{"ord_db_fp": ord_db_fp, "jurisdiction": jurisdiction}
)

db, __ = doc_infos_to_db(all_doc_infos)
save_db(db, dirs.out)
out_cols = PLUGIN_REGISTRY[tech].OUTPUT_COLUMNS
db, __ = doc_infos_to_db(all_doc_infos, out_cols)
save_db(db, dirs.out, out_cols)
167 changes: 167 additions & 0 deletions compass/data/rmp_jurisdictions.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
State,County,Subdivision,Jurisdiction Type,FIPS,Website
AK,,Bay_RMP,RMP_Resource_Management_Plan,58891654,
AK,,Bering_Sea-Western_Interior_RMP,RMP_Resource_Management_Plan,50065852,
AK,,Central_Yukon_RMP_Revision_proposed,RMP_Resource_Management_Plan,88244868,
AK,,Draanjik_RMP,RMP_Resource_Management_Plan,76528034,
AK,,East_Alaska_RMP,RMP_Resource_Management_Plan,12789119,
AK,,Fort_Greely_RMP,RMP_Resource_Management_Plan,145246,
AK,,Fort_Wainwright_RMP,RMP_Resource_Management_Plan,28335718,
AK,,Kobuk_Seward_Peninsula_RMP,RMP_Resource_Management_Plan,73124680,
AK,,Ring_of_Fire_RMP,RMP_Resource_Management_Plan,40701468,
AZ,,Agua_Fria_NM_RMP,RMP_Resource_Management_Plan,91052984,
AZ,,Arizona_Strip_Field_Office_RMP,RMP_Resource_Management_Plan,80496010,
AZ,,Bradshaw_Harquahala_RMP,RMP_Resource_Management_Plan,65114804,
AZ,,Grand_Canyon-Parashant_NM_RMP,RMP_Resource_Management_Plan,53431245,
AZ,,Ironwood_Forest_NM_RMP,RMP_Resource_Management_Plan,41571498,
AZ,,Kingman_RMP,RMP_Resource_Management_Plan,94532898,
AZ,,Lake_Havasu_Field_Office_RMP,RMP_Resource_Management_Plan,737252,
AZ,,Las_Cienegas_RMP,RMP_Resource_Management_Plan,71912775,
AZ,,Phoenix_RMP,RMP_Resource_Management_Plan,61984530,
AZ,,Safford_District_RMP,RMP_Resource_Management_Plan,99160383,
AZ,,San_Pedro_Riparian_National_Conservation_Area_RMP,RMP_Resource_Management_Plan,98788395,
AZ,,Sonoran_Desert_NM_RMP,RMP_Resource_Management_Plan,76471287,
AZ,,Vermilion_Cliffs_NM_RMP,RMP_Resource_Management_Plan,29865380,
AZ,,Yuma_Field_Office_RMP,RMP_Resource_Management_Plan,86211833,
CA,,Alturas_RMP,RMP_Resource_Management_Plan,85572075,
CA,,Bakersfield_ROD_&_Approved_RMP,RMP_Resource_Management_Plan,99911428,
CA,,Bishop_Field_Office_RMP,RMP_Resource_Management_Plan,41389155,
CA,,California_Coastal_NM_RMP,RMP_Resource_Management_Plan,74326555,
CA,,California_Desert_Conservation_Area_Plan,RMP_Resource_Management_Plan,77257162,
CA,,Carrizo_Plain_NM_Approved_RMP,RMP_Resource_Management_Plan,87487361,
CA,,Clear_Creek_Management_Area_Proposed_RMP,RMP_Resource_Management_Plan,20322133,
CA,,Eagle_Lake_Field_Office_RMP_and_EIS,RMP_Resource_Management_Plan,81360063,
CA,,Eastern_San_Diego_County_RMP_&_ROD,RMP_Resource_Management_Plan,56019402,
CA,,Headwaters_Forest_Reserve_RMP_and_ROD,RMP_Resource_Management_Plan,1925220,
CA,,King_Range_NCA_RMP_and_ROD,RMP_Resource_Management_Plan,50294440,
CA,,Northwest_California_Integrated_RMP_Revision_proposed,RMP_Resource_Management_Plan,28373463,
CA,,Sierra_RMP_and_ROD,RMP_Resource_Management_Plan,64978099,
CA,,South_Coast_RMP_and_ROD,RMP_Resource_Management_Plan,70257488,
CA,,Southern_Diablo_Mountain_Range_and_Central_Coast_of_Californ,RMP_Resource_Management_Plan,1311864,
CA,,Surprise_RMP_ROD,RMP_Resource_Management_Plan,5765283,
CA,,Ukiah_RMP,RMP_Resource_Management_Plan,3279363,
CO,,Browns_Canyon_NM_RMP,RMP_Resource_Management_Plan,22907548,
CO,,Canyons_of_the_Ancients_NM_RMP,RMP_Resource_Management_Plan,27732763,
CO,,Colorado_River_Valley_Field_Office_RMP,RMP_Resource_Management_Plan,97921160,
CO,,Dominguez-Escalante_NCA_RMP,RMP_Resource_Management_Plan,32592106,
CO,,Eastern_Colorado_RMP_Revision_proposed,RMP_Resource_Management_Plan,21568440,
CO,,Grand_Junction_Field_Office_RMP,RMP_Resource_Management_Plan,67272052,
CO,,Gunnison_Gorge_NCA_RMP,RMP_Resource_Management_Plan,72599971,
CO,,Gunnison_Resource_Area_RMP,RMP_Resource_Management_Plan,36211355,
CO,,Kremmling_RMP,RMP_Resource_Management_Plan,94278387,
CO,,Little_Snake_RMP,RMP_Resource_Management_Plan,65371173,
CO,,McInnis_Canyons_NCA_RMP,RMP_Resource_Management_Plan,44871622,
CO,,San_Luis_Resource_Area_RMP,RMP_Resource_Management_Plan,88268922,
CO,,Tres_Rios_Field_Office_RMP,RMP_Resource_Management_Plan,83907713,
CO,,Uncompahgre_RMP,RMP_Resource_Management_Plan,34150003,
CO,,White_River_Field_Office_RMP,RMP_Resource_Management_Plan,11902779,
ES,,Alabama_RMP,RMP_Resource_Management_Plan,14797696,
ES,,Florida_RMP,RMP_Resource_Management_Plan,95600383,
ES,,Illinois_RMP,RMP_Resource_Management_Plan,93453295,
ES,,Michigan_RMP,RMP_Resource_Management_Plan,26182278,
ES,,Minnesota_MFP,RMP_Resource_Management_Plan,13778191,
ES,,Missouri_RMP,RMP_Resource_Management_Plan,67092820,
ES,,Wisconsin_RMP,RMP_Resource_Management_Plan,75739247,
ID,,Bennett_Hills_Timmerman_Hills_MFP,RMP_Resource_Management_Plan,81790701,
ID,,Big_Desert_MFP,RMP_Resource_Management_Plan,84522543,
ID,,Big_Lost_MFP,RMP_Resource_Management_Plan,60403369,
ID,,Bruneau_MFP,RMP_Resource_Management_Plan,18575811,
ID,,Cassia_RMP,RMP_Resource_Management_Plan,80586106,
ID,,Challis_RMP,RMP_Resource_Management_Plan,84849736,
ID,,Coeur_d'Alene_RMP,RMP_Resource_Management_Plan,77822719,
ID,,Cottonwood_RMP,RMP_Resource_Management_Plan,61739039,
ID,,Craters_of_the_Moon_Monument_RMP,RMP_Resource_Management_Plan,99809881,
ID,,Four_Rivers_Field_Office_RMP_Revision_proposed,RMP_Resource_Management_Plan,3941354,
ID,,Jarbidge_RMP,RMP_Resource_Management_Plan,67339645,
ID,,Lemhi_RMP,RMP_Resource_Management_Plan,37020393,
ID,,Little_Lost_and_Birch_Creek_MFP,RMP_Resource_Management_Plan,4531220,
ID,,Magic_MFP,RMP_Resource_Management_Plan,79311181,
ID,,Medicine_Lodge_RMP,RMP_Resource_Management_Plan,35884558,
ID,,Monument_RMP,RMP_Resource_Management_Plan,80677084,
ID,,Morley_Nelson_Snake_River_Birds_of_Prey_RMP,RMP_Resource_Management_Plan,16215809,
ID,,Owyhee_RMP,RMP_Resource_Management_Plan,61818628,
ID,,Pocatello_RMP,RMP_Resource_Management_Plan,29729378,
ID,,Sun_Valley_MFP,RMP_Resource_Management_Plan,43040853,
MT,,Billings_Field_Office_RMP,RMP_Resource_Management_Plan,46147967,
MT,,Butte_Field_Office_Approved_RMP,RMP_Resource_Management_Plan,28147387,
MT,,Dillon_RMP,RMP_Resource_Management_Plan,34399012,
MT,,HiLine_RMP,RMP_Resource_Management_Plan,73749051,
MT,,Lewistown_RMP_and_EIS,RMP_Resource_Management_Plan,13183292,
MT,,Miles_City_Field_Office_RMP,RMP_Resource_Management_Plan,97076346,
MT,,Missoula_Field_Office_RMP_and_EIS,RMP_Resource_Management_Plan,17045292,
MT,,North_Dakota_RMP_Revision_and_EIS_proposed,RMP_Resource_Management_Plan,54876233,
MT,,Pompeys_Pillar_RMP,RMP_Resource_Management_Plan,28758168,
MT,,South_Dakota_RMP,RMP_Resource_Management_Plan,79949953,
MT,,Upper_Missouri_River_Breaks_NM_ROD_and_Approved_RMP,RMP_Resource_Management_Plan,40143545,
NM,,Carlsbad_RMP,RMP_Resource_Management_Plan,85819939,
NM,,El_Malpais_NCA_RMP,RMP_Resource_Management_Plan,78985957,
NM,,Farmington_RMP,RMP_Resource_Management_Plan,98791451,
NM,,Kasha-Katuwe_Tent_Rocks_NM_RMP,RMP_Resource_Management_Plan,97759534,
NM,,Mimbres_RMP,RMP_Resource_Management_Plan,62451792,
NM,,"Oklahoma,_Kansas,_and_Texas_RMP",RMP_Resource_Management_Plan,89755973,
NM,,Organ_Mountains-Desert_Peaks_National_Monument_RMP_Developme,RMP_Resource_Management_Plan,72844604,
NM,,Prehistoric_Trackways_NM_RMP,RMP_Resource_Management_Plan,53295310,
NM,,Rio_Puerco_RMP_Revision_proposed,RMP_Resource_Management_Plan,84022284,
NM,,Roswell_RMP,RMP_Resource_Management_Plan,12328195,
NM,,Taos_RMP,RMP_Resource_Management_Plan,27096808,
NM,,The_Socorro_Field_Office_RMP,RMP_Resource_Management_Plan,62817657,
NM,,TriCounty_RMP_Revision_proposed,RMP_Resource_Management_Plan,1833400,
NM,,White_Sands_RMP,RMP_Resource_Management_Plan,42605400,
NV,,Black_Rock_Desert-High_Rock_Canyon_NCA_RMP,RMP_Resource_Management_Plan,67949345,
NV,,Carson_City_District_RMP_Revision_proposed,RMP_Resource_Management_Plan,64923924,
NV,,Carson_City_Field_Office_Consolidated_RMP,RMP_Resource_Management_Plan,82348138,
NV,,Ely_RMP,RMP_Resource_Management_Plan,65721226,
NV,,Las_Vegas_RMP,RMP_Resource_Management_Plan,29181757,
NV,,Nevada_Test_and_Training_Range_RMP,RMP_Resource_Management_Plan,75571370,
NV,,Red_Rock_Canyon_NCA_RMP,RMP_Resource_Management_Plan,39640186,
NV,,Shoshone-Eureka_RMP,RMP_Resource_Management_Plan,9556286,
NV,,Sloan_Canyon_NCA_RMP,RMP_Resource_Management_Plan,51698554,
NV,,Tonopah_RMP,RMP_Resource_Management_Plan,15400829,
NV,,Wells_RMP,RMP_Resource_Management_Plan,80574229,
NV,,Winnemucca_District_RMP,RMP_Resource_Management_Plan,86689024,
OR,,Andrews_Management_Area_RMP,RMP_Resource_Management_Plan,35881933,
OR,,Baker_Field_Office_RMP,RMP_Resource_Management_Plan,49949509,
OR,,Brothers_La_Pine_RMP_and_ROD,RMP_Resource_Management_Plan,25377003,
OR,,Cascade-Siskiyou_NM_RMP_Revision_proposed,RMP_Resource_Management_Plan,43436158,
OR,,John_Day_Basin_RMP,RMP_Resource_Management_Plan,1307849,
OR,,Lakeview_RMP,RMP_Resource_Management_Plan,88555014,
OR,,Northwestern_and_Coastal_Oregon_RMP,RMP_Resource_Management_Plan,76729348,
OR,,San_Juan_Islands_NM_RMP_Development_proposed,RMP_Resource_Management_Plan,72230698,
OR,,Spokane_District_RMP,RMP_Resource_Management_Plan,90070508,
OR,,Steens_Mountain_Cooperative_Management_and_Protection_Area_R,RMP_Resource_Management_Plan,25804071,
OR,,Three_Rivers_RMP_and_ROD,RMP_Resource_Management_Plan,61295012,
OR,,Two_Rivers_RMP_and_ROD,RMP_Resource_Management_Plan,69118165,
OR,,Upper_Deschutes_RMP,RMP_Resource_Management_Plan,86158415,
OR,,Upper_Klamath_Basin_and_Wood_River_Wetland_ROD_and_RMP,RMP_Resource_Management_Plan,44586561,
OR,,West_Eugene_Wetlands_RMP,RMP_Resource_Management_Plan,90944763,
UT,,Bears_Ears_NM_RMP_Revision_proposed,RMP_Resource_Management_Plan,9969233,
UT,,Box_Elder_RMP,RMP_Resource_Management_Plan,48914597,
UT,,Cedar_Beaver_Garfield_Antimony_ROD_and_RMP,RMP_Resource_Management_Plan,47369722,
UT,,Cedar_City_RMP_Revision_proposed,RMP_Resource_Management_Plan,54185302,
UT,,Grand_Staircase-Escalante_NM_RMP_Revision_proposed,RMP_Resource_Management_Plan,75713142,
UT,,House_Range_Resource_Area_RMP_and_ROD,RMP_Resource_Management_Plan,6748568,
UT,,Isolated_Tract_Planning_Analysis,RMP_Resource_Management_Plan,29430495,
UT,,Kanab_Field_Office_ROD_and_Approved_RMP,RMP_Resource_Management_Plan,30070478,
UT,,Moab_Field_Office_ROD_and_Approved_RMP,RMP_Resource_Management_Plan,35629161,
UT,,Monticello_RMP,RMP_Resource_Management_Plan,5029659,
UT,,Park_City_MFP,RMP_Resource_Management_Plan,21186216,
UT,,Pinyon_MFP,RMP_Resource_Management_Plan,53103483,
UT,,Pony_Express_RMP,RMP_Resource_Management_Plan,22296049,
UT,,Price_RMP,RMP_Resource_Management_Plan,59016563,
UT,,Randolph_MFP,RMP_Resource_Management_Plan,23712262,
UT,,Red_Cliffs_NCA_RMP,RMP_Resource_Management_Plan,23101027,
UT,,Richfield_Field_Office_ROD_and_Approved_RMP,RMP_Resource_Management_Plan,45041856,
UT,,St._George_Field_Office_ROD_and_RMP,RMP_Resource_Management_Plan,43863639,
UT,,Vernal_Field_Office_ROD_and_Approved_RMP,RMP_Resource_Management_Plan,16333472,
UT,,Warm_Springs_Resource_Area_Approved_RMP_ROD,RMP_Resource_Management_Plan,97347060,
WY,,Buffalo_RMP,RMP_Resource_Management_Plan,40451061,
WY,,Casper_RMP,RMP_Resource_Management_Plan,36548831,
WY,,Cody_RMP,RMP_Resource_Management_Plan,11419523,
WY,,Kemmerer_RMP,RMP_Resource_Management_Plan,18907881,
WY,,Lander_RMP,RMP_Resource_Management_Plan,44340490,
WY,,Nebraska_RMP,RMP_Resource_Management_Plan,44565171,
WY,,Newcastle_&_Nebraska_RMPs_Revision_proposed,RMP_Resource_Management_Plan,91663595,
WY,,Newcastle_RMP,RMP_Resource_Management_Plan,24790466,
WY,,Pinedale_RMP,RMP_Resource_Management_Plan,91339324,
WY,,Rawlins_RMP,RMP_Resource_Management_Plan,65447033,
WY,,Rock_Springs_RMP_Revision_proposed,RMP_Resource_Management_Plan,30630964,
WY,,Snake_River_RMP,RMP_Resource_Management_Plan,37751410,
2 changes: 2 additions & 0 deletions compass/extraction/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# Temporarily import to register plugins
# Can drop once plugins register themselves
from .ghp import COMPASSGeoHeatPumpExtractor
from .geothermal_electricity import COMPASSGeoElectricityExtractor
from .rmp import COMPASSGeoRMPExtractor
from .small_wind import COMPASSSmallWindExtractor
from .solar import COMPASSSolarExtractor
from .water import TexasWaterRightsExtractor
Expand Down
14 changes: 14 additions & 0 deletions compass/extraction/geothermal_electricity/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""COMPASS Geothermal Electricity plugin"""

import importlib.resources

from compass.plugin import create_schema_based_one_shot_extraction_plugin


COMPASSGeoElectricityExtractor = (
create_schema_based_one_shot_extraction_plugin(
importlib.resources.files("compass.extraction.geothermal_electricity")
/ "plugin_config.yaml",
tech="geothermal",
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,4 @@ heuristic_keywords:
- "cannabis cultivation"
- "commercial cannabis"

collection_prompts: True
collection_prompts: True
11 changes: 11 additions & 0 deletions compass/extraction/rmp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""COMPASS Geothermal Resource Management Plan plugin"""

import importlib.resources

from compass.plugin import create_schema_based_one_shot_extraction_plugin


COMPASSGeoRMPExtractor = create_schema_based_one_shot_extraction_plugin(
importlib.resources.files("compass.extraction.rmp") / "plugin_config.yaml",
tech="geo_rmp",
)
83 changes: 83 additions & 0 deletions compass/extraction/rmp/plugin_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# One-shot plugin configuration for geothermal restriction extraction from
# BLM Resource Management Plan (RMP) documents.
#
# Usage:
# compass process -c config.json5 -p plugin_config.yaml
#
# Or with pixi:
# pixi run --manifest-path "<path-to-COMPASS>/pixi.toml" \
# compass process -c config.json5 -p plugin_config.yaml

schema: ./rmp_schema.json

data_type_short_desc: geothermal leasing restriction in BLM Resource Management Plan

# Keyword-based heuristic for quickly filtering text chunks before LLM calls.
heuristic_keywords:
good_tech_keywords:
- "geothermal"
- "leasing"
- "stipulation"
- "closure"
- "drilling"
- "mineral"
- "nso"
good_tech_acronyms:
- "nso"
- "rmp"
- "blm"
- "tlm"
- "esa"
good_tech_phrases:
- "no surface occupancy"
- "surface disturbance"
- "geothermal leasing"
- "geothermal development"
- "geothermal exploration"
- "mineral leasing"
- "no surface occupancy"
- "surface-disturbing activities"
- "timing limitation"
- "lease stipulation"
- "closed to leasing"
- "open to leasing"
- "geothermal resources"
- "resource management plan"
- "land withdrawal"
not_tech_words:
- "grazing allotment"
- "livestock"
- "recreation permit"
- "campground"
- "trail maintenance"
- "off-highway vehicle"
- "ohv route"
- "land disposal"
- "land sale"
- "residential"
- "wildfire"
- "prescribed burn"
- "hunting permit"
- "fishing"

# Collection prompts filter individual text chunks extracted from the PDF.
# Chunks that pass are passed to the text extraction step.
# Setting to True auto-generates prompts from the schema.
collection_prompts: True

# System prompt used during the final structured extraction LLM call.
extraction_system_prompt: |-
You are an expert analyst specializing in BLM Resource Management Plans (RMPs)
and federal mineral leasing regulations. Your task is to extract structured data
about geothermal leasing restrictions from RMP document text.
Follow all instructions in the schema field descriptions carefully.
Only extract restrictions that directly constrain geothermal leasing, exploration,
drilling, or facility construction on BLM lands. Each distinct restriction should
be its own row in the outputs array. Use direct text excerpts and quotes in the
summary field wherever possible.

cache_llm_generated_content: true

# Allows a single jurisdiction entry to span multiple PDF documents,
# which is typical for RMPs that are split across many files.
doc_selection_method: multi-doc-all
Loading
Loading