babylon.engine.headless_runner.scopes
Predefined scope resolver for the headless simulation runner.
Resolves a scope name like "michigan-canada" into a concrete
(scope_fips, external_node_ids) pair. The four canonical scopes
match contracts/cli_contract.yaml.
The Michigan FIPS list is enumerated from
data/sqlite/marxist-data-3NF.sqlite (dim_county filtered to state
26, excluding the synthetic 26999 rest-of-state code). The national
list is resolved lazily by querying SQLite at scope-resolution time —
hard-coding ~3,200 codes here would create unnecessary maintenance churn
when TIGER vintages bump.
Functions
|
Resolve a predefined scope name to its concrete FIPS + externals. |
Classes
|
Concrete scope resolution: county FIPS + external boundary nodes. |
Exceptions
Raised when an unrecognized scope name is requested. |
- class babylon.engine.headless_runner.scopes.Scope(scope_fips, external_node_ids)[source]
Bases:
NamedTupleConcrete scope resolution: county FIPS + external boundary nodes.
- exception babylon.engine.headless_runner.scopes.UnknownScopeError[source]
Bases:
ValueErrorRaised when an unrecognized scope name is requested.
- babylon.engine.headless_runner.scopes.resolve_scope(name, *, sqlite_path=DEFAULT_SQLITE_PATH)[source]
Resolve a predefined scope name to its concrete FIPS + externals.
- Parameters:
- Return type:
- Returns:
Scope tuple with
scope_fipsandexternal_node_ids.- Raises:
UnknownScopeError – If
nameis not a recognized scope.FileNotFoundError – If
name == "national"andsqlite_pathdoes not exist.