Skip to content
COMP 523.002 · Team C

Design document

This document expands the architecture diagram into modules, describes the code repository, defines the data the system exchanges, and records why we chose this design over others.

← All deliverables

1. Expanded architecture

Expanded architecture diagramRenderer UIAPI client (api/)devrealHTTP + JSONPython callsstarts / stopssave / open (IPC)ui/builderElement form and layoutcanvasui/optimizeBounds, run, progress,cancelui/resultsCoefficients, spotdiagram, plotsMock clientPlaceholder results fordevelopmentAPI interfaceTyped requests andresponsesHTTP clientCalls the local Pythonserviceservice/Analyze, optimize,spot-diagram endpointsLieOpticsClient's package,used unmodifiedelectron/Windows, save and load,starts the service
Our workInherited from the clientExternalControl / file access
  • ui/builder to API interface
  • ui/optimize to API interface
  • ui/results to API interface
  • API interface to Mock client: dev
  • API interface to HTTP client: real
  • HTTP client to service/: HTTP + JSON
  • service/ to LieOptics: Python calls
  • electron/ to service/: starts / stops
  • API interface to electron/: save / open (IPC)

Each box above is a module in the repository. Responsibilities:

Major modules
ModuleLanguageComponentResponsibility
ui/builderTypeScriptRenderer UILens element form and layout canvas; edits the in-memory lens model.
ui/resultsTypeScriptRenderer UIAberration coefficient table, spot diagram, and phase-space plots.
ui/optimizeTypeScriptRenderer UIOptimization bounds, run, progress, and cancel controls.
apiTypeScriptAPI clientTyped interface plus mock and HTTP implementations, so the real backend can replace the mock.
electronTypeScriptElectron shellWindow management, save/load dialogs, starting and stopping the Python service.
servicePythonThin Python serviceExposes analyze, optimize, and spot-diagram endpoints that call LieOptics.

2. Code repository

Team repository. The repository README covers installing dependencies, running the app against the mock API, and running it against the real backend.

Languages and the components they implement
LanguageImplements
TypeScript (React)Renderer UI and typed API client
TypeScript (Node)Electron main process: windows, file access, service launch
PythonThin service wrapping LieOptics (the LieOptics package itself is the client's)

3. Data definitions

LensElement — One lens in the system.

LensElement fields
FieldTypeMeaning
idstringStable identifier used by the UI.
radiusnumberCurvature radius of the surface.
thicknessnumberDistance to the next element.
glassIndexnumberRefractive index of the glass.

LensSystem — A complete design; also the saved-file format (JSON).

LensSystem fields
FieldTypeMeaning
versionnumberFile format version for future migration.
namestringUser-visible title.
elementsLensElement[]Ordered front to back.
fieldAnglesnumber[]Field angles analyzed; three by default.

AnalysisResult — Returned by an analyze request.

AnalysisResult fields
FieldTypeMeaning
coefficients{ name: string; value: number }[]Aberration coefficients.
spots{ fieldAngle: number; points: [number, number][] }[]Spot-diagram points per field angle.

OptimizationRequest — Sent to start an optimization.

OptimizationRequest fields
FieldTypeMeaning
systemLensSystemStarting design.
variables{ elementId: string; parameter: string; min: number; max: number }[]Which parameters vary and their bounds.

Field names are the front end's own contract. The Python service maps them onto the LieOptics classes, so a change in LieOptics touches only that mapping.

4. Design rationale

  • Route everything through one typed API layer. It isolates the client's backend from the UI, lets us build and test against a mock first, and satisfies the no-backend-changes constraint.
  • Electron desktop shell. Cross-platform, offline, and native file access with skills the team already has.
  • Save designs as a single JSON file. Human-readable, easy to version-control and share, simple to validate.

Rejected approaches

  • Python-native GUI (PyQt/Tkinter). Team lacks the experience, and interactive plots and a canvas builder would cost more effort.
  • Pure web app with a hosted backend. No native file access and the client would need to host the backend.
  • Rewriting LieOptics analysis in JavaScript. Duplicates the client's work and breaks the no-modification constraint.
  • Direct in-process calls from the UI to Python. Couples the UI to backend internals and prevents mock-first development.

Related documents