Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions execution_engine/omop/cohort/recommendation.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@

Sets all _id attributes to None in the recommendation and all its population/intervention pairs and criteria.
"""
self._id = None
self.reset_id()

Check warning on line 213 in execution_engine/omop/cohort/recommendation.py

View check run for this annotation

Codecov / codecov/patch

execution_engine/omop/cohort/recommendation.py#L213

Added line #L213 was not covered by tests

for pi_pair in self.population_intervention_pairs():
pi_pair._id = None
pi_pair.reset_id()

Check warning on line 216 in execution_engine/omop/cohort/recommendation.py

View check run for this annotation

Codecov / codecov/patch

execution_engine/omop/cohort/recommendation.py#L216

Added line #L216 was not covered by tests

for criterion in self.atoms():
criterion._id = None
criterion.reset_id()

Check warning on line 219 in execution_engine/omop/cohort/recommendation.py

View check run for this annotation

Codecov / codecov/patch

execution_engine/omop/cohort/recommendation.py#L219

Added line #L219 was not covered by tests
6 changes: 2 additions & 4 deletions execution_engine/omop/db/celida/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class ResultInterval(Base): # noqa: D101
)

result_id: Mapped[int] = mapped_column(
Integer, primary_key=True, index=True, autoincrement=True
BigInteger, primary_key=True, index=True, autoincrement=True
)
run_id = mapped_column(
ForeignKey(f"{SCHEMA_NAME}.execution_run.run_id"),
Expand All @@ -169,9 +169,7 @@ class ResultInterval(Base): # noqa: D101
interval_start: Mapped[datetime]
interval_end: Mapped[datetime]
interval_type = mapped_column(IntervalTypeEnum)
interval_ratio: Mapped[float] = mapped_column(
nullable=True
)
interval_ratio: Mapped[float] = mapped_column(nullable=True)
execution_run: Mapped["ExecutionRun"] = relationship(
primaryjoin="ResultInterval.run_id == ExecutionRun.run_id",
)
Expand Down
16 changes: 9 additions & 7 deletions execution_engine/task/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def default_interval_union_with_count(
interval_type, interval_count = IntervalType.NEGATIVE, 0
else:
interval_type, interval_count = interval.type, cast(int, interval.count)

if (
(
interval_type is IntervalType.POSITIVE
Expand Down Expand Up @@ -199,14 +200,15 @@ def receives_only_count_inputs(self) -> bool:
Indicates whether this tasks only receives inputs from expression that perform counting and thus return
IntervalWithCount.
"""
# all arguments are count types
if all(isinstance(parent, COUNT_TYPES) for parent in self.expr.args):
return True

# all arguments are logic.BinaryNonCommutativeOperator, and all of their "right" children are count types
# all arguments are either count types or logic.BinaryNonCommutativeOperator
# with their "right" child being a count type, or they have a custom counting function (count_intervals())
if all(
isinstance(parent, logic.BinaryNonCommutativeOperator)
and isinstance(parent.right, COUNT_TYPES)
(
isinstance(parent, logic.BinaryNonCommutativeOperator)
and isinstance(parent.right, COUNT_TYPES)
)
or (isinstance(parent, COUNT_TYPES))
or (hasattr(parent, "count_intervals"))
for parent in self.expr.args
):
return True
Expand Down
9 changes: 8 additions & 1 deletion execution_engine/util/serializable.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,14 @@
"""
if self._id is not None and not overwrite:
raise ValueError("Database ID has already been set!")
self._id = value
object.__setattr__(self, "_id", value)

def reset_id(self) -> None:
"""
Resets the database ID.
"""
# Circumvents the immutable __setattr__
object.__setattr__(self, "_id", None)

Check warning on line 180 in execution_engine/util/serializable.py

View check run for this annotation

Codecov / codecov/patch

execution_engine/util/serializable.py#L180

Added line #L180 was not covered by tests

@property
def id(self) -> int:
Expand Down