Skip to content

Migrate .qmd to standalone scripts for production automation - #15

Merged
NewGraphEnvironment merged 1 commit into
mainfrom
7-migrate-qmd-to-py
Feb 17, 2026
Merged

Migrate .qmd to standalone scripts for production automation#15
NewGraphEnvironment merged 1 commit into
mainfrom
7-migrate-qmd-to-py

Conversation

@NewGraphEnvironment

Copy link
Copy Markdown
Owner

Summary

Migrates stac_create_collection.qmd and stac_create_item.qmd to standalone Python/R scripts for production automation (Phase 3 VM cron jobs). Closes #14, refs #7, #6.

  • New shared module scripts/stac_utils.py — eliminates 3x duplicated date/URL functions
  • New scripts item_create.py, collection_create.py, urls_fetch.R replacing .qmd files
  • Renamed scripts to noun_verb.py convention (item_validate.py, item_reprocess.py, etc.)
  • Updated build_safe.sh to call python/Rscript instead of quarto render
  • Fixed PROJ_LIB conflict (homebrew vs conda — issue PROJ_LIB conflict: rasterio bundled PROJ vs system PROJ #14)

Before / After

# Before (quarto)
quarto render stac_create_collection.qmd --execute
quarto render stac_create_item.qmd --execute

# After (standalone)
Rscript scripts/urls_fetch.R
python scripts/collection_create.py
python scripts/item_create.py [--test] [--incremental] [--reprocess-invalid]
python scripts/item_validate.py

Test plan

  • Local: collection_create.py --test — collection created and validated
  • Local: item_create.py --test --test-count 10 — 10 items created in 12s
  • All 6 .py scripts pass syntax checks
  • VM: Full production run equivalence test
  • VM: Compare output with existing .qmd-generated catalog
  • Archive .qmd files and update README/CLAUDE.md (follow-up commit)

Relates to NewGraphEnvironment/sred-2025-2026#8, NewGraphEnvironment/sred-2025-2026#3

🤖 Generated with Claude Code

Phase 1: Shared utilities
- Create scripts/stac_utils.py with date extraction, validation, URL helpers,
  and path constants (eliminates 3x duplication across scripts)

Phase 2: Item creation migration
- Create scripts/item_create.py replacing stac_create_item.qmd Python chunks
- argparse CLI (--test, --incremental, --reprocess-invalid, --workers)
- Python logging module for proper log capture in cron

Phase 3: Collection creation migration
- Create scripts/collection_create.py replacing stac_create_collection.qmd Python chunks
- Create scripts/urls_fetch.R replacing stac_create_collection.qmd R chunk
- Clean R/Python boundary via data/urls_list.txt file interface

Phase 4: Rename scripts to noun_verb convention and wire up
- Rename: validate_stac_items.py -> item_validate.py
- Rename: reprocess_invalid_items.py -> item_reprocess.py
- Rename: extract_invalid_urls.py -> item_extract_invalid.py
- Rename: qa_update_catalogue.py -> catalogue_qa.py
- Update build_safe.sh to call Python/R scripts instead of quarto render
- Add item_validate.py step to build pipeline
- Update all cross-references across codebase

Closes #14
Refs #7, #6
Relates to NewGraphEnvironment/sred#8, NewGraphEnvironment/sred#3

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@NewGraphEnvironment
NewGraphEnvironment merged commit ccb022c into main Feb 17, 2026
1 of 2 checks passed
@NewGraphEnvironment
NewGraphEnvironment deleted the 7-migrate-qmd-to-py branch February 17, 2026 18:08
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.

PROJ_LIB conflict: rasterio bundled PROJ vs system PROJ

1 participant