From eb52c8a56a24d30a449a2809622c90e01fab1a17 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Tue, 1 Nov 2022 16:34:51 +0530 Subject: [PATCH] Made icd search case insensitive (#1085) fix (icd): made icd search case insensitive --- care/facility/api/viewsets/icd.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/care/facility/api/viewsets/icd.py b/care/facility/api/viewsets/icd.py index 137173625c..2b5851d05c 100644 --- a/care/facility/api/viewsets/icd.py +++ b/care/facility/api/viewsets/icd.py @@ -1,3 +1,5 @@ +from re import IGNORECASE + from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from rest_framework.viewsets import ViewSet @@ -22,6 +24,6 @@ def list(self, request): if request.GET.get("query", False): query = request.GET.get("query") queryset = queryset.where( - label=queryset.re_match(r".*" + query + r".*") + label=queryset.re_match(r".*" + query + r".*", IGNORECASE) ) # can accept regex from FE if needed. return Response(serailize_data(queryset[0:100]))