Metadata-Version: 2.5
Name: oak-domain-energy
Version: 0.1.2
Summary: U.S. electricity intelligence domain for OakQuant
License-Expression: Apache-2.0
License-File: LICENSE
Requires-Python: >=3.13
Provides-Extra: dev
Requires-Dist: build<2,>=1.2; extra == 'dev'
Requires-Dist: pytest<9,>=8.4; extra == 'dev'
Provides-Extra: events
Requires-Dist: timber-common<2,>=1.8.0; extra == 'events'
Description-Content-Type: text/markdown

# OakQuant Energy

U.S. electricity intelligence for utilities, policy teams, and households. The V1 design follows the forecast, evidence, and evaluation practices of OakQuant Investments.

- [V1 build plan and documentation index](docs/README.md)
- [Dashboard and map prototype](docs/prototype/index.html)
- [Application flows and benefits](docs/application-flows-and-benefits.md)

The package contains local source adapters, a forecast ledger, the national Census catalog, household and procurement calculations, and the utility review integrations. The prototype runs in a browser with illustrative data. See the testing guide for the distinction between verified component behavior, local runtime tests, and pilot readiness.

The software is licensed under the Apache License, Version 2.0. The bundled geography catalog and map layers use the U.S. Census Bureau's [2024 cartographic boundary files](https://www.census.gov/geographies/mapping-files/2024/geo/carto-boundary-file.html) and [2024 American Community Survey five-year geography file](https://www.census.gov/programs-surveys/acs/data/summary-file.2024.html).

### Durable forecast history

The Timber domain plugin registers `energy.issued_forecasts` against its injected
DB service. `EnergyForecastIssue` and `EnergyForecastSettlement` add two tables to
Timber's shared metadata; normal startup table creation provisions them. Existing
SQLite issuance remains unchanged. `ENERGY_LOCAL_LEDGER_PATH` still explicitly
selects the local reader in development/test and is rejected in production.

The service provides `get_as_issued`, `replay`, and bounded `history` with the same
enterprise-scoped read contract as the local reader. A trusted importer calls
`import_record(enterprise_id=..., issue=..., settlement=...)` with complete frozen
receipts. The issue and optional label commit atomically. Exact retries are no-ops;
conflicting evidence raises `RecordConflict`. A settlement may arrive later, but
can never replace a prior label. Reads never train or issue a model. Synthetic
provenance stays in every stored issue and history response.

Run `python -m pytest -q tests/persistence` for SQLite transaction coverage. CI runs
the same tests against an isolated PostgreSQL service through
`ENERGY_TEST_DATABASE_URL`. This test database must be disposable: its two Energy
history tables are recreated per test. Never point it at an application database.
