Make uei_count optional - #434
Conversation
ptajvar
left a comment
There was a problem hiding this comment.
Thank you for the fix Johan!
Release 0.30.0
- Only select the uei column when it is present so sample calling works also without it. - Make uei_count optional in graph component recovery. Treat missing uei_count as 0 for molecule stats and working edgelists so the graph step accepts the new edgelist format. Co-authored-by: Cursor <cursoragent@cursor.com>
66dd1ac to
51eaa3e
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 51eaa3e. Configure here.
|
|
||
| def n_molecules_sql(has_uei_count: bool) -> str: | ||
| """SQL expression for molecule count; defaults to 0 when ``uei_count`` is absent.""" | ||
| return "SUM(uei_count)" if has_uei_count else "0" |
There was a problem hiding this comment.
Non-aggregate molecule SQL fallback
Medium Severity
The n_molecules_sql helper returns a non-aggregate 0 when uei_count is missing. In component_recovery, using this directly in SELECT can cause an index error for empty edgelists or yield a column of zeros instead of a single total. get_count_statistics correctly embeds it within an aggregate query.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 51eaa3e. Configure here.
|
I will close this and open a new one, since for some reason I can't get GH to rebase this properly. |


Description
Make
uei_countoptional.Fixes: pna-3264
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce it when relevant.
PR checklist:
pyproject.tomland cited it properlyNote
Medium Risk
Touches graph statistics and sample-calling SQL paths; absent
uei_countwill report zero molecules, which could mislead downstream metrics if callers expect real molecule counts.Overview
uei_countis now optional on PNA edgelists in sample calling and the graph component recovery path, so pipelines can run when that column is missing.Shared helpers
has_uei_countandn_molecules_sqldetect the column via DuckDBDESCRIBEand either sum molecules or treat counts as 0. Graph recovery uses this for molecule totals and forcreate_working_edgelist(syntheticuei_count = 0when absent). Sample calling omitsuei_countfrom exported edgelists when it was not on the input.CHANGELOG documents the behavior. Tests cover stats, working edgelist shaping, and end-to-end sample calling without
uei_count.Reviewed by Cursor Bugbot for commit 51eaa3e. Bugbot is set up for automated code reviews on this repo. Configure here.