Skip to content

Fix inventory location grouping and lookup - #962

Merged
wangyinz merged 3 commits into
masterfrom
codex/issue-824-inventory-locations
Aug 24, 2026
Merged

wangyinz merged 3 commits into
masterfrom
codex/issue-824-inventory-locations

Conversation

@wangyinz

@wangyinz wangyinz commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Group each StationXML channel only under its own location code and preserve its exact coordinates, depth, validity interval, orientation, and response.
  • Create one site per network/station/location with the union of its channel intervals. Use channel coordinates when they agree; otherwise use Station coordinates and emit one warning.
  • Return None for zero explicit-location matches, the document for one match, and MsPASSError(Invalid) for ambiguous duplicates.

This PR does not define or migrate the persistent Inventory representation; #989 owns that codec and its backward-compatible readers.

Validation

  • Local contract result: 1 database-independent test passed; 4 MongoDB-backed tests were collected and skipped because no local MongoDB listener was available.
  • Python compilation, Black formatting, and git diff --check pass.

Closes #824

@codecov

codecov Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.44%. Comparing base (1410381) to head (836f8fa).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #962      +/-   ##
==========================================
- Coverage   73.45%   73.44%   -0.01%     
==========================================
  Files         182      182              
  Lines       36162    36160       -2     
  Branches     2532     2532              
==========================================
- Hits        26562    26559       -3     
- Misses       8695     8696       +1     
  Partials      905      905              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wangyinz
wangyinz marked this pull request as draft August 14, 2026 06:01
@wangyinz
wangyinz marked this pull request as ready for review August 14, 2026 15:42
@wangyinz
wangyinz marked this pull request as draft August 24, 2026 07:33
@wangyinz

Copy link
Copy Markdown
Member Author

Human decision required: channels sharing one net/sta/loc can have conflicting geometry, so the current last-channel-wins result is order-dependent. Recommendation: keep exact per-channel metadata; create one site with the union time interval; use channel geometry only when all channels agree, otherwise use Station-level coordinates and emit one warning. The alternative is to reject the conflicting site group. This PR remains Draft pending that choice.

@wangyinz
wangyinz force-pushed the codex/issue-824-inventory-locations branch from 3f3e456 to 836f8fa Compare August 24, 2026 09:09
@wangyinz

Copy link
Copy Markdown
Member Author

Maintainer decision implemented. Each channel retains its exact StationXML metadata; each net/sta/loc produces one site spanning the union channel interval; agreeing channel geometry defines the site, while conflicting geometry falls back to Station coordinates with one warning. Explicit-location duplicate lookup remains Invalid. No human behavior decision remains; this PR is ready after final CI.

@wangyinz
wangyinz marked this pull request as ready for review August 24, 2026 09:09
@wangyinz
wangyinz merged commit 92ca6cf into master Aug 24, 2026
18 checks passed
@wangyinz
wangyinz deleted the codex/issue-824-inventory-locations branch August 24, 2026 09:29
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.

Preserve Inventory channel locations and reject ambiguous lookups

1 participant