Skip to content

Commit 9ba1c04

Browse files
Added a new class and a TODO note
1 parent 313f58f commit 9ba1c04

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

classes/episode_type.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
from enum import Enum
2+
from typing import Optional, Dict
3+
4+
5+
class EpisodeType(Enum):
6+
FOBT = (11350, "FOBT")
7+
Fobt = (11350, "FOBT Screening")
8+
BowelScope = (200640, "Bowel Scope")
9+
Surveillance = (11351, "Surveillance")
10+
LYNCH_SURVEILLANCE = (305633, "Lynch Surveillance")
11+
Lynch = (305633, "Lynch")
12+
13+
def __init__(self, valid_value_id, description):
14+
self._valid_value_id = valid_value_id
15+
self._description = description
16+
17+
@property
18+
def valid_value_id(self) -> int:
19+
return self._valid_value_id
20+
21+
@property
22+
def description(self) -> str:
23+
return self._description
24+
25+
@classmethod
26+
def by_description(cls, description: str) -> Optional["EpisodeType"]:
27+
for member in cls:
28+
if member.description == description:
29+
return member
30+
return None
31+
32+
@classmethod
33+
def by_description_case_insensitive(
34+
cls, description: str
35+
) -> Optional["EpisodeType"]:
36+
for member in cls:
37+
if member.description.lower() == description.lower():
38+
return member
39+
return None
40+
41+
@classmethod
42+
def by_valid_value_id(cls, valid_value_id: int) -> Optional["EpisodeType"]:
43+
for member in cls:
44+
if member.valid_value_id == valid_value_id:
45+
return member
46+
return None

utils/oracle/subject_selection_query_builder.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from classes.clinical_cease_reason_type import ClinicalCeaseReasonType
1010
from classes.date_description import DateDescription
1111
from classes.event_status_type import EventStatusType
12+
from classes.episode_type import EpisodeType
1213
from classes.has_gp_practice import HasGPPractice
1314
from classes.has_unprocessed_sspi_updates import HasUnprocessedSSPIUpdates
1415
from classes.has_user_dob_update import HasUserDobUpdate
@@ -267,6 +268,7 @@ def _add_variable_selection_criteria(
267268
self._add_criteria_has_unprocessed_sspi_updates()
268269
case SubjectSelectionCriteriaKey.SUBJECT_HAS_USER_DOB_UPDATES:
269270
self._add_criteria_has_user_dob_update()
271+
# TODO: Add more case statemented here, copying the Java code
270272

271273
except Exception:
272274
raise SelectionBuilderException(

0 commit comments

Comments
 (0)