Make cross-dating correct + add cloud API (review, science fixes, FastAPI, CI)#1
Draft
ericgjerde wants to merge 4 commits into
Draft
Make cross-dating correct + add cloud API (review, science fixes, FastAPI, CI)#1ericgjerde wants to merge 4 commits into
ericgjerde wants to merge 4 commits into
Conversation
…ne, GLK, orientation, missing-ring detection
…lementation status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is
Started as a technical review (
docs/TECHNICAL_PLAN.md) and now also implements the high-priority fixes from it: the dating-science correctness bugs, a testing/CI foundation, and a deployable FastAPI service so the engine actually runs in the cloud.Headline result
On a committed, deterministic synthetic fixture with a known felling year of 1789, the old pipeline returned a confidently wrong 1739 (r=0.89, t=18.7) because RWL master chronologies were built from raw widths, leaving an age-trend that matched spuriously. After the fix it returns the correct 1789, HIGH confidence (r=0.97, t=35.8). That regression is now locked in by an offline end-to-end test.
Science correctness fixes
crossdating/felling.py. Reports now distinguish exact felling year (bark edge), an estimated range (sapwood model), and terminus post quem ("felled after"). Thebark_edgeflag was previously ignored.normalize_orientation);--orientation bark_to_pithreverses input. Reversed input recovers the same date.detect_missing_ringlocates a likely missing/extra ring; the matcher surfaces it as an actionable warning. (Full auto-realignment search is left as follow-up.)abs(), so it no longer double-counts both edges of every ring.Cloud / infrastructure
src/dendro/api/app.py):/health,/references,/date(JSON),/date/csv(upload),/parse. Engine used as a library (no shelling out to the CLI), input validation + size limits, reference index cached at startup. Verified live via uvicorn and via TestClient.DENDRO_REFERENCE_DIR),.dockerignore..github/workflows/ci.yml): ruff + pytest on 3.11/3.12, plus a Docker build +/healthsmoke test.Tests
83 tests total; 79 pass offline, 4 real-ITRDB tests skip without downloaded data (NOAA egress is blocked here). New coverage: end-to-end synthetic dating, felling logic, spline frequency response, GLK significance, missing-ring detection, Tucson round-trip, and the API.
ruff checkis clean.What's still outstanding (in the plan)
Full missing-ring re-alignment search, the browser measurement workflow (Phase 3, replaces the local matplotlib GUI), a persistent project/database model + job queue (rest of Phase 2), real reference-corpus management, and validation against dplR.
Note on verification
I built a fresh venv and ran the suite, ruff, and a live API server here — all green. I could not exercise the real-ITRDB path (NOAA returns 403 from this environment), which is exactly why the synthetic fixtures exist.
https://claude.ai/code/session_01GtfEShRYVMGCBEK8Xb8hWE