Skip to content

Allow is_valid to be called on unfit constraints #2578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 24, 2025

Conversation

frances-h
Copy link
Contributor

CU-86b586xqm

Adds metadata as an optional parameter to is_valid (and a required parameter to the constraint method _is_valid) so that the method can be called on an unfit constraint when running DayZ.

@sdv-team
Copy link
Contributor

@frances-h frances-h changed the title Allow is_valid to be called on unfit constraints Allow is_valid to be called on unfit constraints Jun 13, 2025
Copy link

codecov bot commented Jun 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.14%. Comparing base (f91a928) to head (441d115).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2578      +/-   ##
==========================================
- Coverage   98.14%   98.14%   -0.01%     
==========================================
  Files          70       70              
  Lines        7212     7210       -2     
==========================================
- Hits         7078     7076       -2     
  Misses        134      134              
Flag Coverage Δ
integration 76.14% <96.96%> (+0.06%) ⬆️
unit 96.89% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@frances-h frances-h force-pushed the enterprise-issue-1376-DayZ-constraints branch from 5419bac to 0f69f2c Compare June 17, 2025 22:31
@frances-h frances-h marked this pull request as ready for review June 23, 2025 15:42
@frances-h frances-h requested a review from a team as a code owner June 23, 2025 15:42
@frances-h frances-h requested review from amontanez24 and removed request for a team June 23, 2025 15:42
@frances-h frances-h force-pushed the enterprise-issue-1376-DayZ-constraints branch from ae7076c to 5e2f85e Compare June 23, 2025 15:42
@frances-h frances-h requested a review from R-Palazzo June 23, 2025 15:42
Copy link
Contributor

@amontanez24 amontanez24 left a comment

Choose a reason for hiding this comment

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

One suggestion but looks good!

Copy link
Contributor

@R-Palazzo R-Palazzo left a comment

Choose a reason for hiding this comment

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

Looks good!


is_valid = self.programmable_constraint.is_valid(data)

if self._is_single_table:
return {self._table_name: is_valid}
return {table_name: is_valid}
Copy link
Contributor

Choose a reason for hiding this comment

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

Here, should we update the if condition to be the same as in the base cag class:
if isinstance(data, pd.DataFrame) or self._single_table:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this is a different check - the _is_single_table attribute on the harness controls whether we expect a single dataframe or a dataframe dict from the programmable constraint (based on whether it's a SingleTableProgrammableConstraint or a ProgrammableConstraint).

@@ -99,6 +99,7 @@ def __init__(self, column_names, table_name):
self.table_name = table_name
self._joint_column = '#'.join(self.column_names)
self._combinations = None
self._fitted = False
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need it so we can use the FixedCombinations methods on this class. The _is_valid method for FixedCombinations now checks whether or not the constraint has been fit, so we need it set on this class for the method to actually work without erroring.

@frances-h frances-h force-pushed the enterprise-issue-1376-DayZ-constraints branch from 44908a6 to 441d115 Compare June 24, 2025 15:12
@frances-h frances-h merged commit cef58d1 into main Jun 24, 2025
45 checks passed
@frances-h frances-h deleted the enterprise-issue-1376-DayZ-constraints branch June 24, 2025 17:06
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.

4 participants