Skip to content
Merged
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
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@ new contract is not evidence that a number moved.

## Data contracts

### 1.22.0 - 2026-11-18

**`ref_price_source` says what each reference price is. No number moves.**
Until now every reference row carried "USGS/LME/mineralogy reference", which
read as a quote for rows that have none (General_Research rc-455, rc-456,
rc-589 to rc-595, rc-621 to rc-623). Now a row with no reference price says
it has no direct quote and is unpriced on the Earth route by design, any
value being its yields at refined-element prices, a gross contained-element
proxy (20 rows: the Fe-Ni alloys, magnetite, chromite, ilmenite, troilite,
schreibersite, the sulfides and the rare PGM phases). The five bulk silicates'
$0.05/kg is labelled an engineering placeholder. Every other row keeps the
series label.

In the `tests/data/prices-2026-10-07/` fixtures, which are re-recorded, only
`ref_price_source` (those 25 rows) and the stamp move; every price, yield and
value column is identical to 1.21.0.

### 1.21.0 - 2026-11-12

**spacecost v0.14.0 → v0.17.1, and the delivery chains move.** Nothing in this
Expand Down Expand Up @@ -135,6 +152,14 @@ code.

## Package releases

### 0.8.0 - 2026-11-18

Data contract **1.21.0 → 1.22.0**: the reference rows' `ref_price_source`
column is now set per row (see the contract entry above), and the fixtures
are re-recorded for that column and the stamp. No price, yield or value
moves. Nothing reaches economicspace until a `prices-*` release is built on
it and Stage 2 repins.

### 0.7.3 - 2026-11-18

Data contract 1.21.0, unchanged, and **no number moves**: comments in
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ and on 3.11 they come out one bit different.
## Two version numbers

- **The data contract**, `MineralValueConfig.pipeline_version`, currently
`1.21.0`. Stamped into every row. It moves when a change moves any number a
`1.22.0`. Stamped into every row. It moves when a change moves any number a
build produces, and its history is economicspace's Stage 2 changelog up to
1.16.0 and [CHANGELOG.md](CHANGELOG.md) from there.
- **The package**, `spacevalue.__version__`. It moves for anything else.
Expand Down
2 changes: 1 addition & 1 deletion spacevalue/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

# The PACKAGE release. Not the data contract: that is
# `MineralValueConfig.pipeline_version`, stamped into every row.
__version__ = "0.7.3"
__version__ = "0.8.0"

# Each public name, and the submodule that defines it.
_LAZY = {name: "catalog" for name in (
Expand Down
39 changes: 37 additions & 2 deletions spacevalue/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class MineralValueConfig:
# What each contract changed is CHANGELOG.md, not this comment: the
# dashboard economicspace builds scrapes a field's comment block as its
# help, and a changelog here was once 267 lines of it.
pipeline_version: str = "1.21.0"
pipeline_version: str = "1.22.0"

# ─── DISPLAY ─────────────────────────────────────────────────────────────
preview_rows: int = 20 # rows per table in the CLI preview
Expand Down Expand Up @@ -2501,6 +2501,41 @@ def fetch_metals_dev(config: MineralValueConfig) -> pd.DataFrame:
# so it always succeeds; downstream merge uses it to fill the gaps left by
# the live sources.

# WHAT `ref_price_source` SAYS, row by row (data contract 1.22.0). Until
# then every row carried "USGS/LME/mineralogy reference", which read as a quote
# for rows that have none (General_Research rc-455, rc-456, rc-589 to rc-595,
# rc-621 to rc-623). Now:
# * a row with no reference price says so. Such a phase has no market of
# its own here, and is unpriced on the Earth route by design: where it has
# value at all it is cargo._mineral_implied_value's sum of its yields at
# refined-element prices, with no payable fraction, treatment or refining
# charge, a gross contained-element proxy and not an ore or concentrate
# quote. That covers the Fe-Ni alloys, magnetite, chromite, ilmenite,
# troilite, schreibersite, the sulfides and the rare PGM phases;
# * the five bulk silicates' $0.05/kg is an engineering placeholder with no
# matched product, grade, delivery point or date (the olivine row's
# "industrial olivine sand" names a product, not a quote);
# * every other row keeps the series label, and its own `notes` name the
# figure.
_SOURCE_SERIES = "USGS/LME/mineralogy reference"
_SOURCE_NONE = ("no direct quote: unpriced on the Earth route; any value is "
"its yields at refined-element prices, a gross "
"contained-element proxy")
_SOURCE_PLACEHOLDER = ("engineering placeholder: no matched product, grade, "
"delivery point or date")
_PLACEHOLDER_PRICE_ROWS = frozenset({"olivine", "pyroxene", "orthopyroxene",
"enstatite", "silicates"})


def _reference_source(name: str, ref_price) -> str:
"""The `ref_price_source` a reference row carries; see the block above."""
if ref_price is None:
return _SOURCE_NONE
if name in _PLACEHOLDER_PRICE_ROWS:
return _SOURCE_PLACEHOLDER
return _SOURCE_SERIES


def fetch_reference_table(config: MineralValueConfig) -> pd.DataFrame:
"""Static USGS / LME / mineralogy reference data, always available."""
say("\n Reference table - loading curated prices + densities ...")
Expand All @@ -2523,7 +2558,7 @@ def fetch_reference_table(config: MineralValueConfig) -> pd.DataFrame:
"density_gcm3": entry["density_gcm3"],
"ref_price_usd_per_kg": ref_price,
"ref_price_date": entry.get("ref_price_date"),
"ref_price_source": "USGS/LME/mineralogy reference",
"ref_price_source": _reference_source(entry["name"], ref_price),
"value_basis": value_basis,
"notes": notes,
"yields_json": json.dumps(entry.get("yields", {})),
Expand Down
Loading
Loading