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
1 change: 1 addition & 0 deletions changelog.d/migrate-trov-namespace-canonical.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Migrated TRACE TRO emission from the prerelease TROv namespace `https://w3id.org/trace/2023/05/trov#` to the canonical `https://w3id.org/trace/trov/0.1#`. This aligns policyengine.py with policyengine-us-data (which already uses the canonical namespace per us-data PR #746), so both sides can share SHACL validators and TROs emitted by either side validate against the same vocabulary. Fixes #313.
2 changes: 1 addition & 1 deletion docs/release-bundles.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ composition pins four artifacts by sha256:
when present, otherwise fetched from the PyPI JSON API at emit time)

TROs use the public TROv vocabulary at
`https://w3id.org/trace/2023/05/trov#`. Every artifact location in the TRO
`https://w3id.org/trace/trov/0.1#`. Every artifact location in the TRO
is a dereferenceable HTTPS URI or a local path relative to the shipped
wheel. Certification metadata is carried as structured `pe:*` fields on
the `trov:TransparentResearchPerformance` node so downstream tooling can
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies = [
"pydantic>=2.0.0",
"pandas>=2.0.0",
"microdf_python>=1.2.1",
"jsonschema>=4.0.0",
"requests>=2.31.0",
"psutil>=5.9.0",
"packaging>=23.0",
Expand Down Expand Up @@ -55,7 +56,6 @@ dev = [
"yaml-changelog>=0.1.7",
"itables",
"build",
"jsonschema>=4.0.0",
"plotly>=5.0.0",
"pytest-asyncio>=0.26.0",
"ruff>=0.9.0",
Expand Down
2 changes: 1 addition & 1 deletion src/policyengine/data/schemas/trace_tro.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"properties": {
"trov": {
"type": "string",
"const": "https://w3id.org/trace/2023/05/trov#"
"const": "https://w3id.org/trace/trov/0.1#"
},
"schema": {
"type": "string",
Expand Down
4 changes: 2 additions & 2 deletions src/policyengine/provenance/trace.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""TRACE Transparent Research Object (TRO) export.

Emits JSON-LD that conforms to the TRACE TROv vocabulary
(https://w3id.org/trace/2023/05/trov#) for a PolicyEngine certified
(https://w3id.org/trace/trov/0.1#) for a PolicyEngine certified
runtime bundle or a PolicyEngine simulation result. The bundle TRO pins
the country model wheel, the country data release manifest, the
certified dataset, and the bundle manifest itself by sha256. The
Expand Down Expand Up @@ -33,7 +33,7 @@
https_release_manifest_uri,
)

TRACE_TROV_NAMESPACE = "https://w3id.org/trace/2023/05/trov#"
TRACE_TROV_NAMESPACE = "https://w3id.org/trace/trov/0.1#"
POLICYENGINE_TRACE_NAMESPACE = "https://policyengine.org/trace/0.1#"

TRACE_CONTEXT: list[dict[str, str]] = [
Expand Down
7 changes: 0 additions & 7 deletions tests/test_graph/test_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ class TestDirectEntityReference:
"""Pattern 1: ``entity("<var>", period)`` produces an edge."""

def test_single_direct_reference(self, tmp_path: Path) -> None:

root = tmp_path / "variables"
_write_variable(
root,
Expand Down Expand Up @@ -153,7 +152,6 @@ class TestAddHelperReference:
"""Pattern 2: ``add(entity, period, [...])`` emits one edge per list item."""

def test_add_helper_list(self, tmp_path: Path) -> None:

root = tmp_path / "variables"
_write_variable(
root,
Expand All @@ -175,7 +173,6 @@ class TestImpactAnalysis:
"""``impact(var)`` returns variables that depend on ``var`` transitively."""

def test_transitive_upstream(self, tmp_path: Path) -> None:

root = tmp_path / "variables"
_write_variable(root, "wages", "return 0")
_write_variable(
Expand Down Expand Up @@ -228,7 +225,6 @@ class TestMultipleFormulas:
"""Year-specific ``formula_YYYY`` methods contribute edges too."""

def test_year_specific_formula_contributes_edges(self, tmp_path: Path) -> None:

root = tmp_path / "variables"
(root / "ctc.py").parent.mkdir(parents=True, exist_ok=True)
(root / "ctc.py").write_text(
Expand Down Expand Up @@ -260,7 +256,6 @@ class TestPath:
"""``path(src, dst)`` returns a dependency chain if one exists."""

def test_path_two_hops(self, tmp_path: Path) -> None:

root = tmp_path / "variables"
_write_variable(root, "wages", "return 0")
_write_variable(root, "gross_income", 'return tax_unit("wages", period)')
Expand All @@ -278,7 +273,6 @@ def test_path_two_hops(self, tmp_path: Path) -> None:
]

def test_path_returns_none_if_unreachable(self, tmp_path: Path) -> None:

root = tmp_path / "variables"
_write_variable(root, "island_a", "return 0")
_write_variable(root, "island_b", "return 0")
Expand All @@ -295,7 +289,6 @@ class TestRequiresVariableSubclass:
"""

def test_non_variable_classes_are_ignored(self, tmp_path: Path) -> None:

root = tmp_path / "variables"
root.mkdir(parents=True, exist_ok=True)
# Looks like a variable body but the class is not a Variable.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_trace_tro.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class TestBundleTRO:
def test__given_context__then_uses_public_trov_namespace(self, us_bundle_tro):
context = us_bundle_tro["@context"][0]
assert context["trov"] == TRACE_TROV_NAMESPACE
assert context["trov"] == "https://w3id.org/trace/2023/05/trov#"
assert context["trov"] == "https://w3id.org/trace/trov/0.1#"

def test__given_root_type__then_is_single_transparent_research_object(
self, us_bundle_tro
Expand Down
30 changes: 21 additions & 9 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading