@@ -72,6 +72,7 @@ class FHIREndpointViewSet(viewsets.GenericViewSet):
7272 ordering_fields = ["name" , "address" , "ehr_vendor_name" ]
7373 pagination_class = CustomPaginator
7474 pagination_class = CustomPaginator
75+ lookup_url_kwarg = "id"
7576
7677 @extend_schema (
7778 responses = {
@@ -117,15 +118,15 @@ def list(self, request):
117118 200 : OpenApiResponse (description = "Successfully retrieved FHIR Endpoint resource" )
118119 }
119120 )
120- def retrieve (self , request , pk = None ):
121+ def retrieve (self , request , id = None ):
121122 """
122123 Query a specific endpoint as a FHIR Endpoint resource
123124 """
124125
125126 try :
126- UUID (pk )
127+ UUID (id )
127128 except (ValueError , TypeError ):
128- return HttpResponse (f"Endpoint { escape (pk )} not found" , status = 404 )
129+ return HttpResponse (f"Endpoint { escape (id )} not found" , status = 404 )
129130
130131 endpoint = get_object_or_404 (
131132 EndpointInstance .objects .prefetch_related (
@@ -136,7 +137,7 @@ def retrieve(self, request, pk=None):
136137 "endpointinstancetopayload_set__mime_type" ,
137138 "endpointinstancetootherid_set" ,
138139 ),
139- pk = pk ,
140+ id = id ,
140141 )
141142
142143 serialized_endpoint = EndpointSerializer (endpoint , context = {"request" : request })
@@ -160,6 +161,7 @@ class FHIRPractitionerViewSet(viewsets.GenericViewSet):
160161 filter_backends = [DjangoFilterBackend , SearchFilter , ParamOrderingFilter ]
161162 filterset_class = PractitionerFilterSet
162163 pagination_class = CustomPaginator
164+ lookup_url_kwarg = "id"
163165
164166 ordering_fields = [
165167 "individual__individualtoname__last_name" ,
@@ -217,14 +219,14 @@ def list(self, request):
217219 200 : OpenApiResponse (description = "Successfully retrieved FHIR Practitioner resource" )
218220 }
219221 )
220- def retrieve (self , request , pk = None ):
222+ def retrieve (self , request , id = None ):
221223 """
222224 Query a specific provider as a FHIR Practitioner resource
223225 """
224226 try :
225- UUID (pk )
227+ UUID (id )
226228 except (ValueError , TypeError ):
227- return HttpResponse (f"Practitioner { escape (pk )} not found" , status = 404 )
229+ return HttpResponse (f"Practitioner { escape (id )} not found" , status = 404 )
228230
229231 provider = get_object_or_404 (
230232 Provider .objects .prefetch_related (
@@ -240,7 +242,7 @@ def retrieve(self, request, pk=None):
240242 "providertootherid_set" ,
241243 "providertotaxonomy_set" ,
242244 ),
243- individual_id = pk ,
245+ individual_id = id ,
244246 )
245247
246248 serialized_practitioner = PractitionerSerializer (provider )
@@ -264,6 +266,7 @@ class FHIRPractitionerRoleViewSet(viewsets.GenericViewSet):
264266 filter_backends = [DjangoFilterBackend , SearchFilter , ParamOrderingFilter ]
265267 filterset_class = PractitionerRoleFilterSet
266268 pagination_class = CustomPaginator
269+ lookup_url_kwarg = "id"
267270
268271 ordering_fields = ["location__name" , "practitioner_first_name" , "practitioner_last_name" ]
269272
@@ -308,16 +311,16 @@ def list(self, request):
308311 )
309312 }
310313 )
311- def retrieve (self , request , pk = None ):
314+ def retrieve (self , request , id = None ):
312315 """
313316 Query a specific relationship between providers, healthcare organizations, and practice locations, represented as a FHIR PractitionerRole resource
314317 """
315318 try :
316- UUID (pk )
319+ UUID (id )
317320 except (ValueError , TypeError ):
318- return HttpResponse (f"PractitionerRole { escape (pk )} not found" , status = 404 )
321+ return HttpResponse (f"PractitionerRole { escape (id )} not found" , status = 404 )
319322
320- practitionerrole = get_object_or_404 (ProviderToLocation , pk = pk )
323+ practitionerrole = get_object_or_404 (ProviderToLocation , id = id )
321324
322325 serialized_practitionerrole = PractitionerRoleSerializer (
323326 practitionerrole , context = {"request" : request }
@@ -342,6 +345,7 @@ class FHIROrganizationViewSet(viewsets.GenericViewSet):
342345 filter_backends = [DjangoFilterBackend , SearchFilter , ParamOrderingFilter ]
343346 filterset_class = OrganizationFilterSet
344347 pagination_class = CustomPaginator
348+ lookup_url_kwarg = "id"
345349
346350 ordering_fields = ["organizationtoname__name" ]
347351
@@ -403,14 +407,14 @@ def list(self, request):
403407 200 : OpenApiResponse (description = "Successfully retrieved FHIR Organization resource" )
404408 }
405409 )
406- def retrieve (self , request , pk = None ):
410+ def retrieve (self , request , id = None ):
407411 """
408412 Query a specific organization, represented as a FHIR Organization resource
409413 """
410414 try :
411- UUID (pk )
415+ UUID (id )
412416 except (ValueError , TypeError ):
413- return HttpResponse (f"Organization { escape (pk )} not found" , status = 404 )
417+ return HttpResponse (f"Organization { escape (id )} not found" , status = 404 )
414418
415419 organization = get_object_or_404 (
416420 Organization .objects .prefetch_related (
@@ -435,7 +439,7 @@ def retrieve(self, request, pk=None):
435439 "clinicalorganization__organizationtotaxonomy_set" ,
436440 "clinicalorganization__organizationtotaxonomy_set__nucc_code" ,
437441 ),
438- pk = pk ,
442+ id = id ,
439443 )
440444
441445 serialized_organization = OrganizationSerializer (organization , context = {"request" : request })
@@ -459,6 +463,7 @@ class FHIRLocationViewSet(viewsets.GenericViewSet):
459463 filter_backends = [DjangoFilterBackend , SearchFilter , ParamOrderingFilter ]
460464 filterset_class = LocationFilterSet
461465 pagination_class = CustomPaginator
466+ lookup_url_kwarg = "id"
462467
463468 ordering_fields = ["organization_name" , "address_full" , "name" ]
464469
@@ -516,16 +521,16 @@ def list(self, request):
516521 200 : OpenApiResponse (description = "Successfully retrieved FHIR Location resource" )
517522 }
518523 )
519- def retrieve (self , request , pk = None ):
524+ def retrieve (self , request , id = None ):
520525 """
521526 Query a specific healthcare practice location as a FHIR Location resource
522527 """
523528 try :
524- UUID (pk )
529+ UUID (id )
525530 except (ValueError , TypeError ):
526- return HttpResponse (f"Location { escape (pk )} not found" , status = 404 )
531+ return HttpResponse (f"Location { escape (id )} not found" , status = 404 )
527532
528- location = get_object_or_404 (Location , pk = pk )
533+ location = get_object_or_404 (Location , id = id )
529534
530535 serialized_location = LocationSerializer (location , context = {"request" : request })
531536
0 commit comments