@@ -14,25 +14,21 @@ def __init__(self, lynch_due_date_change_reason_id):
1414 self .lynch_due_date_change_reason_id = lynch_due_date_change_reason_id
1515
1616
17- class LynchIncidentEpisodeType :
17+ class PrevalentIncidentStatusType :
1818 """
19- Maps symbolic criteria values for Lynch incident episode linkage .
19+ Maps symbolic values for FOBT prevalent/ incident episode classification .
2020 """
2121
22- NULL = "null"
23- NOT_NULL = "not_null"
24- LATEST_EPISODE = "latest_episode"
25- EARLIER_EPISODE = "earlier_episode"
22+ PREVALENT = "prevalent"
23+ INCIDENT = "incident"
2624
27- _symbolics = {NULL , NOT_NULL , LATEST_EPISODE , EARLIER_EPISODE }
25+ _valid_values = {PREVALENT , INCIDENT }
2826
2927 @classmethod
3028 def from_description (cls , description : str ) -> str :
3129 key = description .strip ().lower ()
32- if key not in cls ._symbolics :
33- raise ValueError (
34- f"Unknown Lynch incident episode criteria: '{ description } '"
35- )
30+ if key not in cls ._valid_values :
31+ raise ValueError (f"Unknown FOBT episode status: '{ description } '" )
3632 return key
3733
3834
@@ -106,26 +102,18 @@ def _add_join_to_surveillance_review(self):
106102 # Replace this with the one you want to test,
107103 # then use utils/oracle/test_subject_criteria_dev.py to run your scenarios
108104
109- def _add_criteria_lynch_incident_episode (self ) -> None :
105+ def _add_criteria_fobt_prevalent_incident_status (self ) -> None :
110106 """
111- Filters based on linkage to a Lynch incident episode .
107+ Filters subjects by whether their FOBT episode is prevalent or incident .
112108 """
113109 try :
114- self ._add_join_to_latest_episode ()
115- column = "ss.lynch_incident_subject_epis_id"
116- value = LynchIncidentEpisodeType .from_description (self .criteria_value )
110+ value = PrevalentIncidentStatusType .from_description (self .criteria_value )
111+ column = "ss.fobt_incident_subject_epis_id"
117112
118- if value == LynchIncidentEpisodeType . NULL :
113+ if value == PrevalentIncidentStatusType . PREVALENT :
119114 self .sql_where .append (f"AND { column } IS NULL" )
120-
121- elif value == LynchIncidentEpisodeType .NOT_NULL :
115+ elif value == PrevalentIncidentStatusType .INCIDENT :
122116 self .sql_where .append (f"AND { column } IS NOT NULL" )
123117
124- elif value == LynchIncidentEpisodeType .LATEST_EPISODE :
125- self .sql_where .append (f"AND { column } = ep.subject_epis_id" )
126-
127- elif value == LynchIncidentEpisodeType .EARLIER_EPISODE :
128- self .sql_where .append (f"AND { column } < ep.subject_epis_id" )
129-
130118 except Exception :
131119 raise SelectionBuilderException (self .criteria_key_name , self .criteria_value )
0 commit comments