Skip to content

Fixed published open rules for usdm#1759

Merged
gerrycampion merged 11 commits into
mainfrom
1758-fix-published-open-rules-for-usdm
Jun 18, 2026
Merged

Fixed published open rules for usdm#1759
gerrycampion merged 11 commits into
mainfrom
1758-fix-published-open-rules-for-usdm

Conversation

@gerrycampion

@gerrycampion gerrycampion commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Fixes the tasks detailed in the attached issue

@gerrycampion gerrycampion linked an issue Jun 8, 2026 that may be closed by this pull request
3 tasks
@gerrycampion gerrycampion changed the title usdm running now Fixed published open rules for usdm Jun 9, 2026
@gerrycampion gerrycampion marked this pull request as ready for review June 10, 2026 19:12
Comment thread cdisc_rules_engine/services/csv_metadata_reader.py
Comment thread cdisc_rules_engine/services/csv_metadata_reader.py
var: (int(length) if pd.notna(length) else None)
var: (
int(length)
if pd.notna(length) and (isinstance(length, int) or length.isdigit())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If a column has a missing/blank value in csv, it can cause pandas to read the whole column as float instead of int. So for row where value is present the check of length.isdigit() will cause error because floats don't have isdigit()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

why would it read the whole column as float?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Here on pandas documentation it states it: link

Comment thread tests/unit/test_csv_reader.py Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The value in the fixture now is changed to be 'patients' from 'patients.csv'. This line here still replaces the value 'patients.csv' with its upper case version, which will basically update nothing. This defeats the test purpose judging by its name.

@SFJohnson24 SFJohnson24 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lowercase.json
uppercase.json

See comment -- there is a discrepency in issues produced with standard name when capitalized vs lowercase. When I add a lower() call to the standard, it reverts back to the lowercase 3 issues.

)
df = reader.from_file(full_path)
# Build a simulated json pointer for the case where we are simulating json data.
if self.standard == "usdm":

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this and the excel data service using string literals for usdm are a bit fragile-- I ran a validation using USDM in capitals versus usdm in lowercase and got different results for the same data.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This was actually a bug with the recently-added caching. I've resolved the bug and you should now see consistent results. Let me know if you still have other concerns about the capitalization.

@gerrycampion

gerrycampion commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

lowercase.json uppercase.json

See comment -- there is a discrepency in issues produced with standard name when capitalized vs lowercase. When I add a lower() call to the standard, it reverts back to the lowercase 3 issues.

@SFJohnson24 These files aren't accessible. Can you reattach as .txt files?

@SFJohnson24 SFJohnson24 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This PR correctly resolves the issues in the attached task. It also resolves the differences in report with the same data but different capitalization

@gerrycampion gerrycampion merged commit 0420158 into main Jun 18, 2026
13 of 14 checks passed
@gerrycampion gerrycampion deleted the 1758-fix-published-open-rules-for-usdm branch June 18, 2026 18:58
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.

Fix Published Open Rules for USDM

3 participants