diff --git a/execution_engine/execution_engine.py b/execution_engine/execution_engine.py index bb591600..80b2daba 100644 --- a/execution_engine/execution_engine.py +++ b/execution_engine/execution_engine.py @@ -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, @@ -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. @@ -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 diff --git a/execution_engine/omop/cohort/population_intervention_pair.py b/execution_engine/omop/cohort/population_intervention_pair.py index c072b883..7f3da060 100644 --- a/execution_engine/omop/cohort/population_intervention_pair.py +++ b/execution_engine/omop/cohort/population_intervention_pair.py @@ -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": { @@ -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, diff --git a/execution_engine/omop/cohort/recommendation.py b/execution_engine/omop/cohort/recommendation.py index 7063e435..aeb334bd 100644 --- a/execution_engine/omop/cohort/recommendation.py +++ b/execution_engine/omop/cohort/recommendation.py @@ -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__, @@ -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"], ) diff --git a/execution_engine/omop/criterion/concept.py b/execution_engine/omop/criterion/concept.py index 2474db4d..3f11a703 100644 --- a/execution_engine/omop/criterion/concept.py +++ b/execution_engine/omop/criterion/concept.py @@ -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": ( @@ -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=( diff --git a/execution_engine/omop/criterion/drug_exposure.py b/execution_engine/omop/criterion/drug_exposure.py index 762e6ffa..c81f2a9d 100644 --- a/execution_engine/omop/criterion/drug_exposure.py +++ b/execution_engine/omop/criterion/drug_exposure.py @@ -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, diff --git a/execution_engine/omop/criterion/procedure_occurrence.py b/execution_engine/omop/criterion/procedure_occurrence.py index 58f2adb8..f464bb55 100644 --- a/execution_engine/omop/criterion/procedure_occurrence.py +++ b/execution_engine/omop/criterion/procedure_occurrence.py @@ -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": ( @@ -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, diff --git a/execution_engine/omop/criterion/visit_occurrence.py b/execution_engine/omop/criterion/visit_occurrence.py index fd9a9cfe..397fbe1e 100644 --- a/execution_engine/omop/criterion/visit_occurrence.py +++ b/execution_engine/omop/criterion/visit_occurrence.py @@ -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):