Skip to content

Commit f756b47

Browse files
committed
fix: add id reset function
1 parent 8b2958e commit f756b47

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

execution_engine/omop/cohort/recommendation.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,19 @@ def get_criterion(self, criterion_unique_name: str) -> Criterion:
236236

237237
raise NotImplementedError()
238238

239+
def reset_state(self) -> None:
240+
"""
241+
Reset the state of the recommendation.
242+
243+
Sets all _id attributes to None in the recommendation and all its population/intervention pairs and criteria.
244+
"""
245+
self._id = None
246+
247+
for pi_pair in self._pi_pairs:
248+
pi_pair._id = None
249+
for criterion in pi_pair.flatten():
250+
criterion._id = None
251+
239252
def dict(self) -> dict:
240253
"""
241254
Get the combination as a dictionary.

0 commit comments

Comments
 (0)