warn-scraper icon indicating copy to clipboard operation
warn-scraper copied to clipboard

CA scraper hopelessly inefficient

Open stucka opened this issue 1 year ago • 2 comments

stucka avatar Jul 03 '24 22:07 stucka

The scraper is ... strange. Right now every time it downloads an Excel file of recent filings. Every time it also re-downloads a bunch of historic PDFs,one of which isn't parsing correctly now but has data already in the Excel file.

We can't possibly know if the scraper will fail on when the next generation of PDF is released.

New workaround to at least bypass some of that: ZIP up BLN's existing cache archive (through ca branch) and include the output CSV in the ZIP.

Throw that up in Google Cloud Storage.

Take the last good CSV and put that separately in Google Cloud Storage.

Rework the scraper to not download any of those existing PDFs through today's dates.

Rework the scraper to download and import the processed data from Google Cloud Storage. Import it into the scraper before writing the final output CSV.

This may break as soon as the scraper detects the first July 2024 layoffs and tries to parse that PDF, but at least some of the runtime, data transfer and senseless processing can be avoided.

stucka avatar Jul 04 '24 18:07 stucka

The scraper's PDF parsing code contained a fatal flaw that would have blocked any future success, and I believe I have that patched up with https://github.com/biglocalnews/warn-scraper/pull/653

The inefficiencies., however, remain. We're downloading PDFs that haven't changed in a decade.

stucka avatar Jul 08 '24 19:07 stucka