Skip to content

Commit 2591a12

Browse files
committed
eli-579 adding support for COHORT data being used with ADD_DAYS
1 parent 67af227 commit 2591a12

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/eligibility_signposting_api/services/processors/derived_values/add_days_handler.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def calculate(self, context: DerivedValueContext) -> str:
9696
def _find_source_date(self, context: DerivedValueContext) -> str | None:
9797
"""Find the source date value from person data.
9898
99-
For PERSON-level attributes, looks for ATTRIBUTE_TYPE == "PERSON".
99+
For PERSON/COHORT-level attributes, looks for ATTRIBUTE_TYPE == attribute_level.
100100
For TARGET-level attributes, looks for ATTRIBUTE_TYPE == context.attribute_name (e.g., "COVID").
101101
102102
Args:
@@ -109,7 +109,10 @@ def _find_source_date(self, context: DerivedValueContext) -> str | None:
109109
if not source_attr:
110110
return None
111111

112-
attribute_type_to_match = "PERSON" if context.attribute_level == "PERSON" else context.attribute_name
112+
if context.attribute_level in ("PERSON", "COHORT"):
113+
attribute_type_to_match = context.attribute_level
114+
else:
115+
attribute_type_to_match = context.attribute_name
113116

114117
for attribute in context.person_data:
115118
if attribute.get("ATTRIBUTE_TYPE") == attribute_type_to_match:

0 commit comments

Comments
 (0)