Automates extraction of selected items from the CBSL Daily Price Report PDF and appends them to a long-format CSV. It also enriches each date with rainfall for Nuwara Eliya and Polonnaruwa using Open-Meteo.
Columns in data/price_dataset.csv:
date(YYYY-MM-DD)itemunitretail_pettahretail_dambullaretail_narahenpitawholesale_pettahwholesale_dambullarainfall_nuwara_eliya_mmrainfall_polonnaruwa_mmsource_pdf
python -m pip install -r requirements.txt
python scripts/update_dataset.pyForce reprocess even if the date already exists:
python scripts/update_dataset.py --forceBackfill all historical pages (optionally limit pages):
python scripts/update_dataset.py --backfill
python scripts/update_dataset.py --backfill --max-pages 3Create a .env file (do not commit it) with:
HF_DATASET_REPO=your-username/your-dataset-repo
HF_TOKEN=hf_your_token_here
- Tabula (Java) is used as the primary table extractor when available. If Java is not installed, the script falls back to PDF text parsing with pdfplumber.
The workflow runs daily and pushes the CSV to your Hugging Face dataset repo.
Store your token and repo in GitHub Secrets and write them to .env at runtime.