Skip to content

Add regime in spectrum duplicate check in find_spectra#236

Merged
kelle merged 3 commits intoastrodbtoolkit:mainfrom
ying2212:main
Mar 3, 2026
Merged

Add regime in spectrum duplicate check in find_spectra#236
kelle merged 3 commits intoastrodbtoolkit:mainfrom
ying2212:main

Conversation

@ying2212
Copy link
Contributor

@ying2212 ying2212 commented Mar 3, 2026

The find_spectra() function includes source, mode, observation_date, and reference but regime is not used in the duplicate check when ingesting spectra.
This PR update adds regime to prevent ingesting spectra that are identical in all fields except regime.

Copy link
Contributor

@kelle kelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to add a test which tests this new functionality.

@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.38%. Comparing base (de048fd) to head (c8da5ab).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #236      +/-   ##
==========================================
+ Coverage   71.32%   72.38%   +1.06%     
==========================================
  Files          19       19              
  Lines        1653     1673      +20     
  Branches      210      211       +1     
==========================================
+ Hits         1179     1211      +32     
+ Misses        387      380       -7     
+ Partials       87       82       -5     

☔ View full report in Codecov by Sentry.
📢 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.

@kelle
Copy link
Contributor

kelle commented Mar 3, 2026

(Notice that the code coverage report is also not happy because the new code isn't being tested.)

@ying2212
Copy link
Contributor Author

ying2212 commented Mar 3, 2026

Added test coverage to verify the regime duplicate check in find_spectra and ingest_spectrum
This ensure two spectra with identical keys but different regimes can both be ingested, and that a true duplicate (including the same regime) is correctly rejected.

Copy link
Contributor

@kelle kelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor tweak to docstring. otherwise, looks great! (Assuming tests pass.)

Co-authored-by: Kelle Cruz <kellecruz@gmail.com>
@kelle kelle merged commit 48e563d into astrodbtoolkit:main Mar 3, 2026
4 checks passed
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.

2 participants