Skip to content

Harden CPS basic ORG loading and caching#727

Merged
MaxGhenis merged 4 commits intomainfrom
codex/fix-org-loader
Apr 12, 2026
Merged

Harden CPS basic ORG loading and caching#727
MaxGhenis merged 4 commits intomainfrom
codex/fix-org-loader

Conversation

@MaxGhenis
Copy link
Copy Markdown
Contributor

Summary

  • fetch CPS basic ORG monthly files via explicit HTTP requests and parse from bytes before selecting columns
  • normalize column resolution case-insensitively and add retry coverage for transient bad responses
  • serialize ORG cache creation with a file lock and atomic temp-file replace so concurrent builds share one cache artifact

Testing

  • UV_PYTHON=3.14 uv run pytest tests/unit/datasets/test_org.py -q
  • UV_PYTHON=3.14 uv run ruff check policyengine_us_data/datasets/org/org.py tests/unit/datasets/test_org.py
  • python3 -m py_compile policyengine_us_data/datasets/org/org.py tests/unit/datasets/test_org.py
  • UV_PYTHON=3.14 uv run python - <<'PY'
    from policyengine_us_data.datasets.org.org import _load_cps_basic_org_month
    month = _load_cps_basic_org_month(2024, "may", max_attempts=1)
    print(month.shape)
    print(month.columns.tolist())
    PY

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pipeline-diagrams Error Error Apr 12, 2026 3:02pm

Request Review

@MaxGhenis MaxGhenis merged commit ce11854 into main Apr 12, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant