Uploads¶
- class icometrix_sdk.resources.uploads.Uploads(api, polling_interval=2)¶
Bases:
object
- Parameters:
api (ApiClient)
- complete_upload(upload_uri)¶
A function to complete an upload entry, and start the importing the files
- Parameters:
upload_uri (str) – The uri to upload to
- Returns:
- Return type:
- get_all(project_id, **kwargs)¶
List all uploads within a project
- Param:
The ID of the project
- Returns:
A Paginated response containing upload entries
- Parameters:
project_id (str)
- Return type:
- get_one(upload_uri)¶
Get a single upload entry based on the upload uri
- Parameters:
upload_uri (str) – the uri of the upload
- Returns:
A single patient or 404
- Return type:
- get_studies_for_upload(upload_folder_uri, **kwargs)¶
Get studies created by this upload (first wait till import is finished)
- Parameters:
upload_folder_uri (str) – the folder uri of the upload (UploadEntry.folder_uri)
- Returns:
- Return type:
- get_uploaded_files(upload_folder_uri, **kwargs)¶
List all files that have been uploaded to a UploadEntry Once the upload has been completed, and imported the files will be removed
For name conflict avoidance; the original file name will be prepended with a UUID and sanitized: Only ASCII alphanumerals,
'.'
,'-'
and'_'
are allowed for maximum portability and safety wrt using this name as a filename on a regular file system. All other characters will be replaced with an underscore ('_'
).The filename is normalized to the Unicode
NKFD
form prior to ASCII conversion in order to extract more alphanumerals where a decomposition is available. For instance:‘Bold Digit 𝟏’ => ‘Bold_Digit_1’ ‘Ångström unit physics.pdf’ => ‘A_ngstro_m_unit_physics.pdf’
- Parameters:
upload_folder_uri (str) – the folder uri of the upload (UploadEntry.folder_uri)
- Returns:
An object containing all file names (If the upload has been imported, the file list will be empty)
- Return type:
- start_upload(project_id, start_upload, **kwargs)¶
A function to create an upload entry, that can be used to upload a block of data
- Parameters:
project_id (str) – The ID of the project you want to upload to
start_upload (StartUploadDto) – Extra upload options
- Returns:
- Return type:
- upload_all_files_in_dir(upload_uri, dicom_dir_path, complete_on_error=False)¶
A higher level function to upload all DICOMs of a directory AND all of its subdirectories
- Parameters:
upload_uri (str) – the URI of the upload entry
dicom_dir_path (str) – The path to the directory
complete_on_error – Setting this boolean to true will still complete the upload, even if a file failed to upload
- Returns:
- Return type:
int
- upload_dicom(upload_uri, fields)¶
Upload files to an upload entry, these can be DICOMs or zips
- Parameters:
upload_uri (str) – The uri to upload to
fields – Dictionary of fields or list of (key,
RequestField
).
- Returns:
- upload_dicom_dir(project_id, dicom_dir_path, options, complete_on_error=False)¶
A higher level function to upload all DICOMs of a directory AND all of its subdirectories
- Parameters:
project_id (str) – The ID of the project you want to upload to
dicom_dir_path (str) – The path to the directory
options (StartUploadDto) – Extra upload options
complete_on_error – Setting this boolean to true will still complete the upload, even if a file failed to upload
- Returns:
- Return type:
- upload_dicom_path(upload_uri, file_path)¶
Upload a file to an upload entry
- Parameters:
upload_uri (str) – Uri to upload to (UploadEntity.uri)
file_path (str) – The path to the file
- Returns:
- wait_for_data_import(upload_uri)¶
After data has been upload (and completed), we need to wait for the data to be imported
- Parameters:
upload_uri (str) – The uri to upload to
- Returns:
UploadEntity
- Return type: