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
14 changes: 2 additions & 12 deletions execution_engine/execution_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def load_recommendation(
)
return recommendation

# recommendation could not be loaded from database, fetch it from FHIR server

recommendation = self.fhir_parser.parse_recommendation_from_url(
url=recommendation_url,
package_version=recommendation_package_version,
Expand Down Expand Up @@ -210,16 +212,6 @@ def _hash(obj: Serializable) -> tuple[bytes, str]:

def register_recommendation(self, recommendation: cohort.Recommendation) -> None:
"""Registers the Recommendation in the result database."""
# We don't want to include any ids in the hash since ids
# "accidental" in the sense that they depend on, at least, the
# order in which recommendations are inserted into the
# database.
assert recommendation._id is None
assert recommendation._base_criterion._id is None
for pi_pair in recommendation._pi_pairs:
assert pi_pair._id is None
for criterion in pi_pair.flatten():
assert criterion._id is None
# Get the hash but ignore the JSON representation for now
# since we will compute and insert a complete JSON
# representation later when we know all ids.
Expand Down Expand Up @@ -306,8 +298,6 @@ def register_population_intervention_pair(
:param pi_pair: The Population/Intervention Pair.
:param recommendation_id: The ID of the Population/Intervention Pair.
"""
# We don't want to include the id in the hash
assert pi_pair._id is None
_, pi_pair_hash = self._hash(pi_pair)
query = select(result_db.PopulationInterventionPair).where(
result_db.PopulationInterventionPair.pi_pair_hash == pi_pair_hash
Expand Down
2 changes: 0 additions & 2 deletions execution_engine/omop/cohort/population_intervention_pair.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ def dict(self) -> dict[str, Any]:
population = self._population
intervention = self._intervention
return {
"id": self._id,
"name": self.name,
"url": self.url,
"base_criterion": {
Expand Down Expand Up @@ -295,7 +294,6 @@ def from_dict(cls, data: Dict[str, Any]) -> "PopulationInterventionPair":
CriterionCombination, criterion_factory(**data["intervention"])
)
object = cls(
id=data["id"],
name=data["name"],
url=data["url"],
base_criterion=base_criterion,
Expand Down
2 changes: 0 additions & 2 deletions execution_engine/omop/cohort/recommendation.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ def dict(self) -> dict:
"""
base_criterion = self._base_criterion
return {
"id": self._id,
"population_intervention_pairs": [c.dict() for c in self._pi_pairs],
"base_criterion": {
"class_name": base_criterion.__class__.__name__,
Expand Down Expand Up @@ -291,5 +290,4 @@ def from_dict(cls, data: Dict[str, Any]) -> Self:
version=data["recommendation_version"],
description=data["recommendation_description"],
package_version=data["recommendation_package_version"],
recommendation_id=data["id"],
)
2 changes: 0 additions & 2 deletions execution_engine/omop/criterion/concept.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ def dict(self) -> dict[str, Any]:
Get a JSON representation of the criterion.
"""
return {
"id": self._id,
"category": self._category.value,
"concept": self._concept.model_dump(),
"value": (
Expand All @@ -159,7 +158,6 @@ def from_dict(cls, data: Dict[str, Any]) -> "ConceptCriterion":
"""

return cls(
id=data["id"],
category=CohortCategory(data["category"]),
concept=Concept(**data["concept"]),
value=(
Expand Down
1 change: 0 additions & 1 deletion execution_engine/omop/criterion/drug_exposure.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ def from_dict(cls, data: Dict[str, Any]) -> "DrugExposure":
assert dose is None or isinstance(dose, Dosage), "Dose must be a Dosage or None"

return cls(
id=data["id"],
category=CohortCategory(data["category"]),
ingredient_concept=Concept(**data["ingredient_concept"]),
dose=dose,
Expand Down
2 changes: 0 additions & 2 deletions execution_engine/omop/criterion/procedure_occurrence.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ def dict(self) -> dict[str, Any]:
assert self._concept is not None, "Concept must be set"

return {
"id": self._id,
"category": self._category.value,
"concept": self._concept.model_dump(),
"value": (
Expand Down Expand Up @@ -192,7 +191,6 @@ def from_dict(cls, data: Dict[str, Any]) -> "ProcedureOccurrence":
), "timing must be a ValueNumber"

return cls(
id=data["id"],
category=CohortCategory(data["category"]),
concept=Concept(**data["concept"]),
value=value,
Expand Down
4 changes: 2 additions & 2 deletions execution_engine/omop/criterion/visit_occurrence.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ def dict(self) -> dict[str, Any]:
"""
Get a JSON representation of the criterion.
"""
return {"id": self._id}
return {}

@classmethod
def from_dict(cls, data: Dict[str, Any]) -> "ActivePatients":
"""
Create a criterion from a JSON representation.
"""
return cls(id=data["id"])
return cls()


class PatientsActiveDuringPeriod(ActivePatients):
Expand Down
Loading