Skip to content

Commit f4b77ac

Browse files
medmssaouriebrahimebrahim
authored andcommitted
Replace warning messages with info level for overwrites in database class (#94)
1 parent 4cd47fd commit f4b77ac

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/openlifu/db/database.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def add_gridweights(self, transducer_id: str, grid_hash: str, grid_weights, on_c
2626
if on_conflict == "error":
2727
raise ValueError(f"Grid weights with hash {grid_hash} already exists for transducer {transducer_id}.")
2828
elif on_conflict == "overwrite":
29-
self.logger.warning(f"Overwriting grid weights with hash {grid_hash} for transducer {transducer_id}.")
29+
self.logger.info(f"Overwriting grid weights with hash {grid_hash} for transducer {transducer_id}.")
3030
elif on_conflict == "skip":
3131
self.logger.info(f"Skipping grid weights with hash {grid_hash} for transducer {transducer_id} as it already exists.")
3232
else:
@@ -45,7 +45,7 @@ def add_protocol(self, protocol: Protocol, on_conflict: OnConflictOpts = "error"
4545
if on_conflict == "error":
4646
raise ValueError(f"Protocol with ID {protocol_id} already exists in the database.")
4747
elif on_conflict == "overwrite":
48-
self.logger.warning(f"Overwriting Protocol with ID {protocol_id} in the database.")
48+
self.logger.info(f"Overwriting Protocol with ID {protocol_id} in the database.")
4949
elif on_conflict == "skip":
5050
self.logger.info(f"Skipping Protocol with ID {protocol_id} as it already exists in the database.")
5151
return # Skip adding the Protocol
@@ -79,7 +79,7 @@ def add_session(self, subject, session, on_conflict="error"):
7979
if on_conflict == "error":
8080
raise ValueError(f"Session with ID {session_id} already exists for subject {subject.id}.")
8181
elif on_conflict == "overwrite":
82-
self.logger.warning(f"Overwriting session with ID {session_id} for subject {subject.id}.")
82+
self.logger.info(f"Overwriting session with ID {session_id} for subject {subject.id}.")
8383
elif on_conflict == "skip":
8484
self.logger.info(f"Skipping session with ID {session_id} for subject {subject.id} as it already exists.")
8585
return # Skip adding the session
@@ -105,7 +105,7 @@ def add_subject(self, subject, on_conflict="error"):
105105
if on_conflict == "error":
106106
raise ValueError(f"Subject with ID {subject_id} already exists in the database.")
107107
elif on_conflict == "overwrite":
108-
self.logger.warning(f"Overwriting subject with ID {subject_id} in the database.")
108+
self.logger.info(f"Overwriting subject with ID {subject_id} in the database.")
109109
elif on_conflict == "skip":
110110
self.logger.info(f"Skipping subject with ID {subject_id} as it already exists.")
111111
return
@@ -129,7 +129,7 @@ def add_transducer(self, transducer, on_conflict: OnConflictOpts="error"):
129129
if on_conflict == "error":
130130
raise ValueError(f"Transducer with ID {transducer_id} already exists in the database.")
131131
elif on_conflict == "overwrite":
132-
self.logger.warning(f"Overwriting transducer with ID {transducer_id} in the database.")
132+
self.logger.info(f"Overwriting transducer with ID {transducer_id} in the database.")
133133
elif on_conflict == "skip":
134134
self.logger.info(f"Skipping transducer with ID {transducer_id} as it already exists.")
135135
return
@@ -153,7 +153,7 @@ def add_system(self, system, on_conflict="error"):
153153
if on_conflict == "error":
154154
raise ValueError(f"Ultrasound system with ID {system_id} already exists in the database.")
155155
elif on_conflict == "overwrite":
156-
self.logger.warning(f"Overwriting ultrasound system with ID {system_id} in the database.")
156+
self.logger.info(f"Overwriting ultrasound system with ID {system_id} in the database.")
157157
elif on_conflict == "skip":
158158
self.logger.info(f"Skipping ultrasound system with ID {system_id} as it already exists.")
159159
return
@@ -180,7 +180,7 @@ def add_volume(self, subject, volume, on_conflict="error"):
180180
if on_conflict == "error":
181181
raise ValueError(f"Volume with ID {volume_id} already exists for subject {subject_id}.")
182182
elif on_conflict == "overwrite":
183-
self.logger.warning(f"Overwriting volume with ID {volume_id} for subject {subject_id}.")
183+
self.logger.info(f"Overwriting volume with ID {volume_id} for subject {subject_id}.")
184184
elif on_conflict == "skip":
185185
self.logger.info(f"Skipping volume with ID {volume_id} for subject {subject_id} as it already exists.")
186186
return

0 commit comments

Comments
 (0)