Use icontains as fallback for AD search#3676
Conversation
📝 WalkthroughWalkthroughThis PR expands activity definition filtering to support acronym matching. The ChangesAcronym Filtering Enhancement
🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR improves the
Confidence Score: 5/5Safe to merge — the change is a minimal, targeted OR-condition addition with a direct test covering the new path. The filter change is two lines, does not touch auth or write paths, and is covered by a new test that specifically exercises the acronym case that motivated the fix. The annotation+order_by(-similarity) contract is preserved for both match types. No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "Use icontains as fallback for AD search" | Re-trigger Greptile |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
care/emr/tests/test_activity_definition_api.py (1)
1152-1158: ⚡ Quick winAdd a lowercase-query assertion to actually prove case-insensitive fallback.
This test passes, but it currently validates only exact-case
"CRP". Please add one more request with"crp"and assert the same result, so__icontainsbehavior is explicitly locked in rather than assumed.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@care/emr/tests/test_activity_definition_api.py` around lines 1152 - 1158, Add a second GET in the test to assert case-insensitive matching by querying self.base_url with {"title": "crp"} and verifying the response status_code is 200, results length is 1, and that response.data["results"][0]["slug"] equals str(activity_definition.slug); update the test alongside the existing {"title": "CRP"} call (the relevant symbols are self.client.get, self.base_url, and activity_definition.slug) so the __icontains fallback is explicitly validated.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@care/emr/tests/test_activity_definition_api.py`:
- Around line 1152-1158: Add a second GET in the test to assert case-insensitive
matching by querying self.base_url with {"title": "crp"} and verifying the
response status_code is 200, results length is 1, and that
response.data["results"][0]["slug"] equals str(activity_definition.slug); update
the test alongside the existing {"title": "CRP"} call (the relevant symbols are
self.client.get, self.base_url, and activity_definition.slug) so the __icontains
fallback is explicitly validated.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 98585603-2de5-4788-a57f-9df2d49ede3d
📒 Files selected for processing (2)
care/emr/api/viewsets/activity_definition.pycare/emr/tests/test_activity_definition_api.py
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3676 +/- ##
========================================
Coverage 76.66% 76.67%
========================================
Files 479 479
Lines 23055 23056 +1
Branches 2385 2385
========================================
+ Hits 17676 17679 +3
+ Misses 4824 4823 -1
+ Partials 555 554 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Proposed Changes
Merge Checklist
Only 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
Release Notes