-
Notifications
You must be signed in to change notification settings - Fork 2
Add TRE API uploader #608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add TRE API uploader #608
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #608 +/- ##
==========================================
- Coverage 87.89% 87.54% -0.35%
==========================================
Files 76 77 +1
Lines 3619 3694 +75
==========================================
+ Hits 3181 3234 +53
- Misses 438 460 +22 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
6215016 to
dabc3df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces support for uploading to the ARC TRE API, complete with a new Uploader subclass and accompanying tests, and also refactors some existing FTPS tests and registration.
- Implements
TreApiUploaderand a_create_zip_archivehelper to handle DICOM and Parquet uploads via the TRE API. - Adds a full test suite for the TRE API uploader (
test_treapi.py) and adjusts FTPS tests to use a singleuid. - Registers
TreApiUploaderin the uploader factory and fixes a typo in the module doc.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pixl_core/src/core/uploader/_treapi.py | New TreApiUploader class with send, upload, flush methods and zip creation helper |
| pixl_core/tests/uploader/test_treapi.py | Unit tests covering token validation, DICOM/Parquet upload flows, and the zip utility |
| pixl_core/src/core/uploader/init.py | Added TreApiUploader to get_uploader factory and corrected a typo |
| pixl_core/tests/uploader/test_ftps.py | Refactored test_update_exported_and_save to use a single uid variable |
Comments suppressed due to low confidence (2)
pixl_core/src/core/uploader/_treapi.py:167
- Add tests for the upload failure path when
response.status_codeis notHTTP_CREATEDto ensureRuntimeErroris raised with the expected message.
if response.status_code != HTTP_CREATED:
pixl_core/src/core/uploader/_treapi.py:197
- Add tests for the flush failure path when
response.status_codeis notHTTP_CREATEDto validate error handling inflush().
if response.status_code != HTTP_CREATED:
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
We should be able to test private members
Patch coverage is low, mainly because I don't want to mock out the whole TRE API... 🫠 |
Though should only have the change in 0.8
|
Failing when uploading a 150 MB zip of parquet files either with an SSL error or bad gateway. Had a quick try of a couple of things to debug. Unsure if anything was taken down over christmas on the TRE side. Manually copied over file to TRE so not a huge rush.
|
| """ | ||
| zip_content = get_study_zip_archive(study_id) | ||
| self.send_via_api(zip_content, study_tags.pseudo_anon_image_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be
| self.send_via_api(zip_content, study_tags.pseudo_anon_image_id) | |
| self.send_via_api(zip_content, f"{study_tags.pseudo_anon_image_id}.zip") |
Closes #606
Adds the
TreApiUploaderclass to handle uploads to the ARC TRE API ingress