Skip to content

Commit

Permalink
added permissive arg to modify_bulk
Browse files Browse the repository at this point in the history
  • Loading branch information
amazy committed Apr 5, 2024
1 parent aae9c69 commit 4132aed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions orthanc_api_client/resources/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def _modify(self, orthanc_id: str, replace_tags: Any = {}, remove_tags: List[str

return None # TODO: raise exception ???

def modify_bulk(self, orthanc_ids: List[str] = [], replace_tags: Any = {}, remove_tags: List[str] = [], keep_tags: List[str] = [], delete_original: bool = True, force: bool = False, transcode: Optional[str] = None) -> Tuple[List[str], List[str], List[str], List[str]]:
def modify_bulk(self, orthanc_ids: List[str] = [], replace_tags: Any = {}, remove_tags: List[str] = [], keep_tags: List[str] = [], delete_original: bool = True, force: bool = False, transcode: Optional[str] = None, permissive: bool = False) -> Tuple[List[str], List[str], List[str], List[str]]:
"""
returns a tuple with:
- the list of modified instances ids
Expand Down Expand Up @@ -300,12 +300,13 @@ def modify_bulk(self, orthanc_ids: List[str] = [], replace_tags: Any = {}, remov
raise api_exceptions.OrthancApiException(msg=f"Error while modifying bulk {self._get_level()}, job failed {json.dumps(job.info.content)}")


def modify_bulk_async(self, orthanc_ids: List[str] = [], replace_tags: Any = {}, remove_tags: List[str] = [], keep_tags: List[str] = [], delete_original: bool = True, force: bool = False, transcode: Optional[str] = None) -> Job:
def modify_bulk_async(self, orthanc_ids: List[str] = [], replace_tags: Any = {}, remove_tags: List[str] = [], keep_tags: List[str] = [], delete_original: bool = True, force: bool = False, transcode: Optional[str] = None, permissive: bool = False) -> Job:
query = {
"Force": force,
"Level": self._get_level(),
"Resources": orthanc_ids,
"Asynchronous": True
"Asynchronous": True,
"Permissive": permissive
}

if replace_tags is not None and len(replace_tags) > 0:
Expand All @@ -328,6 +329,7 @@ def modify_bulk_async(self, orthanc_ids: List[str] = [], replace_tags: Any = {},
else:
raise HttpError(http_status_code=r.status_code, msg="Error in bulk-modify", url=r.url, request_response=r)


def print_daily_stats(self, from_date: datetime.date = None, to_date: datetime.date = None):
if self._url_segment == "patients":
raise NotImplementedError("Print daily stats is not implemented for Patient level")
Expand Down
2 changes: 2 additions & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- added `Permissive` argument to `OrthancApiClient.resources.modify_bulk`

v 0.15.0
========

Expand Down

0 comments on commit 4132aed

Please sign in to comment.