GOATS-988: Finalize GPP serializers and tests.#469
Conversation
- Refactor GPP serializers to improve structure and maintainability. - Update and added unit tests to ensure comprehensive coverage of new serializers. - Handle omitted fields and nested structures in serializers for expected GPP API compliance. - Remove deprecated test files related to previous implementations. - Finish API workflow for GPP ToO creation and observation cloning.
There was a problem hiding this comment.
Pull Request Overview
This PR refactors GPP serializers to improve structure, maintainability, and API compliance. The refactoring introduces a new base class (_BaseGPPSerializer) with standardized format_gpp() and to_pydantic() methods, updates field types from CharField to appropriate typed fields (e.g., FloatField, IntegerField), and removes deprecated utility functions and test files. The changes also complete the API workflow for GPP ToO creation and observation cloning.
Key changes:
- Introduced
_BaseGPPSerializerbase class withformat_gpp()andto_pydantic()methods for consistent GPP output formatting - Refactored serializers to use proper field types instead of string-based parsing
- Removed deprecated serializers (
CloneTargetSerializer,CloneObservationSerializer) and utilities (utils.py) - Updated tests to validate new serializer structure and GPP formatting
Reviewed Changes
Copilot reviewed 45 out of 45 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/goats_tom/serializers/gpp/_base_gpp.py |
New base class providing format_gpp() and to_pydantic() interface |
src/goats_tom/serializers/gpp/_base.py |
Removed old base serializer with normalization logic |
src/goats_tom/serializers/gpp/utils.py |
Removed deprecated utility functions |
src/goats_tom/serializers/gpp/workflow_state.py |
Changed field to required, updated to use _BaseGPPSerializer |
src/goats_tom/serializers/gpp/sidereal.py |
Refactored to conditionally include optional fields in GPP output |
src/goats_tom/serializers/gpp/exposure_mode.py |
Changed fields to typed fields, implemented format_gpp() |
src/goats_tom/serializers/gpp/elevation_range.py |
Changed fields to FloatField, implemented format_gpp() |
src/goats_tom/serializers/gpp/instruments/fields.py |
New custom field for comma-separated float parsing |
src/goats_tom/serializers/gpp/instruments/gmos_*.py |
Updated to use CommaSeparatedFloatField and implement format_gpp() |
src/goats_tom/serializers/gpp/source_profile/*.py |
Refactored to use _BaseGPPSerializer with nested validation |
src/goats_tom/serializers/gpp/target.py |
New serializer combining sidereal and source profile data |
src/goats_tom/serializers/gpp/observation.py |
New serializer combining observation-related serializers |
src/goats_tom/serializers/gpp/pos_angle.py |
New serializer for position angle constraints |
src/goats_tom/serializers/gpp/constraint_set.py |
New serializer for observation constraints |
src/goats_tom/serializers/gpp/create_too.py |
New serializer for ToO creation workflow |
src/goats_tom/api_views/gpp/toos.py |
Updated to use new serializers in ToO creation workflow |
tests/goats_tom/serializers/gpp/test_*.py |
Updated tests to validate new serializer behavior and GPP formatting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #469 +/- ##
==========================================
+ Coverage 78.71% 78.84% +0.13%
==========================================
Files 269 276 +7
Lines 8493 8810 +317
Branches 493 529 +36
==========================================
+ Hits 6685 6946 +261
- Misses 1718 1745 +27
- Partials 90 119 +29 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Checklist
doc/changesusing the PR number.