-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor Validation and Create RollCall module #56
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
Open
codedbyishika
wants to merge
24
commits into
main
Choose a base branch
from
refactoring_validation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
4868e30
Refractor Validation.py
codedbyishika 784c5a4
Remove unused imports
codedbyishika 5de93ee
Delete validate_output_directory
codedbyishika bb336a6
Remove unused import
egrace479 930e33d
small formatting fix
egrace479 a67fe33
Create test_validation.py
codedbyishika 48e72d6
Fix imports
codedbyishika c2d1b38
Create RollCall Module
codedbyishika ff930b0
Change Imports
codedbyishika d14d7ac
Revert "Change Imports"
codedbyishika 9d46b5f
Change Tests and Imports
codedbyishika 6e91c0d
Name change
codedbyishika 8fe0e6d
Update tests
codedbyishika 15cd820
Update interactive to missing filenames error handling
codedbyishika af134f8
Small error fix
codedbyishika 1271c26
Update for csv to initialize when dataframe is missing
codedbyishika c905318
duplicate checksums
codedbyishika 2f34879
summary of where images & downsized images will be downloaded
codedbyishika 6c0b5d4
Include comments and docstrings
codedbyishika 2023722
Apply suggestions from code review
codedbyishika dc27967
Update error in main
codedbyishika 4e21d0f
Allow user to ignore duplicate checksums
codedbyishika 2af2fb4
Remove 5 value threshold
codedbyishika 63e93a7
Test Fixture
codedbyishika File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #CSV validation and input handling functions. | ||
|
|
||
| import sys | ||
|
|
||
|
|
||
|
egrace479 marked this conversation as resolved.
Outdated
|
||
| def validate_csv_extension(csv_path): | ||
| """Validate that the input file has a .csv extension.""" | ||
| if not csv_path.endswith(".csv"): | ||
| sys.exit("Expected CSV for input file; extension should be '.csv'") | ||
|
|
||
|
|
||
| def validate_filename_uniqueness(data_df, filename_col): | ||
| """Validate that the filename column contains unique values.""" | ||
| if data_df.loc[data_df[filename_col].notna()].shape[0] != data_df[filename_col].nunique(): | ||
| sys.exit(f"{filename_col} is not a unique identifier for this dataset, please choose a column with unique values for filenames.") | ||
|
|
||
|
|
||
| def handle_missing_filenames(data_df, filename_col, url_col): | ||
| """Handle cases where URLs exist but filenames are missing.""" | ||
| urls_no_name = len(data_df.loc[(data_df[filename_col].isna() & (data_df[url_col].notna()))]) | ||
| if urls_no_name > 0: | ||
| ignore = input(f"'{filename_col}' is missing values for {urls_no_name} URLs. Proceed with download ignoring these URLs? [y/n]: ") | ||
| if ignore.lower() != "y": | ||
| sys.exit("Exited without executing.") | ||
|
|
||
|
|
||
| def setup_expected_columns(args): | ||
| """Set up the expected columns dictionary for CSV processing.""" | ||
| subfolders = args.subdir_col | ||
| expected_cols = { | ||
| "filename_col": args.img_name_col.lower(), | ||
| "url_col": args.url_col.lower() | ||
| } | ||
| if subfolders: | ||
| subfolders = subfolders.lower() | ||
| expected_cols["subfolders"] = subfolders | ||
| return expected_cols, subfolders | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.