Add camera rotation and optical parameters to projects (schema v23)#97
Open
tomaszmrugalski wants to merge 4 commits into
Open
Add camera rotation and optical parameters to projects (schema v23)#97tomaszmrugalski wants to merge 4 commits into
tomaszmrugalski wants to merge 4 commits into
Conversation
Adds a nullable `rotation` column (FLOAT, degrees East of North, 0–360) to the projects table. This is the first piece of data needed for the sky visualisation feature on the frontend. Changes: - db/23-project-rotation.psql: ALTER TABLE migration + schema version bump - api/openapi.yaml: rotation added to Project, ProjectCreate, ProjectUpdate schemas - heveliusbackend/app.py: SELECT cols, marshmallow schemas, _project_row_to_dict, INSERT and PATCH endpoints all updated - tests/test_api.py: 6 new tests covering create/patch/get with rotation
… preview Schema v23 now also adds focal, resx, resy, pixel_x, pixel_y to projects, back-filled from the telescope's attached sensor for existing rows. New projects auto-populate these from scope+sensor at creation time; callers may override any field explicitly. API: ProjectSchema, ProjectCreateSchema, ProjectUpdateSchema, and the POST/PATCH handlers all expose/accept the five new fields. cmd_equipment.add_project and show_project updated accordingly. Plan doc extended with: - Backend changes table and rationale for denormalised storage - All-projects sky map page (SkyMapComponent, route /sky-map) - Add-project form FOV preview (sensor-derived defaults, auditable inputs, live FOV summary chip) - Updated implementation order and model interface Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mn5wvy2To8d95XVLTBcRXE
- 6 new tests covering auto-population from sensor, null when no sensor, explicit override, PATCH update/clear, and GET/list field presence - openapi.yaml Project / ProjectCreate / ProjectUpdate schemas extended with focal, resx, resy, pixel_x, pixel_y (all nullable) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mn5wvy2To8d95XVLTBcRXE
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.
Summary
This PR adds support for storing camera rotation angle and optical imaging parameters (focal length, sensor resolution, pixel pitch) directly on project records. These values are auto-populated from the telescope's attached sensor at project creation time but can be overridden to model different optical configurations (e.g., focal reducers, binning). This enables the frontend to render sky visualizations without requiring a separate API call to the scopes endpoint.
Key Changes
Database Schema (v23)
projectstable:rotation(FLOAT): camera position angle in degrees, East of North conventionfocal(FLOAT): focal length in mmresx,resy(INTEGER): sensor width and height in pixelspixel_x,pixel_y(FLOAT): pixel pitch in micrometersAPI Endpoints
GET /api/projectsandGET /api/projects/{id}: response now includes all six new fieldsPOST /api/projects: accepts optionalrotation,focal,resx,resy,pixel_x,pixel_yin request body; auto-populates from scope's sensor when omittedPATCH /api/projects/{id}: allows updating any of the six fields individually or clearing them with nullBackend Implementation
ProjectSchema,ProjectCreateSchema, andProjectUpdateSchemamarshmallow schemas with new fieldsshow_projectandadd_projectcommands to display and accept optical parametersOpenAPI Documentation
Tests
Documentation
doc/sky-visualisation-plan.md) detailing:Implementation Details
rotationdefaults to NULL (not 0) to distinguish "not set" from "North up"https://claude.ai/code/session_01Mn5wvy2To8d95XVLTBcRXE