Skip to content

Refactored codebase#6

Open
liamzebedee wants to merge 1 commit into
masterfrom
refactor-state
Open

Refactored codebase#6
liamzebedee wants to merge 1 commit into
masterfrom
refactor-state

Conversation

@liamzebedee
Copy link
Copy Markdown
Owner

@liamzebedee liamzebedee commented Jun 16, 2020

Here I'm attempting to refactor the codebase. The previous iteration was largely a monolith of two files - the frontend app and the simulation model.

Some details of the refactoring directory structure are in REFACTOR.md.

The model file was extracted into the following:

  • Simulation - containing the functions modelling insulin and glucose release, as well as the discrete timestep simulator
  • InsulinPumpModel - containing the model of the insulin pump's settings, and relevant helpers for parsing it from text
  • BodyMetabolismModel - containing the model of the body's metabolism.
  • event_helpers - helpers for parsing event strings into Event effects, which are passed into the simulation.

The frontend file was refactored into the following:

  • Plotly helpers - for rendering the Plotly graph, and converting between date formats
  • form helpers - this just contains the debouncers
  • compose helper - this is a functional helper, used by frontend and model.

Originally, the goal was to refactor frontend state. During this iteration, I realised that the state was a reasonable contained concern, compared to the rest of the codebase. Hence, the project structure was refactored instead.

@liamzebedee
Copy link
Copy Markdown
Owner Author

@squishykid I want this on my desk by Monday.

@squishykid
Copy link
Copy Markdown

(╯°□°)╯︵ ┻━┻

@squishykid
Copy link
Copy Markdown

Needs more test coverage b4 i can approve

Renamed:
- Model -> Simulation

Extracted:
- FunctionPlots
- InsulinPumpModel
- BodyMetabolismModel
- plotly helpers
- form helpers (debouncers)
- compose helper

New:
- Helpers for parsing events (event_parsing)
@liamzebedee
Copy link
Copy Markdown
Owner Author

@squishykid can confirm I have been running this system in production and like me it has 9 9's uptime.

@squishykid
Copy link
Copy Markdown

Declining because it’s getting stale

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.

2 participants