Skip to content
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

Add download option to skip accession numbers #142

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

spolcyn
Copy link

@spolcyn spolcyn commented May 17, 2024

This improves download efficiency when some filings have been already downloaded to another location, such as when doing incremental updates.

The existing logic to skip already downloaded files when they are in the same download_folder is useful for local-only use, but is less useful when files are only local for a brief period before being sent to long-term storage.

This improves efficiency when some filings have been already downloaded
to another location.
@spolcyn
Copy link
Author

spolcyn commented May 17, 2024

@jadchaar This feature has been manually tested -- would love a quick sanity check that this feature is reasonable to add and that I didn't miss it somewhere. Then will add automated tests.

Copy link
Owner

@jadchaar jadchaar left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! Left some feedback and ran the test suite against your changes

@@ -67,6 +67,7 @@ def get(
before: Optional[Date] = None,
include_amends: bool = False,
download_details: bool = False,
skip_accession_numbers: Optional[set[str]] = None,
Copy link
Owner

Choose a reason for hiding this comment

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

Please use Set from typing library here :)

Copy link
Owner

Choose a reason for hiding this comment

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

IMHO we should not expose this as a parameter, but instead automatically use the existing file system to determine which items to skip.

Thoughts?

Copy link
Author

Choose a reason for hiding this comment

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

That solution works well for when everything is done on a single server, and indeed it worked well for me until I started decoupling storage and computation. Once that happened, I needed an efficient way to let the ephemeral downloading jobs -- which have only small, temporary file systems -- know what had already been downloaded, which led me here.

sec_edgar_downloader/_Downloader.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jun 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (4e5d100) to head (e11e67f).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #142   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         8           
  Lines          220       223    +3     
  Branches        30        31    +1     
=========================================
+ Hits           220       223    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@spolcyn spolcyn requested a review from jadchaar June 20, 2024 16:45
@spolcyn
Copy link
Author

spolcyn commented Jun 20, 2024

I have applied the suggestions and added a test. Let me know if there are any outstanding issues!

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.

None yet

2 participants