Skip to content

Add status_text override logic to EligibilityCalculator#643

Open
shivani-rana-kainos wants to merge 2 commits intomainfrom
feature/SR-ELI-784-Calculator-Integration
Open

Add status_text override logic to EligibilityCalculator#643
shivani-rana-kainos wants to merge 2 commits intomainfrom
feature/SR-ELI-784-Calculator-Integration

Conversation

@shivani-rana-kainos
Copy link
Copy Markdown
Collaborator

@shivani-rana-kainos shivani-rana-kainos commented Apr 16, 2026

Description

Add status_text override logic to EligibilityCalculator

Context

To add status_text override logic to EligibilityCalculator

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming

Sensitive Information Declaration

To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

@shivani-rana-kainos shivani-rana-kainos requested a review from a team as a code owner April 16, 2026 07:44
@eddalmond1
Copy link
Copy Markdown
Collaborator

I think we want a few tests (in tests/unit/services/calculators/test_eligibility_calculator.py) to cover the change, and I suggest we also create a couple of 'action builders' for a normal action and an override e.g.

def _build_status_text_override_action(description: str) -> AvailableAction:
    return AvailableAction(
        ActionType=STATUS_TEXT_OVERRIDE_ACTION_TYPE,
        ExternalRoutingCode="STATUS_TEXT_OVERRIDE",
        ActionDescription=description,
    )

which could be used within rule_builder.CampaignConfigFactory.build(.... actions_mapper) e.g. (modified from related test - test_status_text_is_used_from_campaign_when_available_for_all_statuses )

    person_rows = person_rows_builder(...)

    campaign_configs = [
        rule_builder.CampaignConfigFactory.build(
            target="RSV",
            iterations=[
                rule_builder.IterationFactory.build(
                    default_comms_routing="DEFAULT_ACTION",
                    default_not_actionable_routing="DEFAULT_ACTION",
                    default_not_eligible_routing="DEFAULT_ACTION",
                    iteration_cohorts=[rule_builder.IterationCohortFactory.build(cohort_label="cohort1")],
                    iteration_rules=[
                        rule_builder.PersonAgeSuppressionRuleFactory.build(),
                        rule_builder.ICBNonActionableActionRuleFactory.build(comms_routing="STATUS_OVERRIDE_ACTION"),
                    ],
                    actions_mapper=rule_builder.ActionsMapperFactory.build(
                        root={
                            "DEFAULT_ACTION": **_build_regular_available_action**(),
                            "STATUS_OVERRIDE_ACTION": **_build_status_text_override_action**(
                                "Override not actionable status text"
                            ),
                        }
                    ),
                    status_text=campaign_config.StatusText(
                        NotEligible="Campaign not eligible status text",
                        NotActionable="Campaign not actionable status text",
                        Actionable="Campaign actionable status text",
                    ),
                )
            ],
        )
    ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants