Skip to content

Conversation

@Karthikeyannhs
Copy link
Contributor

@Karthikeyannhs Karthikeyannhs commented May 29, 2025

Description

Context

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.

@Karthikeyannhs Karthikeyannhs marked this pull request as ready for review May 29, 2025 12:10
StartDate = NewType("StartDate", date)
EndDate = NewType("EndDate", date)
CohortLabel = NewType("CohortLabel", str)
RuleStop = NewType("RuleStop", str)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this should be an Enum?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or even a bool with @field_validator and @field_serializer decorators?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think a bool would be better.

Copy link
Contributor Author

@Karthikeyannhs Karthikeyannhs May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@acerathereinspirative-nhs-nvir thanks, we just implemented the enum.

Enum looks better in terms of handling when rule_stop is "" or None situations. Also less code than the bool setup

class RuleStop(StrEnum):
YES = "Y"
NO = "N"

@classmethod
def _missing_(cls, value: object) -> RuleStop | None:
    if isinstance(value, str) and value == "":
        return cls.NO
    return None

kindy, is this ok ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't None equivalent to False? Can't we default to False if the value isn't "Y"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

It's still an Enum. I think a bool would better fit the domain and behaviour.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, we will implement it.

might include a integration test as well because the build factory is intelligent and seems to be setting "Y" as true by itself, without going through the "@field_validator"

and (ir.cohort_label is None or (ir.cohort_label in self.person_cohorts))
]
exclude_capable_rules = list(
takewhile(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice use of itertools. :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately i implemented it wrongly. We are pushing the fix :)

@Karthikeyannhs Karthikeyannhs marked this pull request as draft May 29, 2025 12:48
@Karthikeyannhs Karthikeyannhs marked this pull request as ready for review May 29, 2025 14:11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now.

iterations=[
rule.IterationFactory.build(
iteration_rules=[rule.PersonAgeSuppressionRuleFactory.build()],
iteration_rules=[

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh, hang on - why are we setting all this in the conftest.py? Do we need these values for all tests?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we discuss?

Copy link
Contributor Author

@Karthikeyannhs Karthikeyannhs May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry , the code was not complete(need modifications). we have to parameterise, so will not be editing the conftest however. Should have added TODO. also making it to draft until its complete

iterations=[
rule.IterationFactory.build(
iteration_rules=[rule.PersonAgeSuppressionRuleFactory.build()],
iteration_rules=[

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we discuss?

@Karthikeyannhs Karthikeyannhs marked this pull request as draft May 29, 2025 15:54
@Karthikeyannhs Karthikeyannhs force-pushed the feature/eli-221-add-rule-stop-functionality branch from f07ddc9 to 1dbf91a Compare May 29, 2025 20:12
@Karthikeyannhs Karthikeyannhs force-pushed the feature/eli-221-add-rule-stop-functionality branch from 13357ad to 27a3ce0 Compare May 29, 2025 20:47
@Karthikeyannhs Karthikeyannhs marked this pull request as ready for review May 29, 2025 22:05
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy now the conftest is back as it was.

@Karthikeyannhs Karthikeyannhs merged commit a99c00d into main May 30, 2025
24 checks passed
@Karthikeyannhs Karthikeyannhs deleted the feature/eli-221-add-rule-stop-functionality branch May 30, 2025 15:35
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.

2 participants