bug: CLI `--source` accepts only 4 of the 7 `read_gifts` presets

Đang mở
#338 1 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

@ShahadatTest đang làm issue này rồi.

Từ ngày 3/11/2026.

  • #354 của @ShahadatTest — đang mở
  • #356 của @Sudhakar7J — đã đóng, không merge

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
30/100
Loại issue
Lỗi
Độ 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
cli

Hướng nghiên cứu

The hardcoded four-source tuple is _FEATURE_SOURCES in philanthropy/cli.py near line 47, and the if/elif reader chain is in _cmd_features near line 358. Read read_gifts and GIFT_SOURCES in the ingest module first, then check tests/test_cli.py for the existing features tests. Done means features --source accepts every name in GIFT_SOURCES and dispatches through read_gifts. Pull request #354 is already open against this issue, so check with the maintainers before starting.

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

Mô tả

bug easy good first issue roadmap

What happens

read_gifts and GIFT_SOURCES know seven presets: civicrm, raisers_edge, npsp, nonprofit_cloud, bloomerang, donorperfect, blackbaud_crm. The CLI still hardcodes four:

# philanthropy/cli.py:47
_FEATURE_SOURCES = ("civicrm", "raisers_edge", "npsp", "nonprofit_cloud")

So philanthropy features --source bloomerang --data gifts.csv fails with an argparse "invalid choice" error even though read_gifts(path, source="bloomerang") works. The same tuple gates train --source and check --source.

_cmd_features (philanthropy/cli.py:358) also re-implements the registry with an if/elif chain over the same four sources instead of calling read_gifts, which is how it fell behind each time a new reader landed.

Suggested fix

For features, replace the if/elif chain with ingest.read_gifts(args.data, source=args.source) and use ingest.GIFT_SOURCES as the choices. Keep the existing FileNotFoundError and KeyError handling around the call. Add a test in tests/test_cli.py that features accepts every name in GIFT_SOURCES, so the next reader is picked up automatically.

train --task leadership and check go through _read_raw_gifts, which needs each source's header canonicaliser and has its own bug (#337). Leave their choices on the four supported sources until that is fixed, so this issue stays a one-file change to _cmd_features plus its test.

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

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 PhilanthroPy-Project/PhilanthroPy

Tất cả issue của PhilanthroPy-Project/PhilanthroPy

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.