Skip to content

Commit e428be3

Browse files
committed
feat: remove cohort parameter
1 parent 5461b98 commit e428be3

35 files changed

+231
-299
lines changed

apps/rest_api/app/routers/recommendation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ async def recommendation_criteria(
5050
data.append(
5151
{
5252
"description": c.description(),
53-
"cohort_category": c.category,
5453
}
5554
)
5655

execution_engine/converter/action/abstract.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from fhir.resources.timing import Timing as FHIRTiming
55

6-
from execution_engine.constants import CohortCategory
76
from execution_engine.converter.criterion import CriterionConverter, parse_code
87
from execution_engine.converter.goal.abstract import Goal
98
from execution_engine.fhir.recommendation import RecommendationPlan
@@ -158,9 +157,7 @@ def to_positive_criterion(self) -> Criterion | LogicalCriterionCombination:
158157
criteria = [goal.to_criterion() for goal in self.goals]
159158
if action is not None:
160159
criteria.append(action)
161-
return LogicalCriterionCombination.And(
162-
*criteria, category=CohortCategory.INTERVENTION
163-
)
160+
return LogicalCriterionCombination.And(*criteria)
164161
else:
165162
return action # type: ignore
166163

execution_engine/converter/action/assessment.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from typing import Self, Type
22

3-
from execution_engine.constants import CohortCategory
43
from execution_engine.converter.action.abstract import AbstractAction
54
from execution_engine.converter.criterion import parse_code
65
from execution_engine.fhir.recommendation import RecommendationPlan
@@ -79,7 +78,6 @@ def _to_criterion(self) -> Criterion | LogicalCriterionCombination | None:
7978
)
8079

8180
criterion = cls(
82-
category=CohortCategory.INTERVENTION,
8381
concept=self._code,
8482
timing=self._timing,
8583
)

execution_engine/converter/action/body_positioning.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from typing import Self
22

3-
from execution_engine.constants import CohortCategory
43
from execution_engine.converter.action.abstract import AbstractAction
54
from execution_engine.converter.criterion import parse_code
65
from execution_engine.fhir.recommendation import RecommendationPlan
@@ -53,7 +52,6 @@ def _to_criterion(self) -> Criterion | LogicalCriterionCombination | None:
5352
"""Converts this characteristic to a Criterion."""
5453

5554
return ProcedureOccurrence(
56-
category=CohortCategory.INTERVENTION,
5755
concept=self._code,
5856
timing=self._timing,
5957
)

execution_engine/converter/action/drug_administration.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from fhir.resources.dosage import Dosage as FHIRDosage
77

