Skip to content

Logging rollcall#67

Draft
codedbyishika wants to merge 6 commits into
refactoring_validationfrom
logging_rollcall
Draft

Logging rollcall#67
codedbyishika wants to merge 6 commits into
refactoring_validationfrom
logging_rollcall

Conversation

@codedbyishika

@codedbyishika codedbyishika commented Jun 22, 2026

Copy link
Copy Markdown

Integrate logging functionality into the RollCall module.

@codedbyishika codedbyishika requested a review from egrace479 June 23, 2026 18:49

@egrace479 egrace479 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comments and suggestions specifically looking at these changes.

It seems some informative comments were also removed. Looking at the full diff, all the check_existing_images docstrings have been removed. This function should have been essentially copied over with only the logging updates.

Comment thread src/cautiousrobot/roll_call.py Outdated
try:
existing_files = gather_file_paths(img_dir)
except EmptyInputDirectoryError:
logger.warning(f"Image directory '{img_dir}' is empty.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This wouldn't be a warning, just info. It falls into almost the same category as above where the directory doesn't exist. These are testing the target image directory.

Comment thread src/cautiousrobot/roll_call.py Outdated

num_existing = len(existing_files)
logger.info(
f"{num_existing} files already exist in {img_dir}. "

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This isn't actually about the number of files in the target directory. It's specifically the number of files in the target directory that match those listed in the provided CSV (so this wording needs to change to match the meaning from the print message).

Comment thread src/cautiousrobot/roll_call.py Outdated
Comment on lines 127 to 143
def _preview_or_save(self, label, df):
"""Print up to 5 rows or save to CSV if larger."""
if len(df) <= 5:
logger.warning(f"{label} detected ({len(df)} rows). Previewing.")
print(f"\n❗ {label.replace('_', ' ').title()} detected (showing all):")
print(df)
else:
csv_base = os.path.splitext(self.csv_path)[0]
save_path = f"{csv_base}_{label}.csv"
df.to_csv(save_path, index=False)

logger.warning(f"{len(df)} {label} detected. Saved to {save_path}")

print(
f"\n❗ {len(df)} {label.replace('_', ' ')} detected.\n"
f"Full list saved to:\n {save_path}\n"
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would these warnings have meaning outside the log notes you set for the missing values. Looking at these functions, it's unclear the application and if there would be sufficient context to understand.

Comment thread src/cautiousrobot/roll_call.py Outdated
return

# If duplicates exist, preview or save
logger.warning(f"Duplicate checksums detected ({len(dupes)} rows).")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this would be better as a sentence "...detected in {len(dupes)} rows."

Comment thread src/cautiousrobot/roll_call.py Outdated
logger.warning("Ignoring duplicates due to --ignore-duplicates flag.")
print(
f"\n Duplicate checksums detected ({len(dupes)} rows), "
f"\n Duplicate checksums detected ({len(dupes)} rows), "

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here.

Comment thread tests/test_roll_call.py
@patch("builtins.print")
def test_missing_filenames_returns_correct_subset(self, mock_print):
"""Should return only rows with missing filenames and valid URLs."""
def test_handle_missing_filenames_some_missing(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is all missing. There should be tests for none missing (with more than one entry), some missing (combination), and all missing (also with more than one entry).

The same note applies to all other cases below (i.e., all images already exist, some, none).

Might also wish to check for appropriate logs, certainly in the cases where there are potential issues.

@egrace479 egrace479 changed the base branch from main to refactoring_validation June 29, 2026 14:13
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