Skip to content

Commit

Permalink
[PRMP-1286] Change create fhir response to return json
Browse files Browse the repository at this point in the history
  • Loading branch information
NogaNHS committed Jan 3, 2025
1 parent cfe6c2b commit 4e3de59
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lambdas/models/fhir/R4/nrl_fhir_document_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ContentStabilityExtensionCoding(Coding):


class ContentStabilityExtensionValueCodeableConcept(CodeableConcept):
coding: List[ContentStabilityExtensionCoding] = ContentStabilityExtensionCoding()
coding: List[ContentStabilityExtensionCoding] = [ContentStabilityExtensionCoding()]


class ContentStabilityExtension(Extension):
Expand Down
4 changes: 2 additions & 2 deletions lambdas/services/nrl_get_document_reference_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def handle_get_document_reference_request(self, document_id, bearer_token):

def create_document_reference_fhir_response(
self, document_reference: DocumentReference, presign_url: str
) -> dict:
) -> str:
document_details = Attachment(
url=presign_url,
title=document_reference.file_name,
Expand All @@ -61,7 +61,7 @@ def create_document_reference_fhir_response(
attachment=document_details,
)
.create_fhir_document_reference_object()
.model_dump(exclude_none=True)
.model_dump_json(exclude_none=True)
)
return fhir_document_reference

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import json

import pytest
from enums.patient_ods_inactive_status import PatientOdsInactiveStatus
from services.nrl_get_document_reference_service import NRLGetDocumentReferenceService
Expand Down Expand Up @@ -153,7 +155,7 @@ def test_create_document_reference_fhir_response(patched_service):
actual = patched_service.create_document_reference_fhir_response(
create_test_doc_store_refs()[0], FAKE_URL
)
assert actual["content"][0]["attachment"]["url"] == FAKE_URL
assert json.loads(actual)["content"][0]["attachment"]["url"] == FAKE_URL


def test_user_allowed_to_see_file_happy_path(patched_service, mock_fetch_user_info):
Expand Down

0 comments on commit 4e3de59

Please sign in to comment.