Skip to content

Migrate backend to FastAPI and improve plot builder UX#16

Open
afffe18 wants to merge 1 commit intocodex/2026-04-19_13-59-44-split-annotation-and-colored-areas-into-fieldsfrom
codex/2026-04-20_22-45-14-rewrite-backend-with-fastapi
Open

Migrate backend to FastAPI and improve plot builder UX#16
afffe18 wants to merge 1 commit intocodex/2026-04-19_13-59-44-split-annotation-and-colored-areas-into-fieldsfrom
codex/2026-04-20_22-45-14-rewrite-backend-with-fastapi

Conversation

@afffe18
Copy link
Copy Markdown
Collaborator

@afffe18 afffe18 commented Apr 20, 2026

Motivation

  • Replace the untyped Flask placeholder backend with a modern FastAPI service that can receive JSON and generate a matplotlib SVG preview.
  • Improve the plot-builder UI ergonomics: allow reordering tabs, move close controls inside tab outlines, fix theme toggle behavior, and add helpers requested for material color management.

Description

  • Rewrote the backend from Flask to FastAPI and switched the startup script to use uvicorn backend.app:app; added a typed RenderPlotRequest model and a /api/render-plot handler that generates and returns a dummy matplotlib SVG built from the posted config.
  • Kept and adapted /api/import-database to accept both JSON and multipart/form file uploads and to extract column headers from .xlsx using openpyxl.
  • Implemented drag-and-drop reordering for dataframe tabs and frame tabs using DOM drag events and a safe moveItem helper.
  • Moved the tab close button into each tab outline and updated the tab markup to improve hit targets and keyboard activation.
  • Fixed theme toggling by applying html.style.colorScheme in addition to toggling the dark class so the UI respects the chosen theme.
  • Renamed the top-right toggle from "Show Plot" to "Preview Plot" and updated the plot page heading/button text to match.
  • Added a Generate colors button and confirmation modal to the Material colors section and implemented an HSV-based generator that spaces hues evenly and alternates brightness for maximal distinction.
  • Updated backend Python dependencies and package scripts to support FastAPI/uvicorn/matplotlib and added python-multipart for form parsing.

Testing

  • Built the client with npm run build which completed successfully.
  • Validated the backend Python syntax with python3 -m py_compile backend/app.py which succeeded.
  • Sanity-checked that the new /api/render-plot returns an SVG and that /api/import-database accepts both JSON and file form variants during local validation (no browser screenshot captured in this environment).

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant