Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Return a client error for simulation years the model cannot project its dataset to

Đang mở
#969 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@anth-volk đang làm issue này rồi.

Từ ngày 27/10/2026.

  • #970 của @anth-volk — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
api, backend

Hướng nghiên cứu

Start from the year-file preparation path and the projection limit in policyengine_uk/data/dataset_schema.py, where ValueError("No dataset found for year ...") is raised. Then read job_status_routes.get_job_status and the existing SPMInputError/spm_error_detail handling to mirror the typed-error and 400-response pattern. Done means a request outside the installed model's supported year range returns HTTP 400 with code DATASET_YEAR_UNAVAILABLE, including the requested year and supported range.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Problem

A society-wide (economy) run for a year the country model cannot project its dataset to fails as a server error instead of a client error.

  • policyengine-uk projects its single-year dataset only to PROJECTION_END_YEAR (2032 since policyengine-uk 2.130.1; 2030 before). A UK run for a later year fails while .py prepares the year file: ValueError("No dataset found for year 2033.") from policyengine_uk/data/dataset_schema.py.
  • The gateway's job-status endpoint (job_status_routes.get_job_status) re-raises the job's exception from modal.FunctionCall.get, redacts it and returns HTTP 500 with status: "failed". The entry forwards that 500, and the Public API stores it as a computation failure and returns 502.
  • This happened on 2026-10-15 for 2031–2035 (when the limit was 2030) and on 2026-10-26 for 2033–2039.
  • A US run outside its dataset's projection (data year 2024, last projected year 2035 with the current model) does not fail: before 2024 the year file holds default inputs, and after 2035 it holds carried-over or index-uprated inputs. Neither is a supported result.

Intended change

Before .py prepares the dataset, check the requested year against the years the installed model projects the dataset to (from the source's data year to the model's projection end year), and raise a typed error with a stable code, DATASET_YEAR_UNAVAILABLE, carrying the requested year and the supported range. The gateway returns it as a 400 with that code and a readable message, following the pattern of the SPM input errors (SPMInputError, spm_error_detail).

This is the simulation service part of a change that also touches the Public API (map the code to a 400) and the app (don't offer unsupported UK years, show a readable message).

Ngôn ngữ chính
Python
Star
1
Fork
1
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
81

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của PolicyEngine/policyengine-sim-api

Tất cả issue của PolicyEngine/policyengine-sim-api

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.