Skip to content

Conversation

@jim-smith
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 99.75%. Comparing base (b132be7) to head (ae12c7b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
acro/acro_tables.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #309      +/-   ##
==========================================
+ Coverage   99.11%   99.75%   +0.64%     
==========================================
  Files           9        9              
  Lines        1237     1244       +7     
==========================================
+ Hits         1226     1241      +15     
+ Misses         11        3       -8     

☔ 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.

@jim-smith jim-smith requested a review from rpreen January 13, 2026 18:38
@jim-smith
Copy link
Contributor Author

need this because old-style interactive finalise() doesn't;t play nice with Stata and won't work when sent as workflow job in container for federated analytics.

@jim-smith
Copy link
Contributor Author

Also adds exception when suppress=True, implementing the proposed solution to issue #254

@jim-smith jim-smith requested a review from JessUWE January 13, 2026 19:20
@jim-smith
Copy link
Contributor Author

Addresses #297

Copy link
Collaborator

@rpreen rpreen left a comment

Choose a reason for hiding this comment

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

Minor suggested clean up.

)
if self.suppress:
justadded = f"output_{self.results.output_id - 1}"
self.results.add_exception(
Copy link
Collaborator

Choose a reason for hiding this comment

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

That this is duplicated in another function (lines 407--411) makes me wonder if this should be refactored or placed elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, but this is part of a wider refactor we will have to do when we introduce rounding and make the code output meta statements in the omntology about what happened

@rpreen rpreen changed the title Make finalise noninterctice bydefault feat: make finalise non-interactive by default Jan 13, 2026
jim-smith and others added 2 commits January 14, 2026 12:13
Co-authored-by: Richard Preen <[email protected]>
Signed-off-by: Jim-smith <[email protected]>
@jim-smith
Copy link
Contributor Author

There's one missing line in create_dataframe that has never been covered and I can't work out how to cover.

try:
        if isinstance(index, list):
            index_df = pd.concat(index, axis=1)
        elif isinstance(index, pd.Series):
            index_df = pd.DataFrame({index.name: index})
    except (ValueError, TypeError):
        index_df = empty_dataframe

    columns_df = empty_dataframe
    try:
        if isinstance(columns, list):
            columns_df = pd.concat(columns, axis=1)
        elif isinstance(columns, pd.Series):
            columns_df = pd.DataFrame({columns.name: columns})
    except (ValueError, TypeError):
        columns_df = empty_dataframe

    try:
        data = pd.concat([index_df, columns_df], axis=1)
    except (ValueError, TypeError):
        data = empty_dataframe

Not sure if we should remove the try..except around the final concat as whatever gets fed into it by the two clauses above should be valid operands to pd.concat()

@rpreen
Copy link
Collaborator

rpreen commented Jan 14, 2026

Why does create_dataframe() silently return an empty DataFrame if there is an exception? It would be better for debugging to raise it?

I think it could also be refactored to something like this:

def create_dataframe(index, columns) -> DataFrame:
    """Combine the index and columns in a dataframe and return the dataframe.

    Parameters
    ----------
    index : array-like, Series, or list of arrays/Series
        Values to group by in the rows.
    columns : array-like, Series, or list of arrays/Series
        Values to group by in the columns.

    Returns
    -------
    DataFrame
        Table of the index and columns combined.
    """

    def to_df(obj) -> DataFrame:
        """Convert an object to DataFrame."""
        if isinstance(obj, Series):
            return pd.DataFrame({obj.name: obj})
        if isinstance(obj, list):
            return pd.concat(obj, axis=1)
        return pd.DataFrame()

    index_df = to_df(index)
    columns_df = to_df(columns)

    return pd.concat([index_df, columns_df], axis=1)

[Edit] I'm not sure the docstrings are exactly correct for this (but I left it as it was.)

@jim-smith
Copy link
Contributor Author

Why does create_dataframe() silently return an empty DataFrame if there is an exception? It would be better for debugging to raise it?

Not sure: it's not my code, and is only used in one place (cross tab_with_totals), to create a table that queries run on - I think.
There's a separate issues that queries don't work if variables names have gaps in

  • we need to spot this and surround those strings-with-spaces by single quotes'
  • so I propose to deal with this issue then

@rpreen rpreen merged commit 0362ad4 into main Jan 14, 2026
4 of 5 checks passed
@rpreen rpreen deleted the make-finalise-noninterctice-bydefault branch January 14, 2026 20:31
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