@@ -166,16 +166,16 @@ def test_missing_patient_vaccine_data_on_target_attribute_should_replace_with_em
166166
167167 assert actual .condition_name == "Last successful date: "
168168
169- def test_non_rsv_target_token_should_raise_error (self ):
169+ def test_not_allowed_target_conditions_token_should_raise_error (self ):
170170 person = Person (
171171 [
172172 {"ATTRIBUTE_TYPE" : "PERSON" , "AGE" : "30" },
173- {"ATTRIBUTE_TYPE" : "COVID " , "CONDITION_NAME" : "COVID" , "LAST_SUCCESSFUL_DATE" : "20250101" },
173+ {"ATTRIBUTE_TYPE" : "YELLOW_FEVER " , "CONDITION_NAME" : "COVID" , "LAST_SUCCESSFUL_DATE" : "20250101" },
174174 ]
175175 )
176176
177177 condition = Condition (
178- condition_name = ConditionName ("Last successful date: [[TARGET.COVID .LAST_SUCCESSFUL_DATE]]" ),
178+ condition_name = ConditionName ("Last successful date: [[TARGET.YELLOW_FEVER .LAST_SUCCESSFUL_DATE]]" ),
179179 status = Status .actionable ,
180180 status_text = StatusText ("Some status" ),
181181 cohort_results = [],
@@ -184,7 +184,7 @@ def test_non_rsv_target_token_should_raise_error(self):
184184 )
185185
186186 expected_error = re .escape (
187- "Invalid attribute name 'LAST_SUCCESSFUL_DATE' in token '[[TARGET.COVID .LAST_SUCCESSFUL_DATE]]'."
187+ "Invalid attribute name 'LAST_SUCCESSFUL_DATE' in token '[[TARGET.YELLOW_FEVER .LAST_SUCCESSFUL_DATE]]'."
188188 )
189189 with pytest .raises (ValueError , match = expected_error ):
190190 TokenProcessor .find_and_replace_tokens (person , condition )
@@ -266,7 +266,7 @@ def test_valid_token_valid_format_should_replace_with_date_formatting(self):
266266
267267 condition = Condition (
268268 condition_name = ConditionName (
269- "You had your RSV vaccine on [[TARGET.RSV .LAST_SUCCESSFUL_DATE:DATE(%d %B %Y)]]"
269+ "You had your COVID vaccine on [[TARGET.COVID .LAST_SUCCESSFUL_DATE:DATE(%d %B %Y)]]"
270270 ),
271271 status = Status .actionable ,
272272 status_text = StatusText ("Your birthday is on [[PERSON.DATE_OF_BIRTH:DATE(%-d %B %Y)]]" ),
@@ -276,7 +276,7 @@ def test_valid_token_valid_format_should_replace_with_date_formatting(self):
276276 )
277277
278278 expected = Condition (
279- condition_name = ConditionName ("You had your RSV vaccine on 01 January 2025" ),
279+ condition_name = ConditionName ("You had your COVID vaccine on 01 January 2025" ),
280280 status = Status .actionable ,
281281 status_text = StatusText ("Your birthday is on 27 March 1990" ),
282282 cohort_results = [],
@@ -334,12 +334,12 @@ def test_valid_token_invalid_format_should_raise_error(self, token_format: str):
334334 def test_valid_date_format (self , token_format : str , expected : str ):
335335 person = Person (
336336 [
337- {"ATTRIBUTE_TYPE" : "RSV " , "CONDITION_NAME" : "RSV " , "LAST_SUCCESSFUL_DATE" : "19900327" },
337+ {"ATTRIBUTE_TYPE" : "MMR " , "CONDITION_NAME" : "MMR " , "LAST_SUCCESSFUL_DATE" : "19900327" },
338338 ]
339339 )
340340
341341 condition = Condition (
342- condition_name = ConditionName (f"Date: [[TARGET.RSV .LAST_SUCCESSFUL_DATE{ token_format } ]]" ),
342+ condition_name = ConditionName (f"Date: [[TARGET.MMR .LAST_SUCCESSFUL_DATE{ token_format } ]]" ),
343343 status = Status .actionable ,
344344 status_text = StatusText ("Some text" ),
345345 cohort_results = [],
@@ -358,22 +358,22 @@ def test_valid_date_format(self, token_format: str, expected: str):
358358 ("[[PERSON.date_of_birth:DATE(%d %B %Y)]]" , "27 March 1990" ),
359359 ("[[PERSON.DATE_OF_BIRTH:date(%d %B %Y)]]" , "27 March 1990" ),
360360 ("[[pErSoN.DATE_OF_BIRTH:DATE(%d %B %Y)]]" , "27 March 1990" ),
361- ("[[target.RSV .LAST_SUCCESSFUL_DATE:DATE(%-d %B %Y)]]" , "1 January 2025" ),
362- ("[[TARGET.rsv .LAST_SUCCESSFUL_DATE:DATE(%-d %B %Y)]]" , "1 January 2025" ),
363- ("[[TARGET.RSV .last_successful_date:DATE(%-d %B %Y)]]" , "1 January 2025" ),
364- ("[[TARGET.RSV .last_successful_date:date(%-d %B %Y)]]" , "1 January 2025" ),
361+ ("[[target.FLU .LAST_SUCCESSFUL_DATE:DATE(%-d %B %Y)]]" , "1 January 2025" ),
362+ ("[[TARGET.FLU .LAST_SUCCESSFUL_DATE:DATE(%-d %B %Y)]]" , "1 January 2025" ),
363+ ("[[TARGET.FLU .last_successful_date:DATE(%-d %B %Y)]]" , "1 January 2025" ),
364+ ("[[TARGET.FLU .last_successful_date:date(%-d %B %Y)]]" , "1 January 2025" ),
365365 ],
366366 )
367367 def test_token_replace_is_case_insensitive (self , token : str , expected : str ):
368368 person = Person (
369369 [
370370 {"ATTRIBUTE_TYPE" : "PERSON" , "AGE" : "30" , "DATE_OF_BIRTH" : "19900327" },
371- {"ATTRIBUTE_TYPE" : "RSV " , "CONDITION_NAME" : "RSV " , "LAST_SUCCESSFUL_DATE" : "20250101" },
371+ {"ATTRIBUTE_TYPE" : "FLU " , "CONDITION_NAME" : "FLU " , "LAST_SUCCESSFUL_DATE" : "20250101" },
372372 ]
373373 )
374374
375375 condition = Condition (
376- condition_name = ConditionName (f"RSV vaccine on: { token } ." ),
376+ condition_name = ConditionName (f"FLU vaccine on: { token } ." ),
377377 status = Status .actionable ,
378378 status_text = StatusText (f"Your DOB is: { token } ." ),
379379 cohort_results = [],
@@ -384,4 +384,4 @@ def test_token_replace_is_case_insensitive(self, token: str, expected: str):
384384 result = TokenProcessor .find_and_replace_tokens (person , condition )
385385
386386 assert result .status_text == f"Your DOB is: { expected } ."
387- assert result .condition_name == f"RSV vaccine on: { expected } ."
387+ assert result .condition_name == f"FLU vaccine on: { expected } ."
0 commit comments