Skip to content

simulation logic for backend and chart plotting for frontend#25

Merged
leslieyip02 merged 36 commits into
mainfrom
feat/simulation
Mar 18, 2026
Merged

simulation logic for backend and chart plotting for frontend#25
leslieyip02 merged 36 commits into
mainfrom
feat/simulation

Conversation

@KennyLewi

@KennyLewi KennyLewi commented Feb 2, 2026

Copy link
Copy Markdown
Collaborator

changes:

  • add backend logic for simulations
    • topologicalSort to sort evaluation order of variables based on dependencies, throws error if cyclic dependency is detected
    • simulate to run the simulation based on the time-series specified
    • API url is POST /simulate
  • add test cases for new backend functions
  • update Identifiable ids to use snake_case
  • simulation modal view in frontend
  • backend fetch action in frontend
  • chart plotting
    ScreenRecording2026-02-02175220-ezgif com-video-to-gif-converter

Closes #5
Closes #10
Closes #35

@codecov-commenter

codecov-commenter commented Feb 2, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 2.12766% with 230 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.64%. Comparing base (d078aae) to head (fe00704).

Files with missing lines Patch % Lines
client/src/views/simulate/SimulationModalView.tsx 0.00% 44 Missing and 8 partials ⚠️
client/src/utils/useEquationController.tsx 0.00% 36 Missing and 12 partials ⚠️
client/src/actions/simulation.ts 0.00% 23 Missing and 4 partials ⚠️
client/src/views/simulate/SimulationChartView.tsx 0.00% 20 Missing and 5 partials ⚠️
client/src/utils/displayEquationHelpers.ts 0.00% 12 Missing and 6 partials ⚠️
client/src/utils/getParentEntities.ts 0.00% 9 Missing and 3 partials ⚠️
client/src/utils/useOutsideClickHandler.ts 0.00% 10 Missing and 2 partials ⚠️
...nt/src/views/inspector/equation/EquationBadges.tsx 0.00% 10 Missing and 2 partials ⚠️
client/src/utils/sim.ts 0.00% 8 Missing and 3 partials ⚠️
.../src/views/inspector/equation/EquationFieldSet.tsx 0.00% 7 Missing ⚠️
... and 5 more
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #25      +/-   ##
==========================================
- Coverage   27.61%   26.64%   -0.98%     
==========================================
  Files          72       78       +6     
  Lines        1767     1888     +121     
  Branches      287      323      +36     
==========================================
+ Hits          488      503      +15     
- Misses       1118     1201      +83     
- Partials      161      184      +23     
Flag Coverage Δ
client 14.68% <2.12%> (-0.19%) ⬇️
server 87.98% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread client/src/models/simulation.ts
Comment thread client/src/models/graph.ts Outdated
Comment thread client/src/views/simulate/SimulationModalView.tsx Outdated
Comment thread server/sim/routes.go
Comment thread server/sim/sim_test.go
KennyLewi and others added 7 commits February 18, 2026 12:38
entity must be preceeded by a space. support parentheses in equation

update equation error as draft equation is updated

update equation error as draft equation is updated

add mathjs parser check in equation validation

add badges to cursor position. centralize validation

refactor equationError to use a custom error message string

only commit equation in the absence of errors

highlight badges of unincluded labels

remove redundant validation check

fix bug where error message flashes when concurrent user edits label for parent node

parse space-separated tokens

add space between cursor adn badge
@leslieyip02

Copy link
Copy Markdown
Owner

@KennyLewi Merged with main. LMK if you need help with anything.

@leslieyip02 leslieyip02 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Algorithms are probably correct but I think we need to improve the UX.

Comment thread client/src/views/simulate/SimulationModalView.tsx
Comment thread server/sim/sim.go
Comment thread client/src/views/simulate/SimulationModalView.tsx Outdated
Comment thread client/src/models/graph.ts Outdated
Comment thread client/src/views/simulate/SimulationChartView.tsx
Comment thread client/src/models/simulation.ts

@leslieyip02 leslieyip02 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Note: I changed the API URL pattern to standardize with other API calls.

@leslieyip02
leslieyip02 merged commit 5c165d5 into main Mar 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: equation saving when any part of dom is clicked feat: equations and simulation logic feat: simulation and charts

4 participants