Skip to content

Commit a89e281

Browse files
Merge pull request #176 from PolicyEngine/single-year-dataset
Migrate to new single-year dataset format for efficiency
2 parents f0989fe + dc7c7f4 commit a89e281

5 files changed

Lines changed: 26 additions & 11 deletions

File tree

.github/workflows/push.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,3 @@ jobs:
7070
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
7171
- name: Publish a git tag
7272
run: ".github/publish-git-tag.sh || true"
73-
- name: Publish a Python distribution to PyPI
74-
uses: pypa/gh-action-pypi-publish@release/v1
75-
with:
76-
user: __token__
77-
password: ${{ secrets.PYPI }}
78-
skip-existing: true
79-
verbose: true

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ install:
1212
pip install -e ".[dev]" --config-settings editable_mode=compat
1313

1414
install-uv:
15-
uv pip install --system policyengine-uk
16-
uv pip install --system policyengine>=2.40.2
15+
uv pip install --system "jupyter-book>=2.0.0a0"
1716
uv pip install --system -e ".[dev]" --config-settings editable_mode=compat
1817

1918
download:
@@ -37,6 +36,7 @@ data:
3736
python policyengine_uk_data/datasets/frs/local_areas/constituencies/calibrate.py
3837
python policyengine_uk_data/datasets/frs/local_areas/local_authorities/calibrate.py
3938
python policyengine_uk_data/utils/create_multi_year_dataset.py
39+
python policyengine_uk_data/storage/migrate_to_uk_single_year_datasets.py
4040

4141
efrs:
4242
python policyengine_uk_data/datasets/frs/enhanced_frs.py

changelog_entry.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- bump: patch
2+
changes:
3+
fixed:
4+
- Migrated to more efficient dataset version.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from policyengine_uk.data import UKSingleYearDataset
2+
from policyengine_uk import Microsimulation
3+
from policyengine_core.data import Dataset
4+
from policyengine_uk_data.datasets import EnhancedFRS_2023_24, FRS_2023_24
5+
6+
7+
def migrate_to_uk_single_year_dataset(file_path: str):
8+
sim = Microsimulation(dataset=Dataset.from_file(file_path))
9+
10+
single_year_dataset = UKSingleYearDataset.from_simulation(
11+
sim, fiscal_year=2023
12+
)
13+
14+
single_year_dataset.save(file_path)
15+
16+
17+
if __name__ == "__main__":
18+
migrate_to_uk_single_year_dataset(FRS_2023_24.file_path)
19+
migrate_to_uk_single_year_dataset(EnhancedFRS_2023_24.file_path)

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dependencies = [
2222
"google-cloud-storage",
2323
"google-auth",
2424
"uk-public-services-imputation",
25-
"policyengine-uk>=2.40.2",
25+
"policyengine-uk==2.40.2",
2626
]
2727

2828
[project.optional-dependencies]
@@ -32,7 +32,6 @@ dev = [
3232
"torch",
3333
"tables",
3434
"furo",
35-
"jupyter-book",
3635
"yaml-changelog>=0.1.7",
3736
"itables",
3837
"quantile-forest",

0 commit comments

Comments
 (0)