Resolve /position ambiguous body names to JPL Horizons IDs - #13
Merged
dgarciabriseno merged 3 commits intoSep 3, 2026
Merged
Conversation
GET /position/<body> with a bare major-body name (earth, sun, ...) failed: JPL Horizons treats it as a wildcard (e.g. "earth" -> "EARTH*") and raises "Multiple major-bodies match string" instead of returning a position. Map the ambiguous names to their unambiguous Horizons body-center IDs (earth -> 399, etc.); spacecraft names (e.g. SDO) and unknown values pass through unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YWMb14TXe3icvCsvwENZnd
mudhoney
force-pushed
the
fix/position-body-names
branch
from
September 2, 2026 16:54
f22623c to
51f0acd
Compare
Comment on lines
+14
to
+24
| "sun": 10, | ||
| "mercury": 199, | ||
| "venus": 299, | ||
| "earth": 399, | ||
| "moon": 301, | ||
| "mars": 499, | ||
| "jupiter": 599, | ||
| "saturn": 699, | ||
| "uranus": 799, | ||
| "neptune": 899, | ||
| "pluto": 999, |
There was a problem hiding this comment.
Can we comment the ambiguities? Like main comment shows that there's "Earth" and "Earth-Moon Barycenter", we are selecting "Earth", each one of these needs a comment specifying the option we're selecting.
… select when selecting body in parameter, inside the comments
dgarciabriseno
approved these changes
Sep 3, 2026
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.
GET
/position/{observatory}fails for bare major-body names (e.g.earth,sun).Problem
JPL Horizons treats a bare major-body name as a wildcard —
earth→EARTH*— which matches both the geocenter (399) and the Earth-Moon barycenter (3), so Horizons raises "Multiple major-bodies match string" instead of returning a position.Fix
Map the ambiguous major-body names to their unambiguous Horizons body-center IDs (
earth→ 399,sun→ 10, …) before the query. Spacecraft names (e.g.SDO) and any unrecognized value pass through unchanged, so existing callers are unaffected.Notes
app/ephemeris.py).399, so it is not hitting this today — this makes the string names work for direct API users, the OpenAPI example, and testing.