Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/apps/answers/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,9 @@ async def applet_ehr_answers_export(
)
ehr_zip_buffer = io.BytesIO()
try:
ehr_zip_filename = ehr_storage.download_ehr_zip(data, ehr_zip_buffer)
ehr_zip_filename = ehr_storage.download_ehr_zip(
storage_path=ehr_answer.ehr_storage_uri, data=data, file_buffer=ehr_zip_buffer
)

zip_file.writestr(ehr_zip_filename, ehr_zip_buffer.getvalue())
finally:
Expand Down
4 changes: 2 additions & 2 deletions src/apps/answers/tests/test_answers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4432,7 +4432,7 @@ async def test_applet_ehr_data_endpoint(

file_names = []

def _mock_download_ehr_zip(data, file_buffer):
def _mock_download_ehr_zip(storage_path, data, file_buffer):
file_buffer.write(b"mocked EHR zip data")
file_buffer.seek(0)

Expand Down Expand Up @@ -4486,7 +4486,7 @@ async def test_applet_ehr_data_endpoint_filtering_by_flow(

file_names = []

def _mock_download_ehr_zip(data, file_buffer):
def _mock_download_ehr_zip(storage_path, data, file_buffer):
file_buffer.write(b"mocked EHR zip data")
file_buffer.seek(0)

Expand Down
5 changes: 2 additions & 3 deletions src/apps/integrations/oneup_health/service/ehr_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,9 @@ async def upload_ehr_zip(self, resources_files: list[str], data: EHRData) -> str
finally:
zip_buffer.close()

def download_ehr_zip(self, data: EHRData, file_buffer: BinaryIO) -> str:
base_path = self._get_base_path(data)
def download_ehr_zip(self, storage_path: str, data: EHRData, file_buffer: BinaryIO) -> str:
filename = EHRStorage.ehr_zip_filename(data)
key = self._cdn_client.generate_key(FileScopeEnum.EHR, base_path, filename)
key = f"{storage_path}/{filename}"

self._cdn_client.download(key, file_buffer)

Expand Down
Loading