Skip to content

Conversation

@QuiteRocks
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@bradleyrule bradleyrule left a comment

Choose a reason for hiding this comment

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

Looks pretty good!

Overarching change to make is converting function description comments to docstrings.

A few issues in full_pipeline.py that will need to be addressed before merging.

from scripts.env_loader import load_env
load_env()
except:
pass
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason that this is just set to pass on an exception? I assume we'd want some form of error logging here.

print("Please install: pip install google-auth google-api-python-client")
return False

root_id = os.environ.get("GOOGLE_DRIVE_FOLDER_ID")
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change to "GOOGLE_DRIVE_FOLDER_ID" causes the script to be unable to find the drive folder since the environment variable is defined as "GOOGLE_DRIVE_ROOT_FOLDER_ID" in the .env file. This will need to be reverted to use the old variable naming scheme (unless we have a new .env that uses this new naming scheme that I am unaware of)

- Custom path: python full_pipeline.py --local C:\\path\\to\\data

Behavior:
- API mode: Streams every PDF (no local PDF persistence) and writes extracted text to data/processed-text.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might want to leave in the distinction between api mode and local mode in the behavior section.

Might also help to change line 4 to improve clarity since PDFs are streamed and not downloaded.

def process_api_mode():
"""Download PDFs from Google Drive and process them."""
root_id = os.environ.get("GOOGLE_DRIVE_ROOT_FOLDER_ID")
#Download PDFs from Google Drive and process them
Copy link
Collaborator

Choose a reason for hiding this comment

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

Our style guide says to use docstrings instead of comments for function descriptions, so it would be best to revert this to """Download PDFs from Google Drive and process them."""

Other places where this change may need to be made:

  • Line 118
  • Line 130
  • Line 173

Comment on lines +77 to +80
if not GOOGLE_DRIVE_AVAILABLE:
print("ERROR: Google Drive modules not available.")
print("Please install: pip install google-auth google-api-python-client")
return False
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be better to raise an error instead of returning False. This keeps with current code conventions and provides more detailed error handling and logging.

Comment on lines +249 to +251
success = process_api_mode()
if not success:
sys.exit(1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Related to comment on line 77-80: Probably better to catch specific error you are looking for with a try / except block or allow error to go uncaught here so it can be caught and handled higher up the call stack (or terminated if not caught).

Comment on lines -150 to -152
# Create mutually exclusive group for --api and --local
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason we changed this? It seems like a good feature to prevent the use of both arguments.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably best to change comments describing function purpose to docstrings

Copy link
Collaborator

Choose a reason for hiding this comment

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

Best to change function descriptions to docstrings

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