Provide guidance on parameters and variables with the same name
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- documentation
Hướng nghiên cứu
The issue names no files, tests, or entry points to inspect. Compare the three naming and variable-design examples, then document a decided convention for parameters and variables with the same name, including when the convention is considered complete.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
For example, consider the case of identifying whether a household is in poverty, where poverty line is indexed by household size. The formula could include Python variables that both represent the poverty line parameter (which is indexed by household size) and the household's poverty line based on their specific household size. I see three ways to address this:
A: Add a qualifier to the entity's value, e.g. household_
class is_in_poverty(Variable):
def formula(household, period, parameters):
poverty_line = parameters(period).poverty.poverty_line
household_size = household.nb_persons()
household_poverty_line = poverty_line[household_size]
return household("household_income") < household_poverty_line
B: Add a qualifier to the parameter, e.g. param_ or p_
class is_in_poverty(Variable):
def formula(household, period, parameters):
param_poverty_line = parameters(period).poverty.poverty_line
household_size = household.nb_persons()
poverty_line = poverty_line[household_size]
return household("household_income") < poverty_line
C: Add a separate OpenFisca variable for any parameter indexed by household features
class household_poverty_line(Variable):
def formula(household, period, parameters):
poverty_line = parameters(period).poverty.poverty_line
household_size = household.nb_persons()
return poverty_line[household_size]
class is_in_poverty(Variable):
def formula(household, period, parameters):
return household("household_income") < household("household_poverty_line")
Option C creates a lot of variables, but it seems cleanest to me. I think it would avoid the issue of potentially overlapping variables to represent parameters and Variables, but there might be some cases I'm not thinking of.
- Ngôn ngữ chính
- Makefile
- Star
- 1
- Fork
- 3
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PolicyEngine/policyengine.dev
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
PolicyEngine/policyengine.dev#19 · 1 bình luận ·
-
Add API documentation Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
Tất cả issue của PolicyEngine/policyengine.dev
Issue tương tự
-
Link Checker Report Đang mởautomated issue report
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Humanity AI Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
numfocus/project-fundraising#166 ·
-
area:proxy bug security severity:low track:open-source
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100