fix:added requester field in DiagnosticReportRetrieveSpec#3443
Conversation
📝 WalkthroughWalkthroughAdded a nullable Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Fix all issues with AI Agents 🤖
In @care/emr/resources/diagnostic_report/spec.py:
- Around line 82-85: The assignment to mapping["requester"] is creating a
one-element tuple because of the trailing comma; change the assignment so it
stores the dict returned by model_from_cache(UserSpec,
id=obj.service_request.requester_id) directly (remove the trailing comma) so
mapping["requester"] becomes the expected dict | None instead of a tuple.
- Around line 82-85: The code sets mapping["requester"] from
obj.service_request.requester_id without guarding against a null requester_id;
update the conditional to verify both that obj.service_request exists and that
obj.service_request.requester_id is truthy (e.g., if obj.service_request and
obj.service_request.requester_id:) before assigning mapping["requester"] with
model_from_cache(UserSpec, id=...), matching the guard pattern used in
service_request/spec.py and medication/request/spec.py.
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
care/emr/resources/diagnostic_report/spec.py
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (.cursorrules)
**/*.py: Prioritize readability and maintainability; follow Django's coding style guide (PEP 8 compliance).
Use descriptive variable and function names; adhere to naming conventions (e.g., lowercase with underscores for functions and variables).
Files:
care/emr/resources/diagnostic_report/spec.py
🧬 Code graph analysis (1)
care/emr/resources/diagnostic_report/spec.py (2)
care/emr/resources/base.py (2)
EMRResource(13-168)model_from_cache(232-275)care/emr/resources/user/spec.py (1)
UserSpec(124-138)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test / Test
🔇 Additional comments (2)
care/emr/resources/diagnostic_report/spec.py (2)
9-9: LGTM on the imports.The addition of
model_from_cacheandUserSpecimports are necessary and correctly used in the serialization logic below.Also applies to: 16-16
69-69: Field definition looks good.The
requesterfield follows the same pattern ascreated_byandupdated_by, which is consistent and appropriate.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3443 +/- ##
===========================================
- Coverage 74.46% 74.46% -0.01%
===========================================
Files 449 449
Lines 20701 20705 +4
Branches 2152 2153 +1
===========================================
+ Hits 15416 15418 +2
- Misses 4822 4824 +2
Partials 463 463 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Proposed Changes
Merge Checklist
/docsOnly PR's with test cases included and passing lint and test pipelines will be reviewed
@ohcnetwork/care-backend-maintainers @ohcnetwork/care-backend-admins
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.