How yfermi/dr-yo-plasmax works
1. Overall shape
- This repository is a monorepo-style plasma diagnostics project, but the feature-complete application lives in Plasma-X-V1.0-main/plasmax/.
- The rest of the repo contains supporting server/proxy code, dataset generation scripts, harvested NIST data, and verification tooling.
2. Primary runtime
- The main app is a TypeScript + React + Vite browser application.
- Its entry points are plasmax/src/main.tsx and plasmax/src/App.tsx, with a parallel root-level app shell also present in src/, likely for a simpler or earlier build variant.
3. UI composition
- The UI is organized into feature components rather than route-heavy pages.
- Major user-facing areas include:
- spectrum upload and analysis,
- spectrum visualization,
- periodic table / element browsing,
- 3D atom viewer,
- plasma diagnostic calculators,
- project/session management,
- AI assistant and help content.
- Layout is supported by reusable shells such as Sidebar and Dashboard.
4. Spectral analysis pipeline
- User spectra enter through upload/import components and are processed by analysis-oriented modules.
- The flow typically goes from file ingestion → peak detection / parsing → line matching → diagnostic interpretation.
- Core analysis components include Boltzmann, Stark, continuum, permittivity, thermodynamics, and molecule synthesis tools.
5. Physics and solver boundary
- The app separates UI from numerical logic via services/, utils/, and analysis-specific hooks/solvers.
- Examples include:
- spectralSolver for spectral computation/matching,
- useBoltzmannSolver for excitation temperature workflows,
- StarkSolver for electron density estimation,
- molecular and continuum radiation utilities.
- This boundary is important: most calculation logic is kept out of the UI components.
6. NIST data access strategy
- A major architectural feature is the hybrid local/remote NIST line database.
- The app can use prepackaged local data from plasmax/public/nist/ and plasmax/src/data/, while also supporting remote or proxied access through:
- api/nist-proxy.ts
- api/nist-direct-proxy.ts
- nist-proxy-worker.js
- services such as nistApi, nistLocal, and NISTLocalService.
- This creates an offline-friendly path with fallback/proxy-based retrieval when needed.
7. Data model and domain catalogs
- Domain data is precomputed and stored as JSON/TS assets rather than fetched from a database at runtime.
- Key datasets include:
- NIST elemental line catalogs,
- spectral databases,
- molecular constants and molecular indices,
- Stark and transition databases,
- advisor/element metadata tables.
- The app is therefore largely a client-side data-driven scientific tool rather than a traditional CRUD backend.
8. Diagnostic workflow and planning
- Beyond raw analysis, the app generates measurement plans / diagnostic protocols.
- This logic uses detected species and spectral matches to guide the user toward the right analysis tools, forming a workflow from observation → identification → recommended diagnostics.
- Components like AnalysisPipeline, AnalyticFramework, PlasmaAdvisor, and ReportGenerator suggest a workflow orchestration layer above the low-level calculators.
9. 3D visualization subsystem
- The 3D atomic viewer is a dedicated subsystem with its own components and geometry helpers.
- It presents atomic structure, transitions, and orbital concepts using interactive visual models.
- Supporting components include 3D setup/geometry modules plus element, Grotrian, and atom viewer interfaces.
10. State and session boundaries
- App-wide state is organized through React context and service layers.
- Notable context/state boundaries include:
- project/session state,
- sound/audio state,
- persistent settings and saved projects.
- The app supports project save/load as JSON and browser-session persistence, so user work is treated as a portable project artifact.
11. AI and external service integration
- There is an optional Gemini-based assistant exposed through geminiService.
- This appears to be an adjunct feature for scientific guidance and interpretation, not a core dependency of the analysis pipeline.
12. Build, deployment, and hosting
- The frontend is configured for Vite-based builds and Vercel deployment (vercel.json appears in the app trees).
- The root also contains a Node/TypeScript tooling layer for harvesting, parsing, rebuilding, and validating NIST datasets, plus small scripts for proxies and server behavior.
- In architecture terms, this repo has a client-heavy scientific app backed by static datasets and lightweight proxy endpoints, with an offline-preferred design.
Main entry points: Dashboard.tsx Dashboard · App.tsx PlasmaX app · AnalysisPipeline.tsx Analysis pipeline · services Services
Components 25
Client App
Primary browser application and its UI subsystems
- Root entry · Top-level React entry used by the root build variant
src/main.tsx - Root shell · Simpler root app container for the alternate frontend variant
src/App.tsx - PlasmaX entry · Main feature-complete app bootstrap
Plasma-X-V1.0-main/plasmax/src/main.tsx - PlasmaX app · Primary application composition and top-level navigation
Plasma-X-V1.0-main/plasmax/src/App.tsx - Dashboard · Main workspace layout and orchestration surface
Plasma-X-V1.0-main/plasmax/src/components/Dashboard.tsx - Sidebar · Reusable navigation and section switching shell
Plasma-X-V1.0-main/components/layout/Sidebar.tsx - Spectrum import · File import and spectrum ingestion entry point
Plasma-X-V1.0-main/plasmax/src/components/SpectrumImport.tsx - Spectrum view · Spectrum charting and exploration surface
Plasma-X-V1.0-main/plasmax/src/components/SpectrumVisualizer.tsx - Periodic table · Element browsing and selection workspace
Plasma-X-V1.0-main/plasmax/src/components/PeriodicTable.tsx - Atom viewer · Interactive atomic structure and transition viewer
Plasma-X-V1.0-main/plasmax/src/components/AtomViewer3D.tsx - Analysis pipeline · Coordinates identification, fitting, and diagnostic workflows
Plasma-X-V1.0-main/components/AnalysisPipeline.tsx - Analysis engines · Boltzmann, Stark, continuum, permittivity, thermodynamics, and molecular analysis components
Plasma-X-V1.0-main/plasmax/src/components - Advisor · Guidance layer that proposes diagnostic paths and reports
Plasma-X-V1.0-main/plasmax/src/components/PlasmaAdvisor.tsx - Project state · Saved project/session persistence and user workspace state
Plasma-X-V1.0-main/plasmax/src/context/ProjectContext.tsx - Sound state · Application-wide audio/sound context
Plasma-X-V1.0-main/plasmax/src/contexts/SoundContext.tsx
Data & Access
Local scientific datasets plus NIST retrieval/proxy boundary
- Services · Client-side service boundary for solvers, data access, and AI helpers
Plasma-X-V1.0-main/plasmax/src/services - Spectral solver · Spectrum computation, matching, and interpretation logic
Plasma-X-V1.0-main/plasmax/src/services/spectralSolver.ts - Local NIST · Offline-first access to packaged NIST line data
Plasma-X-V1.0-main/plasmax/src/services/nistLocal.ts - NIST API · Remote or proxied NIST retrieval interface
Plasma-X-V1.0-main/plasmax/src/services/nistApi.ts - Catalog assets · Precomputed spectral, Stark, molecular, and advisor datasets
Plasma-X-V1.0-main/plasmax/src/data - NIST pack · Packaged NIST JSON catalogs shipped with the app
Plasma-X-V1.0-main/plasmax/public/nist - Proxy endpoints · NIST proxy and direct-proxy endpoints for fallback access
Plasma-X-V1.0-main/api - Proxy worker · Worker-based NIST proxy mediation
Plasma-X-V1.0-main/nist-proxy-worker.js
Tooling
Build, harvest, verify, and server-side support scripts
- Harvest tools · Scripts for harvest, parse, verify, and rebuild workflows
scripts - Root tooling · Monorepo-level build, ingest, and verification scripts
Connections 27
- Root entry → Root shell: boots · Root variant initializes the root application shell
- PlasmaX entry → PlasmaX app: boots · Main Vite entry mounts the feature-complete app
- PlasmaX app → Dashboard: composes · Top-level app renders the central dashboard
- PlasmaX app → Sidebar: navigates · App shell uses the shared sidebar for section switching
- Dashboard → Spectrum import: ingests · Dashboard exposes spectrum import flows
- Dashboard → Spectrum view: shows · Dashboard presents spectrum visualization
- Dashboard → Periodic table: browses · Dashboard includes element and catalog browsing
- Dashboard → Atom viewer: renders · Dashboard launches the 3D atom viewer
- Dashboard → Analysis pipeline: orchestrates · Dashboard routes work into the analysis pipeline
- Analysis pipeline → Analysis engines: invokes · Workflow delegates to the physics calculators and engines
- Analysis pipeline → Advisor: recommends · Pipeline feeds diagnostic recommendations and reports
- Analysis pipeline → Services: queries · Workflow depends on shared services for computation and retrieval
- Project state → PlasmaX app: persists · Project/session state is consumed by the main app
- Sound state → PlasmaX app: feeds · Audio and UI effects are managed at app scope
- Services → Spectral solver: computes · Service layer wraps spectral matching and interpretation
- Services → Local NIST: reads · Services prefer packaged local NIST access when possible
- Services → NIST API: falls back · Services can reach remote/proxied NIST retrieval
- Local NIST → NIST pack: loads · Local service reads shipped NIST datasets
- Local NIST → Catalog assets: indexes · Local access joins app datasets with NIST catalogs
- NIST API → Proxy endpoints: routes · Remote access is mediated through proxy endpoints
- Proxy endpoints → Proxy worker: delegates · Proxy endpoints are supported by the worker bridge
- Catalog assets → NIST pack: mirrors · Data assets and NIST pack form the offline scientific catalog layer
- Harvest tools → Catalog assets: builds · Scripts harvest and rebuild the dataset bundles
- Harvest tools → NIST pack: updates · Scripts refresh packaged NIST content
- Root tooling → Harvest tools: drives · Root-level scripts coordinate harvesting and validation workflows
- Root tooling → Proxy endpoints: supports · Root tooling also exercises the proxy and server-adjacent flows
- Root shell → Root tooling: adjacent · Root variant sits near the Node tooling and dataset pipeline