From 47e1d4e410e3abf64438af9a782354d624030a2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Juaristi?= <127882282+juaristi22@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:48:52 +0000 Subject: [PATCH 1/4] Certify the Microcosm UK pair built on policyengine-uk 2.179.2 The national build uk-frs-calibration-attempt-20261122T100732Z-b891aa69 and the local-area build uk-local-candidate-f100-s42-20261123T075147Z-7081d968, both from PolicyEngine/microcosm#1687 and each pinned in its build folder at the hub commit that published it, certified by one certify-data run with --model-version 2.179.2. The lock moves policyengine-uk alone; the TROs, the certified test constants and the changelog fragment move with it. Co-Authored-By: Claude Opus 5.5 --- ...tempt-20261122T100732Z-b891aa69.changed.md | 1 + pyproject.toml | 6 +- src/policyengine/data/bundle/manifest.json | 102 +++++++++--------- .../data/bundle/uk.trace.tro.jsonld | 30 +++--- .../data/bundle/us.trace.tro.jsonld | 4 +- tests/test_models.py | 6 +- tests/test_release_manifests.py | 12 +-- tests/test_uk_regions.py | 8 +- uv.lock | 12 +-- 9 files changed, 91 insertions(+), 90 deletions(-) create mode 100644 changelog.d/certify-uk-uk-frs-calibration-attempt-20261122T100732Z-b891aa69.changed.md diff --git a/changelog.d/certify-uk-uk-frs-calibration-attempt-20261122T100732Z-b891aa69.changed.md b/changelog.d/certify-uk-uk-frs-calibration-attempt-20261122T100732Z-b891aa69.changed.md new file mode 100644 index 000000000..f0bf34f3f --- /dev/null +++ b/changelog.d/certify-uk-uk-frs-calibration-attempt-20261122T100732Z-b891aa69.changed.md @@ -0,0 +1 @@ +Certify the UK populace data release `uk-frs-calibration-attempt-20261122T100732Z-b891aa69` (microcosm_uk_2024_25, policyengine-uk 2.179.2) into the PolicyEngine bundle manifest. diff --git a/pyproject.toml b/pyproject.toml index a92187d40..b1ceba630 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,12 +42,12 @@ graph = [ models = [ "policyengine-core==3.34.10", "policyengine-us==2.2.2", - "policyengine-uk==2.177.7", + "policyengine-uk==2.179.2", "spm-calculator==1.1.0", ] uk = [ "policyengine-core==3.34.10", - "policyengine-uk==2.177.7", + "policyengine-uk==2.179.2", ] us = [ "policyengine-core==3.34.10", @@ -72,7 +72,7 @@ dev = [ "rfc8785>=0.1.4", "policyengine-core==3.34.10", "policyengine-us==2.2.2", - "policyengine-uk==2.177.7", + "policyengine-uk==2.179.2", "spm-calculator==1.1.0", ] diff --git a/src/policyengine/data/bundle/manifest.json b/src/policyengine/data/bundle/manifest.json index 6caf851ae..a94bcc90f 100644 --- a/src/policyengine/data/bundle/manifest.json +++ b/src/policyengine/data/bundle/manifest.json @@ -16,31 +16,31 @@ }, "data_releases": { "uk": { - "build_id": "uk-frs-calibration-attempt-20261115T104657Z-fcfac709", + "build_id": "uk-frs-calibration-attempt-20261122T100732Z-b891aa69", "bundle_id": "uk-6.20.2", "certification": { - "built_with_model_version": "2.177.7", + "built_with_model_version": "2.179.2", "certified_by": "policyengine.py bundle certification", - "certified_for_model_version": "2.177.7", + "certified_for_model_version": "2.179.2", "compatibility_basis": "built_with_model_package", "core_binding": "bundle_pin", - "data_build_id": "uk-frs-calibration-attempt-20261115T104657Z-fcfac709" + "data_build_id": "uk-frs-calibration-attempt-20261122T100732Z-b891aa69" }, "certified_data_artifact": { - "build_id": "uk-frs-calibration-attempt-20261115T104657Z-fcfac709", + "build_id": "uk-frs-calibration-attempt-20261122T100732Z-b891aa69", "data_package": { "name": "microcosm-data", "version": "0.1.0" }, "dataset": "microcosm_uk_2024_25", - "sha256": "301d2fe5e7805c5a6242b37843cb118445aefd59a0593833362ab5a6e2f9ba90", - "uri": "hf://policyengine/populace-uk-private/releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261115T104657Z-fcfac709/microcosm_uk_2024_25.h5@ad84c0602ed28f694ef52662eb9b063779e4e923" + "sha256": "ae116bc3cff798fe68df253083f0b26d779e02a0a818ee68df7d29fbc557165a", + "uri": "hf://policyengine/populace-uk-private/releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261122T100732Z-b891aa69/microcosm_uk_2024_25.h5@a80a4bf70ab4ffeac77357fe0633d3cee4ce7401" }, "country_id": "uk", "data_package": { "name": "microcosm-data", - "release_manifest_path": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261115T104657Z-fcfac709/release_manifest.json", - "release_manifest_revision": "ad84c0602ed28f694ef52662eb9b063779e4e923", + "release_manifest_path": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261122T100732Z-b891aa69/release_manifest.json", + "release_manifest_revision": "a80a4bf70ab4ffeac77357fe0633d3cee4ce7401", "repo_id": "policyengine/populace-uk-private", "repo_type": "dataset", "version": "0.1.0" @@ -48,89 +48,89 @@ "data_producer": "populace", "datasets": { "calibration_diagnostics": { - "path": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261115T104657Z-fcfac709/calibration_diagnostics.json", + "path": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261122T100732Z-b891aa69/calibration_diagnostics.json", "repo_id": "policyengine/populace-uk-private", - "revision": "ad84c0602ed28f694ef52662eb9b063779e4e923", - "sha256": "f9d7f4a45f641c27e39027532cd55ac09f03e1a0cecfe07a057f04b1ddb1276a" + "revision": "a80a4bf70ab4ffeac77357fe0633d3cee4ce7401", + "sha256": "0ab9c6ae913ff641326d68df73ab97ae691ffe6d6187d784e8a2069d8acf8309" }, "microcosm_uk_2024_25": { - "path": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261115T104657Z-fcfac709/microcosm_uk_2024_25.h5", + "path": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261122T100732Z-b891aa69/microcosm_uk_2024_25.h5", "repo_id": "policyengine/populace-uk-private", - "revision": "ad84c0602ed28f694ef52662eb9b063779e4e923", - "sha256": "301d2fe5e7805c5a6242b37843cb118445aefd59a0593833362ab5a6e2f9ba90" + "revision": "a80a4bf70ab4ffeac77357fe0633d3cee4ce7401", + "sha256": "ae116bc3cff798fe68df253083f0b26d779e02a0a818ee68df7d29fbc557165a" }, "microcosm_uk_2024_25_calibration": { - "path": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261115T104657Z-fcfac709/microcosm_uk_2024_25_calibration.npz", + "path": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261122T100732Z-b891aa69/microcosm_uk_2024_25_calibration.npz", "repo_id": "policyengine/populace-uk-private", - "revision": "ad84c0602ed28f694ef52662eb9b063779e4e923", - "sha256": "d39544332e17154f97342bf443d79a72698cf82ba83a6ef41de98fb944b62d69" + "revision": "a80a4bf70ab4ffeac77357fe0633d3cee4ce7401", + "sha256": "365d8f479dc468e8d400723291395c692c7ec9925e8c50cfb16f656686d5dec8" }, "microcosm_uk_2024_25_dense": { - "path": "releases/microcosm-uk-2024-25-dense/uk-local-candidate-f100-s42-20261116T102715Z-e2745e59/microcosm_uk_2024_25_dense.h5", + "path": "releases/microcosm-uk-2024-25-dense/uk-local-candidate-f100-s42-20261123T075147Z-7081d968/microcosm_uk_2024_25_dense.h5", "repo_id": "policyengine/populace-uk-private", "repo_type": "dataset", - "revision": "4c594d7243fdaec8913ef2543207f1d0934174ab", - "sha256": "436a680b336106b5bf68f766daa8798c903dee701441b2acc67cb57a6da308b8" + "revision": "9da099465da06f020d9125f60e49c88180a9e607", + "sha256": "cf1c98acd76467cd8421df67820e49c9e8bfc4b4f64eb0af27adf88994d63a15" }, "release_certification": { - "path": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261115T104657Z-fcfac709/release_certification.json", + "path": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261122T100732Z-b891aa69/release_certification.json", "repo_id": "policyengine/populace-uk-private", - "revision": "ad84c0602ed28f694ef52662eb9b063779e4e923", - "sha256": "f1c925ade94ee48a7846ed14f1d06deab5fbf08315eb756eb3c534777564a4d0" + "revision": "a80a4bf70ab4ffeac77357fe0633d3cee4ce7401", + "sha256": "3c63764a9977727dc5cac32f2b15bb38b995115224826e938010fdd817d44c54" }, "release_cut_gates": { - "path": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261115T104657Z-fcfac709/release_cut_gates.json", + "path": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261122T100732Z-b891aa69/release_cut_gates.json", "repo_id": "policyengine/populace-uk-private", - "revision": "ad84c0602ed28f694ef52662eb9b063779e4e923", - "sha256": "ecb9be159aed8ac7b98f7f45b350382d493b8c0a47a993d91eee9c5ff0d7ae58" + "revision": "a80a4bf70ab4ffeac77357fe0633d3cee4ce7401", + "sha256": "567d0dbf9c635086b5b78de1d23ec07de8854f903e8354aa6b16f2d06fb6a72d" }, "score_vs_reference": { - "path": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261115T104657Z-fcfac709/score_vs_reference.json", + "path": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261122T100732Z-b891aa69/score_vs_reference.json", "repo_id": "policyengine/populace-uk-private", - "revision": "ad84c0602ed28f694ef52662eb9b063779e4e923", - "sha256": "43751f8c625fd3214a0e3bc4f34615522733cfccf9958891def081b766dba310" + "revision": "a80a4bf70ab4ffeac77357fe0633d3cee4ce7401", + "sha256": "0dbea6cd05aa5c7e00f4a884ef84fa5baf508b4ae8110545c0bd61f9ce6c99ca" }, "spine_gates": { - "path": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261115T104657Z-fcfac709/spine_gates.json", + "path": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261122T100732Z-b891aa69/spine_gates.json", "repo_id": "policyengine/populace-uk-private", - "revision": "ad84c0602ed28f694ef52662eb9b063779e4e923", - "sha256": "dc24a2c42359fcaf7e7d57a7fd9cf257a3520ab00c50353c7a365bddac7c2904" + "revision": "a80a4bf70ab4ffeac77357fe0633d3cee4ce7401", + "sha256": "821332b7f7b9804fd6816cee0ba58b7f82a43480fc0a205c6eda8b04b5b834ca" }, "terminal_gates": { - "path": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261115T104657Z-fcfac709/terminal_gates.json", + "path": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261122T100732Z-b891aa69/terminal_gates.json", "repo_id": "policyengine/populace-uk-private", - "revision": "ad84c0602ed28f694ef52662eb9b063779e4e923", - "sha256": "ddb647f23f1ce8cd069e949fcf2abd7fb32c5d521e8d1392ab42923403e6e5a5" + "revision": "a80a4bf70ab4ffeac77357fe0633d3cee4ce7401", + "sha256": "3636e7bd42ee3278e46b77ba9c57ee277cb8b5c62a62720e5b726967a771d0e6" } }, "default_dataset": "microcosm_uk_2024_25", - "default_dataset_uri": "hf://policyengine/populace-uk-private/releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261115T104657Z-fcfac709/microcosm_uk_2024_25.h5@ad84c0602ed28f694ef52662eb9b063779e4e923", + "default_dataset_uri": "hf://policyengine/populace-uk-private/releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261122T100732Z-b891aa69/microcosm_uk_2024_25.h5@a80a4bf70ab4ffeac77357fe0633d3cee4ce7401", "model_package": { "name": "policyengine-uk", - "sha256": "8a8693095e909be36a622ac00b3212215a3577daf413d004321f3f07ec6c1347", - "version": "2.177.7", - "wheel_url": "https://files.pythonhosted.org/packages/38/d3/29440b5fd3bb08d2844b5d41a1c90c204c2fd8f03b6825c5577438ea54d1/policyengine_uk-2.177.7-py3-none-any.whl" + "sha256": "a1da93b521408fd4aee7e85f6550d33fb392f0291bcab0eaba631533e3cc0836", + "version": "2.179.2", + "wheel_url": "https://files.pythonhosted.org/packages/c6/55/84a5f328cff944fae92dc64d49ca139fe51b0f06b0217063ff87e3ea9779/policyengine_uk-2.179.2-py3-none-any.whl" }, "policyengine_version": "6.20.2", "region_datasets": { "constituency": { - "path_template": "releases/microcosm-uk-2024-25-dense/uk-local-candidate-f100-s42-20261116T102715Z-e2745e59/microcosm_uk_2024_25_dense.h5" + "path_template": "releases/microcosm-uk-2024-25-dense/uk-local-candidate-f100-s42-20261123T075147Z-7081d968/microcosm_uk_2024_25_dense.h5" }, "local_authority": { - "path_template": "releases/microcosm-uk-2024-25-dense/uk-local-candidate-f100-s42-20261116T102715Z-e2745e59/microcosm_uk_2024_25_dense.h5" + "path_template": "releases/microcosm-uk-2024-25-dense/uk-local-candidate-f100-s42-20261123T075147Z-7081d968/microcosm_uk_2024_25_dense.h5" }, "national": { - "path_template": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261115T104657Z-fcfac709/microcosm_uk_2024_25.h5" + "path_template": "releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261122T100732Z-b891aa69/microcosm_uk_2024_25.h5" } }, "regional_release_kind": "local_area", - "regional_release_manifest_uri": "https://huggingface.co/datasets/policyengine/populace-uk-private/resolve/4c594d7243fdaec8913ef2543207f1d0934174ab/releases/microcosm-uk-2024-25-dense/uk-local-candidate-f100-s42-20261116T102715Z-e2745e59/release_manifest.json", - "regional_source_manifest_sha256": "0395d6e895f8627a5943a912aef8a6e5d3da17ceddd378c4a8f44cebe7f17bf9", - "regional_source_manifest_uri": "hf://dataset/policyengine/populace-uk-private@4c594d7243fdaec8913ef2543207f1d0934174ab/releases/microcosm-uk-2024-25-dense/uk-local-candidate-f100-s42-20261116T102715Z-e2745e59/release_manifest.json", - "release_manifest_uri": "https://huggingface.co/datasets/policyengine/populace-uk-private/resolve/ad84c0602ed28f694ef52662eb9b063779e4e923/releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261115T104657Z-fcfac709/release_manifest.json", + "regional_release_manifest_uri": "https://huggingface.co/datasets/policyengine/populace-uk-private/resolve/9da099465da06f020d9125f60e49c88180a9e607/releases/microcosm-uk-2024-25-dense/uk-local-candidate-f100-s42-20261123T075147Z-7081d968/release_manifest.json", + "regional_source_manifest_sha256": "b6e7784213c6de1c081f3cbece1c2cbe65879a47984f449ceaeb3aeb22c63153", + "regional_source_manifest_uri": "hf://dataset/policyengine/populace-uk-private@9da099465da06f020d9125f60e49c88180a9e607/releases/microcosm-uk-2024-25-dense/uk-local-candidate-f100-s42-20261123T075147Z-7081d968/release_manifest.json", + "release_manifest_uri": "https://huggingface.co/datasets/policyengine/populace-uk-private/resolve/a80a4bf70ab4ffeac77357fe0633d3cee4ce7401/releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261122T100732Z-b891aa69/release_manifest.json", "schema_version": 1, - "source_manifest_uri": "hf://dataset/policyengine/populace-uk-private@ad84c0602ed28f694ef52662eb9b063779e4e923/releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261115T104657Z-fcfac709/release_manifest.json", - "version": "uk-frs-calibration-attempt-20261115T104657Z-fcfac709" + "source_manifest_uri": "hf://dataset/policyengine/populace-uk-private@a80a4bf70ab4ffeac77357fe0633d3cee4ce7401/releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261122T100732Z-b891aa69/release_manifest.json", + "version": "uk-frs-calibration-attempt-20261122T100732Z-b891aa69" }, "us": { "build_id": "populace-us-2024-spm-20260915", @@ -15907,10 +15907,10 @@ "policyengine-uk": { "country": "uk", "import_name": "policyengine_uk", - "install_requirement": "policyengine-uk==2.177.7", + "install_requirement": "policyengine-uk==2.179.2", "name": "policyengine-uk", "role": "country_model", - "version": "2.177.7" + "version": "2.179.2" }, "policyengine-us": { "country": "us", diff --git a/src/policyengine/data/bundle/uk.trace.tro.jsonld b/src/policyengine/data/bundle/uk.trace.tro.jsonld index 4de2d9992..b4d9a81a2 100644 --- a/src/policyengine/data/bundle/uk.trace.tro.jsonld +++ b/src/policyengine/data/bundle/uk.trace.tro.jsonld @@ -17,7 +17,7 @@ "schema:name": "PolicyEngine", "schema:url": "https://policyengine.org" }, - "schema:dateCreated": "2026-11-15T13:42:23.452413+00:00", + "schema:dateCreated": "2026-11-22T17:14:41.779575+00:00", "schema:description": "TRACE TRO for certified runtime bundle uk-6.20.2 covering the bundle manifest, the certified dataset artifact, the country model wheel, and the country data release manifest when it is available.", "schema:name": "policyengine uk certified bundle TRO", "trov:createdWith": { @@ -45,7 +45,7 @@ "trov:hasArtifact": { "@id": "composition/1/artifact/data_release_manifest" }, - "trov:hasLocation": "https://huggingface.co/datasets/policyengine/populace-uk-private/resolve/ad84c0602ed28f694ef52662eb9b063779e4e923/releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261115T104657Z-fcfac709/release_manifest.json" + "trov:hasLocation": "https://huggingface.co/datasets/policyengine/populace-uk-private/resolve/a80a4bf70ab4ffeac77357fe0633d3cee4ce7401/releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261122T100732Z-b891aa69/release_manifest.json" }, { "@id": "arrangement/1/location/dataset", @@ -53,7 +53,7 @@ "trov:hasArtifact": { "@id": "composition/1/artifact/dataset" }, - "trov:hasLocation": "https://huggingface.co/datasets/policyengine/populace-uk-private/resolve/ad84c0602ed28f694ef52662eb9b063779e4e923/releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261115T104657Z-fcfac709/microcosm_uk_2024_25.h5" + "trov:hasLocation": "https://huggingface.co/datasets/policyengine/populace-uk-private/resolve/a80a4bf70ab4ffeac77357fe0633d3cee4ce7401/releases/microcosm-uk-2024-25-national/uk-frs-calibration-attempt-20261122T100732Z-b891aa69/microcosm_uk_2024_25.h5" }, { "@id": "arrangement/1/location/model_wheel", @@ -61,7 +61,7 @@ "trov:hasArtifact": { "@id": "composition/1/artifact/model_wheel" }, - "trov:hasLocation": "https://files.pythonhosted.org/packages/38/d3/29440b5fd3bb08d2844b5d41a1c90c204c2fd8f03b6825c5577438ea54d1/policyengine_uk-2.177.7-py3-none-any.whl" + "trov:hasLocation": "https://files.pythonhosted.org/packages/c6/55/84a5f328cff944fae92dc64d49ca139fe51b0f06b0217063ff87e3ea9779/policyengine_uk-2.179.2-py3-none-any.whl" } ] } @@ -75,51 +75,51 @@ "@type": "trov:ResearchArtifact", "schema:name": "policyengine.py bundle manifest for uk", "trov:mimeType": "application/json", - "trov:sha256": "07da3cc8567ce06d61b1dddbcb038e484865231827d6ec4bd0d40046aed96e3b" + "trov:sha256": "1c03e013bbad00feb1054ff4d7211f7b76377def5629e845b18c784e07cd0cc2" }, { "@id": "composition/1/artifact/data_release_manifest", "@type": "trov:ResearchArtifact", "schema:name": "microcosm-data release manifest 0.1.0", "trov:mimeType": "application/json", - "trov:sha256": "e5021148353cd7511679c4cda9bccd2464ffe759691b63693dd28937000af33c" + "trov:sha256": "b856e61ab91e54e231d4181249e6f59b1b4e7b2c5f793c79e7a5a74bf935a21e" }, { "@id": "composition/1/artifact/dataset", "@type": "trov:ResearchArtifact", "schema:name": "microcosm_uk_2024_25", "trov:mimeType": "application/x-hdf5", - "trov:sha256": "301d2fe5e7805c5a6242b37843cb118445aefd59a0593833362ab5a6e2f9ba90" + "trov:sha256": "ae116bc3cff798fe68df253083f0b26d779e02a0a818ee68df7d29fbc557165a" }, { "@id": "composition/1/artifact/model_wheel", "@type": "trov:ResearchArtifact", - "schema:name": "policyengine-uk==2.177.7 wheel", + "schema:name": "policyengine-uk==2.179.2 wheel", "trov:mimeType": "application/zip", - "trov:sha256": "8a8693095e909be36a622ac00b3212215a3577daf413d004321f3f07ec6c1347" + "trov:sha256": "a1da93b521408fd4aee7e85f6550d33fb392f0291bcab0eaba631533e3cc0836" } ], "trov:hasFingerprint": { "@id": "composition/1/fingerprint", "@type": "trov:CompositionFingerprint", - "trov:sha256": "fbeb4ccf97bdd8f5c48435e7f9307f7948ef55c07c4f8dcf6d8a433cbe7d87f3" + "trov:sha256": "c38cc892c01267c2151bb3bfb6ed315e9c65284b8a3ab98460e8c694542dcd8b" } }, "trov:hasPerformance": { "@id": "trp/1", "@type": "trov:TransparentResearchPerformance", - "pe:builtWithModelVersion": "2.177.7", + "pe:builtWithModelVersion": "2.179.2", "pe:certifiedBy": "policyengine.py bundle certification", - "pe:certifiedForModelVersion": "2.177.7", + "pe:certifiedForModelVersion": "2.179.2", "pe:compatibilityBasis": "built_with_model_package", "pe:coreBinding": "bundle_pin", - "pe:dataBuildId": "uk-frs-calibration-attempt-20261115T104657Z-fcfac709", + "pe:dataBuildId": "uk-frs-calibration-attempt-20261122T100732Z-b891aa69", "pe:emittedIn": "repository-bundle", - "rdfs:comment": "Certification of build uk-frs-calibration-attempt-20261115T104657Z-fcfac709 for policyengine-uk 2.177.7.", + "rdfs:comment": "Certification of build uk-frs-calibration-attempt-20261122T100732Z-b891aa69 for policyengine-uk 2.179.2.", "trov:accessedArrangement": { "@id": "arrangement/1" }, - "trov:startedAtTime": "2026-11-15T13:42:23.452413+00:00", + "trov:startedAtTime": "2026-11-22T17:14:41.779575+00:00", "trov:wasConductedBy": { "@id": "trs" } diff --git a/src/policyengine/data/bundle/us.trace.tro.jsonld b/src/policyengine/data/bundle/us.trace.tro.jsonld index 556398361..a64a51dad 100644 --- a/src/policyengine/data/bundle/us.trace.tro.jsonld +++ b/src/policyengine/data/bundle/us.trace.tro.jsonld @@ -74,7 +74,7 @@ "@type": "trov:ResearchArtifact", "schema:name": "policyengine.py bundle manifest for us", "trov:mimeType": "application/json", - "trov:sha256": "07da3cc8567ce06d61b1dddbcb038e484865231827d6ec4bd0d40046aed96e3b" + "trov:sha256": "1c03e013bbad00feb1054ff4d7211f7b76377def5629e845b18c784e07cd0cc2" }, { "@id": "composition/1/artifact/data_release_manifest", @@ -101,7 +101,7 @@ "trov:hasFingerprint": { "@id": "composition/1/fingerprint", "@type": "trov:CompositionFingerprint", - "trov:sha256": "5fc2cbe4de574ea4d9bf1dde4fcfd6fb7d4567e0b368019052d5340530f37ad1" + "trov:sha256": "d76c3de19b536cfa71b009a36db06557f32b9801ac9f05a2298f53bb12317b0d" } }, "trov:hasPerformance": { diff --git a/tests/test_models.py b/tests/test_models.py index 5c2302034..6f82e9af1 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -43,14 +43,14 @@ def test_has_release_manifest_metadata(self): assert uk_latest.release_manifest is not None assert uk_latest.release_manifest.country_id == "uk" assert uk_latest.model_package.name == "policyengine-uk" - assert uk_latest.model_package.version == "2.177.7" + assert uk_latest.model_package.version == "2.179.2" assert uk_latest.data_package.name == "microcosm-data" assert uk_latest.data_package.version == "0.1.0" assert ( uk_latest.default_dataset_uri == "hf://policyengine/populace-uk-private/releases/microcosm-uk-2024-25-national/" - "uk-frs-calibration-attempt-20261115T104657Z-fcfac709/microcosm_uk_2024_25.h5" - "@ad84c0602ed28f694ef52662eb9b063779e4e923" + "uk-frs-calibration-attempt-20261122T100732Z-b891aa69/microcosm_uk_2024_25.h5" + "@a80a4bf70ab4ffeac77357fe0633d3cee4ce7401" ) def test_has_hundreds_of_parameters(self): diff --git a/tests/test_release_manifests.py b/tests/test_release_manifests.py index 70bb32254..dcdfff22f 100644 --- a/tests/test_release_manifests.py +++ b/tests/test_release_manifests.py @@ -83,16 +83,16 @@ US_LOCAL_AREA_DATASET_URI = ( f"hf://policyengine/populace-us/{US_LOCAL_AREA_PATH}@{US_LOCAL_AREA_REVISION}" ) -UK_MODEL_VERSION = "2.177.7" -UK_BUILT_WITH_MODEL_VERSION = "2.177.7" +UK_MODEL_VERSION = "2.179.2" +UK_BUILT_WITH_MODEL_VERSION = "2.179.2" UK_DATA_RELEASE_VERSION = "0.1.0" -UK_DATA_RELEASE_ID = "uk-frs-calibration-attempt-20261115T104657Z-fcfac709" -UK_DATA_RELEASE_REVISION = "ad84c0602ed28f694ef52662eb9b063779e4e923" +UK_DATA_RELEASE_ID = "uk-frs-calibration-attempt-20261122T100732Z-b891aa69" +UK_DATA_RELEASE_REVISION = "a80a4bf70ab4ffeac77357fe0633d3cee4ce7401" UK_DATA_RELEASE_PATH = ( f"releases/microcosm-uk-2024-25-national/{UK_DATA_RELEASE_ID}/release_manifest.json" ) -UK_LOCAL_AREA_RELEASE_ID = "uk-local-candidate-f100-s42-20261116T102715Z-e2745e59" -UK_LOCAL_AREA_RELEASE_REVISION = "4c594d7243fdaec8913ef2543207f1d0934174ab" +UK_LOCAL_AREA_RELEASE_ID = "uk-local-candidate-f100-s42-20261123T075147Z-7081d968" +UK_LOCAL_AREA_RELEASE_REVISION = "9da099465da06f020d9125f60e49c88180a9e607" # The prior certified default (policyengine-uk-data 1.58.1), kept resolvable # via dataset_overlays. UK_EFRS_DATASET_URI = ( diff --git a/tests/test_uk_regions.py b/tests/test_uk_regions.py index b885faf6b..979698b34 100644 --- a/tests/test_uk_regions.py +++ b/tests/test_uk_regions.py @@ -24,13 +24,13 @@ # release its constituency and local-authority regions are routed to. UK_CERTIFIED_NATIONAL_URI = ( "hf://policyengine/populace-uk-private/releases/microcosm-uk-2024-25-national/" - "uk-frs-calibration-attempt-20261115T104657Z-fcfac709/microcosm_uk_2024_25.h5" - "@ad84c0602ed28f694ef52662eb9b063779e4e923" + "uk-frs-calibration-attempt-20261122T100732Z-b891aa69/microcosm_uk_2024_25.h5" + "@a80a4bf70ab4ffeac77357fe0633d3cee4ce7401" ) UK_CERTIFIED_LOCAL_AREA_URI = ( "hf://policyengine/populace-uk-private/releases/microcosm-uk-2024-25-dense/" - "uk-local-candidate-f100-s42-20261116T102715Z-e2745e59/microcosm_uk_2024_25_dense.h5" - "@4c594d7243fdaec8913ef2543207f1d0934174ab" + "uk-local-candidate-f100-s42-20261123T075147Z-7081d968/microcosm_uk_2024_25_dense.h5" + "@9da099465da06f020d9125f60e49c88180a9e607" ) UK_AREA_REGION_COUNT = 650 + 361 diff --git a/uv.lock b/uv.lock index c932bd38d..035835dcb 100644 --- a/uv.lock +++ b/uv.lock @@ -1894,9 +1894,9 @@ requires-dist = [ { name = "policyengine-core", marker = "extra == 'models'", specifier = "==3.34.10" }, { name = "policyengine-core", marker = "extra == 'uk'", specifier = "==3.34.10" }, { name = "policyengine-core", marker = "extra == 'us'", specifier = "==3.34.10" }, - { name = "policyengine-uk", marker = "extra == 'dev'", specifier = "==2.177.7" }, - { name = "policyengine-uk", marker = "extra == 'models'", specifier = "==2.177.7" }, - { name = "policyengine-uk", marker = "extra == 'uk'", specifier = "==2.177.7" }, + { name = "policyengine-uk", marker = "extra == 'dev'", specifier = "==2.179.2" }, + { name = "policyengine-uk", marker = "extra == 'models'", specifier = "==2.179.2" }, + { name = "policyengine-uk", marker = "extra == 'uk'", specifier = "==2.179.2" }, { name = "policyengine-us", marker = "extra == 'dev'", specifier = "==2.2.2" }, { name = "policyengine-us", marker = "extra == 'models'", specifier = "==2.2.2" }, { name = "policyengine-us", marker = "extra == 'us'", specifier = "==2.2.2" }, @@ -1946,7 +1946,7 @@ wheels = [ [[package]] name = "policyengine-uk" -version = "2.177.7" +version = "2.179.2" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "microdf-python" }, @@ -1954,9 +1954,9 @@ dependencies = [ { name = "pydantic" }, { name = "tables" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/52/43/1838e81e296fcaa5b817ebeafb21d1ef0867e265f70e13cd293fc8fa250a/policyengine_uk-2.177.7.tar.gz", hash = "sha256:f5ac7f95142f0bbf382459813d9899339ba69883421d24332274ef5537820964", size = 5026546, upload-time = "2026-11-10T16:33:19.136Z" } +sdist = { url = "https://files.pythonhosted.org/packages/69/45/9bfc794973d685c5da6c09d3b84b2445ffbfc16fc28bfd96772f8457aee0/policyengine_uk-2.179.2.tar.gz", hash = "sha256:56a99e8e3a48d2ebf5ee5f4383e5b5671b3c3b3b84f668cabc7b560f83bfd44e", size = 5294795, upload-time = "2026-11-18T15:41:54.502Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/38/d3/29440b5fd3bb08d2844b5d41a1c90c204c2fd8f03b6825c5577438ea54d1/policyengine_uk-2.177.7-py3-none-any.whl", hash = "sha256:8a8693095e909be36a622ac00b3212215a3577daf413d004321f3f07ec6c1347", size = 7063207, upload-time = "2026-11-10T16:33:16.375Z" }, + { url = "https://files.pythonhosted.org/packages/c6/55/84a5f328cff944fae92dc64d49ca139fe51b0f06b0217063ff87e3ea9779/policyengine_uk-2.179.2-py3-none-any.whl", hash = "sha256:a1da93b521408fd4aee7e85f6550d33fb392f0291bcab0eaba631533e3cc0836", size = 7416601, upload-time = "2026-11-18T15:41:51.547Z" }, ] [[package]] From 5a0ced3eb8087d3cf2b7a107a664a5354fe533bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Juaristi?= <127882282+juaristi22@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:48:52 +0000 Subject: [PATCH 2/4] Regenerate the household calculator snapshots on policyengine-uk 2.179.2 Only the UK model surface's count buckets move: parameters 50 to 51 hundreds, variables 14 to 15. Co-Authored-By: Claude Opus 5.5 --- .../household_calculator_snapshots/uk_model_surface.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/fixtures/household_calculator_snapshots/uk_model_surface.json b/tests/fixtures/household_calculator_snapshots/uk_model_surface.json index 7a0d45f98..32a62e391 100644 --- a/tests/fixtures/household_calculator_snapshots/uk_model_surface.json +++ b/tests/fixtures/household_calculator_snapshots/uk_model_surface.json @@ -5,7 +5,7 @@ "has_income_tax": true, "has_region_registry": true, "model_package_name": "policyengine-uk", - "num_parameters_bucketed_100s": 50, - "num_variables_bucketed_100s": 14, + "num_parameters_bucketed_100s": 51, + "num_variables_bucketed_100s": 15, "region_registry_country": "uk" } From 81bac43040e908c402c6ebf42d807b27dde9b56d Mon Sep 17 00:00:00 2001 From: juaristi22 Date: Tue, 24 Nov 2026 13:13:48 +0000 Subject: [PATCH 3/4] Update package version --- CHANGELOG.md | 7 +++++++ ...tempt-20261122T100732Z-b891aa69.changed.md | 1 - pyproject.toml | 2 +- src/policyengine/data/bundle/manifest.json | 20 +++++++++---------- .../data/bundle/uk.trace.tro.jsonld | 10 +++++----- .../data/bundle/us.trace.tro.jsonld | 10 +++++----- uv.lock | 2 +- 7 files changed, 29 insertions(+), 23 deletions(-) delete mode 100644 changelog.d/certify-uk-uk-frs-calibration-attempt-20261122T100732Z-b891aa69.changed.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f745ba3b..50c611d06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [6.20.3] - 2026-11-24 + +### Changed + +- Certify the UK populace data release `uk-frs-calibration-attempt-20261122T100732Z-b891aa69` (microcosm_uk_2024_25, policyengine-uk 2.179.2) into the PolicyEngine bundle manifest. + + ## [6.20.2] - 2026-11-16 ### Changed diff --git a/changelog.d/certify-uk-uk-frs-calibration-attempt-20261122T100732Z-b891aa69.changed.md b/changelog.d/certify-uk-uk-frs-calibration-attempt-20261122T100732Z-b891aa69.changed.md deleted file mode 100644 index f0bf34f3f..000000000 --- a/changelog.d/certify-uk-uk-frs-calibration-attempt-20261122T100732Z-b891aa69.changed.md +++ /dev/null @@ -1 +0,0 @@ -Certify the UK populace data release `uk-frs-calibration-attempt-20261122T100732Z-b891aa69` (microcosm_uk_2024_25, policyengine-uk 2.179.2) into the PolicyEngine bundle manifest. diff --git a/pyproject.toml b/pyproject.toml index b1ceba630..ef7b3b574 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "policyengine" -version = "6.20.2" +version = "6.20.3" description = "A package to conduct policy analysis using PolicyEngine tax-benefit models." readme = "README.md" authors = [ diff --git a/src/policyengine/data/bundle/manifest.json b/src/policyengine/data/bundle/manifest.json index a94bcc90f..91b4c1e0e 100644 --- a/src/policyengine/data/bundle/manifest.json +++ b/src/policyengine/data/bundle/manifest.json @@ -1,10 +1,10 @@ { - "bundle_version": "6.20.2", + "bundle_version": "6.20.3", "citation": { "publisher": "PolicyEngine", - "title": "PolicyEngine bundle 6.20.2", + "title": "PolicyEngine bundle 6.20.3", "type": "software-bundle", - "version": "6.20.2" + "version": "6.20.3" }, "countries": { "uk": { @@ -17,7 +17,7 @@ "data_releases": { "uk": { "build_id": "uk-frs-calibration-attempt-20261122T100732Z-b891aa69", - "bundle_id": "uk-6.20.2", + "bundle_id": "uk-6.20.3", "certification": { "built_with_model_version": "2.179.2", "certified_by": "policyengine.py bundle certification", @@ -111,7 +111,7 @@ "version": "2.179.2", "wheel_url": "https://files.pythonhosted.org/packages/c6/55/84a5f328cff944fae92dc64d49ca139fe51b0f06b0217063ff87e3ea9779/policyengine_uk-2.179.2-py3-none-any.whl" }, - "policyengine_version": "6.20.2", + "policyengine_version": "6.20.3", "region_datasets": { "constituency": { "path_template": "releases/microcosm-uk-2024-25-dense/uk-local-candidate-f100-s42-20261123T075147Z-7081d968/microcosm_uk_2024_25_dense.h5" @@ -134,7 +134,7 @@ }, "us": { "build_id": "populace-us-2024-spm-20260915", - "bundle_id": "us-6.20.2", + "bundle_id": "us-6.20.3", "certification": { "built_with_model_version": "2.2.1", "certified_by": "policyengine.py bundle certification", @@ -240,7 +240,7 @@ "version": "2.2.2", "wheel_url": "https://files.pythonhosted.org/packages/84/89/12a44d68e4131cc6ad92cfa22959254c69306d1f25fa6760ea1aab851bcb/policyengine_us-2.2.2-py3-none-any.whl" }, - "policyengine_version": "6.20.2", + "policyengine_version": "6.20.3", "region_datasets": { "congressional_district": { "path_template": "releases/microcosm-us-2024-local/populace-us-2024-buildo-acs-local-766b7c7-20261017T030317Z/populace_us_2024_acs_local.h5" @@ -15892,10 +15892,10 @@ "packages": { "policyengine": { "import_name": "policyengine", - "install_requirement": "policyengine==6.20.2", + "install_requirement": "policyengine==6.20.3", "name": "policyengine", "role": "bundle_carrier", - "version": "6.20.2" + "version": "6.20.3" }, "policyengine-core": { "import_name": "policyengine_core", @@ -15931,6 +15931,6 @@ "wheel_url": "https://files.pythonhosted.org/packages/35/91/12a744eb7f3445db8899dc187bbd193c884f9fe4c373851c0ddb24cc0f5e/spm_calculator-1.1.0-py3-none-any.whl" } }, - "policyengine_version": "6.20.2", + "policyengine_version": "6.20.3", "schema_version": 2 } diff --git a/src/policyengine/data/bundle/uk.trace.tro.jsonld b/src/policyengine/data/bundle/uk.trace.tro.jsonld index b4d9a81a2..69d546e40 100644 --- a/src/policyengine/data/bundle/uk.trace.tro.jsonld +++ b/src/policyengine/data/bundle/uk.trace.tro.jsonld @@ -18,18 +18,18 @@ "schema:url": "https://policyengine.org" }, "schema:dateCreated": "2026-11-22T17:14:41.779575+00:00", - "schema:description": "TRACE TRO for certified runtime bundle uk-6.20.2 covering the bundle manifest, the certified dataset artifact, the country model wheel, and the country data release manifest when it is available.", + "schema:description": "TRACE TRO for certified runtime bundle uk-6.20.3 covering the bundle manifest, the certified dataset artifact, the country model wheel, and the country data release manifest when it is available.", "schema:name": "policyengine uk certified bundle TRO", "trov:createdWith": { "@type": "schema:SoftwareApplication", "schema:name": "policyengine", - "schema:softwareVersion": "6.20.2" + "schema:softwareVersion": "6.20.3" }, "trov:hasArrangement": [ { "@id": "arrangement/1", "@type": "trov:ArtifactArrangement", - "rdfs:comment": "Certified arrangement for bundle uk-6.20.2.", + "rdfs:comment": "Certified arrangement for bundle uk-6.20.3.", "trov:hasArtifactLocation": [ { "@id": "arrangement/1/location/bundle_manifest", @@ -75,7 +75,7 @@ "@type": "trov:ResearchArtifact", "schema:name": "policyengine.py bundle manifest for uk", "trov:mimeType": "application/json", - "trov:sha256": "1c03e013bbad00feb1054ff4d7211f7b76377def5629e845b18c784e07cd0cc2" + "trov:sha256": "9bf5b0fc556799117b4254901272d6d742342f156c621f03fc39071d57876b3c" }, { "@id": "composition/1/artifact/data_release_manifest", @@ -102,7 +102,7 @@ "trov:hasFingerprint": { "@id": "composition/1/fingerprint", "@type": "trov:CompositionFingerprint", - "trov:sha256": "c38cc892c01267c2151bb3bfb6ed315e9c65284b8a3ab98460e8c694542dcd8b" + "trov:sha256": "f34bc3199e85dbb364809c9fde508d24d4f05ffd5486d90e64b911515a659a79" } }, "trov:hasPerformance": { diff --git a/src/policyengine/data/bundle/us.trace.tro.jsonld b/src/policyengine/data/bundle/us.trace.tro.jsonld index a64a51dad..61e574e17 100644 --- a/src/policyengine/data/bundle/us.trace.tro.jsonld +++ b/src/policyengine/data/bundle/us.trace.tro.jsonld @@ -17,18 +17,18 @@ "schema:name": "PolicyEngine", "schema:url": "https://policyengine.org" }, - "schema:description": "TRACE TRO for certified runtime bundle us-6.20.2 covering the bundle manifest, the certified dataset artifact, the country model wheel, and the country data release manifest when it is available.", + "schema:description": "TRACE TRO for certified runtime bundle us-6.20.3 covering the bundle manifest, the certified dataset artifact, the country model wheel, and the country data release manifest when it is available.", "schema:name": "policyengine us certified bundle TRO", "trov:createdWith": { "@type": "schema:SoftwareApplication", "schema:name": "policyengine", - "schema:softwareVersion": "6.20.2" + "schema:softwareVersion": "6.20.3" }, "trov:hasArrangement": [ { "@id": "arrangement/1", "@type": "trov:ArtifactArrangement", - "rdfs:comment": "Certified arrangement for bundle us-6.20.2.", + "rdfs:comment": "Certified arrangement for bundle us-6.20.3.", "trov:hasArtifactLocation": [ { "@id": "arrangement/1/location/bundle_manifest", @@ -74,7 +74,7 @@ "@type": "trov:ResearchArtifact", "schema:name": "policyengine.py bundle manifest for us", "trov:mimeType": "application/json", - "trov:sha256": "1c03e013bbad00feb1054ff4d7211f7b76377def5629e845b18c784e07cd0cc2" + "trov:sha256": "9bf5b0fc556799117b4254901272d6d742342f156c621f03fc39071d57876b3c" }, { "@id": "composition/1/artifact/data_release_manifest", @@ -101,7 +101,7 @@ "trov:hasFingerprint": { "@id": "composition/1/fingerprint", "@type": "trov:CompositionFingerprint", - "trov:sha256": "d76c3de19b536cfa71b009a36db06557f32b9801ac9f05a2298f53bb12317b0d" + "trov:sha256": "118807f5c952887cef932b087ebee0fd7e914c9e484ae2b477e29c83e288e607" } }, "trov:hasPerformance": { diff --git a/uv.lock b/uv.lock index 035835dcb..fa0db618b 100644 --- a/uv.lock +++ b/uv.lock @@ -1816,7 +1816,7 @@ wheels = [ [[package]] name = "policyengine" -version = "6.20.2" +version = "6.20.3" source = { editable = "." } dependencies = [ { name = "h5py" }, From ce66e4235ab61979e19edba7626cee51446bcb2e Mon Sep 17 00:00:00 2001 From: Max Ghenis <6076111+MaxGhenis@users.noreply.github.com> Date: Sun, 29 Nov 2026 19:09:41 -0500 Subject: [PATCH 4/4] Finish explicit local US dataset provenance and native input tests --- changelog.d/760.added.md | 1 + changelog.d/760.fixed.md | 4 +- docs/microsim.md | 10 +++-- .../tax_benefit_models/us/model.py | 12 +++--- tests/test_dataset_source.py | 9 ++++- tests/test_us_unmanaged_runtime.py | 37 +++++++++++++++++++ 6 files changed, 60 insertions(+), 13 deletions(-) create mode 100644 changelog.d/760.added.md diff --git a/changelog.d/760.added.md b/changelog.d/760.added.md new file mode 100644 index 000000000..be90ee180 --- /dev/null +++ b/changelog.d/760.added.md @@ -0,0 +1 @@ +Add `native_input_period` for explicit local TIME_PERIOD_ARRAYS files. A four-digit year string sets the input and calculation defaults before the country constructor while preserving each stored period. The option requires a nonempty `.h5` file. diff --git a/changelog.d/760.fixed.md b/changelog.d/760.fixed.md index 65c9465a5..7aedf4adb 100644 --- a/changelog.d/760.fixed.md +++ b/changelog.d/760.fixed.md @@ -1,3 +1 @@ -Allow explicit local US datasets with `allow_unmanaged=True` to record unverified runtime provenance without certifying the unused default data bundle. Keep certification on bundled data, cached year files and managed simulation entrypoints. - -Add `native_input_period` for explicit local TIME_PERIOD_ARRAYS files so callers can bind the input clock before the first country constructor while preserving each stored period. Require current US data certification before exporting bundle provenance. Reject non-H5 native paths and report empty native HDF5 roots with a clear value error. +Allow explicit local US datasets with `allow_unmanaged=True` to record unverified runtime provenance without certifying the unused default data bundle. Keep certification on bundled data, cached year files, managed simulation entrypoints and bundle provenance exports. diff --git a/docs/microsim.md b/docs/microsim.md index 00ac2e3e5..028e31d17 100644 --- a/docs/microsim.md +++ b/docs/microsim.md @@ -423,13 +423,15 @@ sim = managed_microsimulation() # `sim` is a policyengine_us.Microsimulation — use its API directly ``` -Pass `allow_unmanaged=True` with a custom `dataset=` to opt out of the release -bundle. Explicit local paths and Hugging Face URIs remain supported in this -mode. GCS dataset URIs are not supported. +Pass `allow_unmanaged=True` with a custom `dataset=` to select a local file or +Hugging Face URI outside the bundle's pinned datasets. The US wrapper still +checks data certification before fetching a Hugging Face URI. GCS dataset URIs +are unsupported. An explicit local US file records its SHA-256 and the installed wrapper, country, Core and SPM versions in `sim.policyengine_bundle`. Its `compatibility_basis` records `unverified_explicit_local_unmanaged`, and `certified_by` records `None`. +The `managed_by` field names the wrapper that constructed the simulation. Importing the US wrapper and constructing this local simulation do not certify the unused default dataset. Bundled and named data, year-file caches, managed simulation runs and cached output loads retain their certification checks. @@ -439,7 +441,7 @@ set the Core Dataset descriptor's annual clock and both default input and calculation periods before the first country constructor. The wrapper preserves stored period keys, including monthly inputs and earlier lookbacks. This option requires `allow_unmanaged=True`, an existing nonempty file with the `.h5` suffix -and a four-digit annual period. It rejects scoping, `dataset_end_year` and +and a four-digit year string. It rejects scoping, `dataset_end_year` and conflicting default input or calculation periods. The caller still selects the tax-benefit system and structural start date. diff --git a/src/policyengine/tax_benefit_models/us/model.py b/src/policyengine/tax_benefit_models/us/model.py index f4ba41c51..0930e59ab 100644 --- a/src/policyengine/tax_benefit_models/us/model.py +++ b/src/policyengine/tax_benefit_models/us/model.py @@ -600,6 +600,7 @@ def _unmanaged_local_runtime_provenance(source): data_selection="explicit_local_unmanaged", compatibility_basis="unverified_explicit_local_unmanaged", certified_by=None, + country_id="us", model_package="policyengine-us", model_version=versions["policyengine-us"], policyengine_version=versions["policyengine"], @@ -667,10 +668,10 @@ def managed_microsimulation( calculations. This retains earlier supplied income for lookbacks. The unscoped constructor continues to own projection and reform timing. - ``native_input_period="2017"`` binds both input and calculation defaults - before the first country constructor for an explicit local ``.h5`` - TIME_PERIOD_ARRAYS file. It preserves each array's period and does not - project or rescope the file. + Pass a four-digit year string such as ``native_input_period="2017"`` to + bind both defaults before the first country constructor for an explicit + local ``.h5`` TIME_PERIOD_ARRAYS file. The option preserves each array's + period. Projection and scoping options are incompatible with this argument. The caller still selects the tax-benefit system and structural start date. """ @@ -736,8 +737,9 @@ def managed_microsimulation( and dataset is not None and source.bundle_dataset is None and "://" not in source.source_uri - and Path(source.path).is_file() ) + if explicit_local and not Path(source.path).is_file(): + raise ValueError(f"Explicit local US dataset must be a file: {source.path!r}") local_provenance = ( _unmanaged_local_runtime_provenance(source) if explicit_local else None ) diff --git a/tests/test_dataset_source.py b/tests/test_dataset_source.py index 589325657..280e10c7a 100644 --- a/tests/test_dataset_source.py +++ b/tests/test_dataset_source.py @@ -42,7 +42,14 @@ def get(self, url, **kwargs): def _download(uri, tmp_path, session): - with patch.object(dataset_source.requests, "get", side_effect=session.get): + def get_after_certifying(*args, **kwargs): + certify.assert_called_once_with() + return session.get(*args, **kwargs) + + with ( + patch.object(dataset_source, "_require_us_data_certification") as certify, + patch.object(dataset_source.requests, "get", side_effect=get_after_certifying), + ): return materialize_dataset( "us", uri, diff --git a/tests/test_us_unmanaged_runtime.py b/tests/test_us_unmanaged_runtime.py index 75376eab5..900724cbd 100644 --- a/tests/test_us_unmanaged_runtime.py +++ b/tests/test_us_unmanaged_runtime.py @@ -9,6 +9,7 @@ from importlib import metadata from types import SimpleNamespace +import h5py import pytest import policyengine.provenance.dataset_materialization as materialization @@ -166,6 +167,7 @@ def test_local_factory_records_actual_runtime_without_certificate( assert sim is expected assert receipt["compatibility_basis"] == "unverified_explicit_local_unmanaged" assert receipt["certified_by"] is None + assert receipt["country_id"] == "us" assert receipt["runtime_packages"] == { name: metadata.version(name) for name in ( @@ -182,6 +184,12 @@ def test_local_factory_records_actual_runtime_without_certificate( assert not any(key.startswith("certified_data") for key in receipt) +def test_local_factory_refuses_directory_before_construction(monkeypatch, tmp_path): + local_factory_fixture(monkeypatch, tmp_path) + with pytest.raises(ValueError, match="Explicit local US dataset must be a file"): + us_model.managed_microsimulation(dataset=str(tmp_path), allow_unmanaged=True) + + def test_local_factory_refuses_source_changes_during_construction( monkeypatch, tmp_path ): @@ -289,6 +297,35 @@ def constructor(**kwargs): assert list(arrays["monthly_fixture"]) == ["2017-01"] +def test_native_clock_preserves_periods_in_real_us_constructor(monkeypatch, tmp_path): + from policyengine_core.periods import period + + path = tmp_path / "native-input.h5" + with h5py.File(path, "w") as file: + file.create_dataset("person_id/2017", data=[1]) + for entity in us_model.US_GROUP_ENTITIES: + file.create_dataset(f"{entity}_id/2017", data=[1]) + file.create_dataset(f"person_{entity}_id/2017", data=[1]) + file.create_dataset("age/2015", data=[20]) + file.create_dataset("monthly_age/2017-01", data=[22]) + + monkeypatch.setattr( + us_model.PolicyEngineUSLatest, + "require_data_certification", + refuse_certification, + ) + sim = us_model.managed_microsimulation( + dataset=str(path), allow_unmanaged=True, native_input_period="2017" + ) + + assert sim.dataset.time_period == "2017" + assert sim.default_input_period == "2017" + assert sim.default_calculation_period == "2017" + assert sim.get_holder("age").get_known_periods() == [period("2015")] + assert sim.get_holder("monthly_age").get_known_periods() == [period("2017-01")] + assert sim.policyengine_bundle["certified_by"] is None + + @pytest.mark.parametrize( "data_format, arrays, message", [