コード例 #1
0
 def alias_group(self, request):
     group_id = request.GET['group_id']
     results = Person.objects.filter(alias_group=group_id)
     serializer = IDManagementSerializer(results,
                                         many=True,
                                         context={'request': request})
     return Response(serializer.data)
コード例 #2
0
 def fuzzy_match(self, request):
     input_name = request.GET['name']
     if 'exclude' in request.GET:
         excludes = request.GET['exclude']
     else:
         excludes = ''
     results = fuzzy_matching.match_person(input_name, excludes)
     serializer = IDManagementSerializer(results,
                                         many=True,
                                         context={'request': request})
     return Response(serializer.data)
コード例 #3
0
    def partial_phone(self, request):
        input_phone = request.GET['phone']
        victim_ids = []
        if 'exclude' in request.GET:
            excludes = request.GET['exclude']
            if excludes != None and excludes == 'victims':
                irf_victim_ids = Interceptee.objects.filter(
                    kind='v').values_list('person', flat=True)
                vif_victim_ids = VictimInterview.objects.all().values_list(
                    'victim', flat=True)
                victim_ids = list(chain(irf_victim_ids, vif_victim_ids))

        results = Person.objects.filter(
            phone_contact__contains=input_phone).exclude(id__in=victim_ids)
        serializer = IDManagementSerializer(results,
                                            many=True,
                                            context={'request': request})
        return Response(serializer.data)
コード例 #4
0
    def partial_phone(self, request):
        input_phone = request.GET['phone']
        victim_ids = []
        if 'filter' in request.GET:
            filter = request.GET['filter']
            if filter is not None and filter == 'PVOT':
                victim_ids = fuzzy_matching.pvot_ids()
                results = Person.objects.filter(
                    phone_contact__contains=input_phone, id__in=victim_ids)
            elif filter is not None and filter == 'Suspect':
                suspect_ids = fuzzy_matching.suspect_ids()
                results = Person.objects.filter(
                    phone_contact__contains=input_phone, id__in=suspect_ids)
            else:
                results = Person.objects.filter(
                    phone_contact__contains=input_phone)
        else:
            results = Person.objects.filter(
                phone_contact__contains=input_phone)

        serializer = IDManagementSerializer(results,
                                            many=True,
                                            context={'request': request})
        return Response(serializer.data)
コード例 #5
0
 def get_person(self, request):
     person_id = request.GET['person_id']
     person = Person.objects.get(id=person_id)
     serializer = IDManagementSerializer(person,
                                         context={'request': request})
     return Response(serializer.data)