88
from execution_engine.clients import omopdb
9-
from execution_engine.constants import EXT_DOSAGE_CONDITION, CohortCategory
9+
from execution_engine.constants import EXT_DOSAGE_CONDITION
1010
from execution_engine.converter.action.abstract import AbstractAction
1111
from execution_engine.converter.criterion import (
1212
get_extension_by_url,
@@ -285,15 +285,13 @@ def _to_criterion(self) -> Criterion | LogicalCriterionCombination | None:
285285
if not self._dosages:
286286
# no dosages, just return the drug exposure
287287
return DrugExposure(
288-
category=CohortCategory.INTERVENTION,
289288
ingredient_concept=self._ingredient_concept,
290289
dose=None,
291290
route=None,
292291
)
293292

294293
for dosage in self._dosages:
295294
drug_action = DrugExposure(
296-
category=CohortCategory.INTERVENTION,
297295
ingredient_concept=self._ingredient_concept,
298296
dose=dosage["dose"],
299297
route=dosage.get("route", None),
@@ -316,7 +314,6 @@ def _to_criterion(self) -> Criterion | LogicalCriterionCombination | None:
316314
)
317315

318316
ext_criterion = PointInTimeCriterion(
319-
category=CohortCategory.INTERVENTION,
320317
concept=extension["code"],
321318
value=extension["value"],
322319
)
@@ -326,7 +323,6 @@ def _to_criterion(self) -> Criterion | LogicalCriterionCombination | None:
326323
# Thus, the actual drug administration (drug_action, "right") must only be fulfilled if the
327324
# condition (ext_criterion, "left") is fulfilled. Thus, we here add this conditional filter.
328325
comb = NonCommutativeLogicalCriterionCombination.ConditionalFilter(
329-
category=CohortCategory.INTERVENTION,
330326
left=ext_criterion,
331327
right=drug_action,
332328
)
@@ -338,7 +334,6 @@ def _to_criterion(self) -> Criterion | LogicalCriterionCombination | None:
338334
result = drug_actions[0]
339335
else:
340336
result = LogicalCriterionCombination(
341-
category=CohortCategory.INTERVENTION,
342337
operator=LogicalCriterionCombination.Operator("OR"),
343338
)
344339
result.add_all(drug_actions)

execution_engine/converter/characteristic/codeable_concept.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from fhir.resources.evidencevariable import EvidenceVariableCharacteristic
55

6-
from execution_engine.constants import CohortCategory
76
from execution_engine.converter.characteristic.abstract import AbstractCharacteristic
87
from execution_engine.fhir.util import get_coding
98
from execution_engine.omop.concepts import Concept
@@ -82,7 +81,6 @@ def from_fhir(
8281
def to_positive_criterion(self) -> Criterion:
8382
"""Converts this characteristic to a Criterion."""
8483
return self._criterion_class(
85-
category=CohortCategory.POPULATION,
8684
concept=self.value,
8785
value=None,
8886
static=self._concept_value_static,

execution_engine/converter/characteristic/value.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from fhir.resources.evidencevariable import EvidenceVariableCharacteristic
55

6-
from execution_engine.constants import CohortCategory
76
from execution_engine.converter.characteristic.abstract import AbstractCharacteristic
87
from execution_engine.converter.criterion import parse_code, parse_value
98
from execution_engine.omop.criterion.concept import ConceptCriterion
@@ -36,7 +35,6 @@ def from_fhir(
3635
def to_positive_criterion(self) -> ConceptCriterion:
3736
"""Converts this characteristic to a Criterion."""
3837
return self._criterion_class(
39-
category=CohortCategory.POPULATION,
4038
concept=self.type,
4139
value=self.value,
4240
static=self._concept_value_static,

execution_engine/converter/criterion.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,7 @@ def to_criterion(self) -> Criterion | LogicalCriterionCombination:
154154
"""
155155
positive_criterion = self.to_positive_criterion()
156156
if self._exclude:
157-
return LogicalCriterionCombination.Not(
158-
positive_criterion, positive_criterion.category
159-
)
157+
return LogicalCriterionCombination.Not(positive_criterion)
160158
else:
161159
return positive_criterion
162160

execution_engine/converter/goal/assessment_scale.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from fhir.resources.plandefinition import PlanDefinitionGoal
22

3-
from execution_engine.constants import SCT_ASSESSMENT_SCALE, CohortCategory
3+
from execution_engine.constants import SCT_ASSESSMENT_SCALE
44
from execution_engine.converter.criterion import parse_code_value
55
from execution_engine.converter.goal.abstract import Goal
66
from execution_engine.omop.concepts import Concept
@@ -52,7 +52,6 @@ def to_positive_criterion(self) -> Criterion:
5252
Converts the goal to a criterion.
5353
"""
5454
return Measurement(
55-
category=CohortCategory.INTERVENTION,
5655
concept=self._code,
5756
value=self._value,
5857
)

execution_engine/converter/goal/laboratory_value.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from fhir.resources.plandefinition import PlanDefinitionGoal
22

3-
from execution_engine.constants import SCT_LAB_FINDINGS_SURVEILLANCE, CohortCategory
3+
from execution_engine.constants import SCT_LAB_FINDINGS_SURVEILLANCE
44
from execution_engine.converter.criterion import parse_code_value
55
from execution_engine.converter.goal.abstract import Goal
66
from execution_engine.omop.concepts import Concept
@@ -51,7 +51,6 @@ def to_positive_criterion(self) -> Criterion:
5151
Converts the goal to a criterion.
5252
"""
5353
return Measurement(
54-
category=CohortCategory.INTERVENTION,
5554
concept=self._code,
5655
value=self._value,
5756
)

0 commit comments

Comments
 (0)