Bug: `$clone` leaves `from_source_url` (and `to_source_url`) pointing at the original source on copied mappings
Chưa có ai nhận issue này.
Đá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
- 72/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- backend
Hướng nghiên cứu
Bắt đầu tại core/sources/models.py, ở clone_mappings(), và kiểm tra cách Mapping.clone() sao chép các URL nguồn. So sánh URI cha của các khái niệm được gán với các giá trị from_source_url và to_source_url đã sao chép; cập nhật luồng sao chép để các trường này khớp với những khái niệm được gán. Hoàn tất khi các mapping được sao chép bằng $clone trả về URL nguồn đích trong phản hồi chi tiết/API của mapping.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Expected Behavior
When a concept is cloned into another source with $clone, each copied mapping belongs to the target source and starts from the new concept. So its from_source_url should be the target source, e.g. /orgs/PIH/sources/PIH/. More generally, from_source_url/to_source_url should match from_concept_url/to_concept_url and from_source_name/to_source_name.
Current Behavior
from_source_url keeps the value from the original mapping, i.e. the source the concept was cloned from, while from_concept_url and from_source_name are updated.
Example: PIH 21400 was cloned from CIEL 170656. CIEL mapping /orgs/CIEL/sources/CIEL/mappings/17052749/ is SAME-AS LOINC:53625-0. The copy, https://app.v3.openconceptlab.org/orgs/PIH/sources/PIH/mappings/44946/, has:
| field | value |
|---|---|
| from_concept_url | /orgs/PIH/sources/PIH/concepts/21400/ |
| from_source_name | PIH |
| from_source_url | /orgs/CIEL/sources/CIEL/ |
| to_* | LOINC 53625-0 (correct) |
When the clone also retargets a mapping to a concept in the target source (see #3013), to_source_url isn't updated either. Example: https://app.v3.openconceptlab.org/orgs/PIH/sources/PIH/mappings/46475/ has to_concept_url=/orgs/PIH/sources/PIH/concepts/21768/ and to_source_name=PIH, but to_source_url=/orgs/CIEL/sources/CIEL/.
The concept view labels mappings by *_source_name, so the problem is only visible in the mapping detail/edit view or the API.
Possible Solution
In core/sources/models.py clone_mappings(), the code sets from_concept_id, from_concept_code, from_source_id (and the to_* equivalents) from the assigned concepts, but not from_source_url/to_source_url. Mapping.clone() copies those URLs from the original. Setting them from the assigned concepts' parent (concept.parent.uri) would fix it.
Steps to Reproduce
- Pick a CIEL concept with mappings to other sources, e.g. CIEL 170656.
- Clone it into a source you can edit, using TermBrowser "Clone to source" (v2 or v3) or
POST <target source>/concepts/$clone/withequivalencyMapType=SAME-AS. - GET the new concept with
?includeMappings=true, then GET one of its copied mappings with?verbose=true. from_source_urlis the CIEL source, not the target source.
Context (Environment)
Production (api.openconceptlab.org), PIH organization source /orgs/PIH/sources/PIH/. In release 1.8.46 about 3,850 copied mappings have this, going back to March 2024. The OpenMRS OCL module doesn't use from_source_url, so imports aren't affected, but the data is inconsistent and confusing for anyone reading or editing the mappings.
Detailed Description
Found while investigating a related, more serious clone problem: mappings to external code systems being retargeted to concepts in the target source (#3013). That issue also leaves to_source_url stale.
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 4
- Fork
- 2
- Merge trung bình
- 2 giờ 12 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc 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 OpenConceptLab/ocl_issues
-
component/fhir type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
OpenConceptLab/ocl_issues#3026 ·
-
component/design-system decision/ai-ready signal/low-risk signal/quick-win signal/small-scope signal/well-specified stage/triaged type/docs
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 70/100
OpenConceptLab/ocl_issues#2983 · 1 bình luận ·
-
component/mapper decision/ai-ready signal/low-risk signal/quick-win signal/small-scope signal/well-specified stage/triaged type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
OpenConceptLab/ocl_issues#2966 · 2 bình luận ·
-
component/mapper component/web decision/human-review signal/low-risk signal/needs-human signal/quick-win signal/small-scope signal/well-specified stage/triaged type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
OpenConceptLab/ocl_issues#2920 · 1 bình luận ·
-
component/web decision/ai-ready signal/low-risk signal/quick-win signal/small-scope signal/well-specified stage/triaged type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
OpenConceptLab/ocl_issues#2919 · 1 bình luận ·
Tất cả issue của OpenConceptLab/ocl_issues
Issue tương tự
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
coder/claudecode.nvim#587 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
digitalbazaar/http-client#60 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
fivetran/dbt_recurly#55 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
topmonks/hlidac-shopu#3687 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug lane: fast
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
unicef/adt-studio#1109 ·
Maintainer thường phản hồi trong vòng 2 ngày