Deeman 38897617e7 Refactor PSD extraction: simplify to latest-only + add R2 support
## Key Changes

1. **Simplified extraction logic**
   - Changed from downloading 220+ historical archives to checking only latest available month
   - Tries current month and falls back up to 3 months (handles USDA publication lag)
   - Architecture advisor insight: ETags naturally deduplicate, historical year/month structure was unnecessary

2. **Flat storage structure**
   - Old: `data/{year}/{month}/{etag}.zip`
   - New: `data/{etag}.zip` (local) or `psd/{etag}.zip` (R2)
   - Migrated 226 existing files to flat structure

3. **Dual storage modes**
   - **Local mode**: Downloads to local directory (development)
   - **R2 mode**: Uploads to Cloudflare R2 (production)
   - Mode determined by presence of R2 environment variables
   - Added boto3 dependency for S3-compatible R2 API

4. **Updated raw SQLMesh model**
   - Changed pattern from `**/*.zip` to `*.zip` to match flat structure

## Benefits

- Simpler: Single file check instead of 220+ URL attempts
- Efficient: ETag-based deduplication works naturally
- Flexible: Supports both local dev and production R2 storage
- Maintainable: Removed unnecessary complexity

## Testing

-  Local extraction works and respects ETags
-  Falls back correctly when current month unavailable
-  Linting passes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 22:02:15 +02:00
2025-08-01 14:52:55 +00:00
2025-10-12 21:44:56 +02:00
2025-10-12 21:44:56 +02:00
2025-07-27 15:41:34 +02:00
2025-03-01 18:34:01 +01:00
2025-03-01 18:11:57 +01:00
2025-04-01 18:33:40 +02:00
2025-07-08 22:41:59 +02:00
2025-04-01 20:26:45 +02:00
2025-10-12 21:44:56 +02:00
2025-04-01 18:14:57 +02:00
2025-10-12 21:05:21 +02:00
2025-10-12 14:26:55 +02:00

Materia Environment Setup

We use uv as our Python package manager for faster, more reliable dependency management. https://docs.astral.sh/uv/

We recommend using vscode as your IDE. https://code.visualstudio.com/

1. Install UV

curl -LsSf https://astral.sh/uv/install.sh | sh

2. Setup the env

Simply run:

uv sync

This will install python & the dependencies declared so far

3. Setup pre-commit

pre-commit install

4. Adding a dependency

uv add requests

Managing a project with uv

https://docs.astral.sh/uv/guides/projects/#managing-dependencies

test

Description
No description provided
Readme 3.6 MiB
Languages
Python 50.7%
HTML 33.7%
Jupyter Notebook 8.3%
Shell 3.7%
CSS 2.9%
Other 0.7%