Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Typescript migration #1472

Open
wants to merge 15 commits into
base: dev
Choose a base branch
from

Conversation

thomasvargiu
Copy link

@thomasvargiu thomasvargiu commented Aug 8, 2024

Work In Progress.

This could be the 0.8 release.

Currently, developing on the oref0 repository is very hard for the open source community.
It's hard to understand what variables contain, and there are a lot of javascript errors (undeclared variables, multiple types for the same variables, etc...).

This is the first draft where I've refactored a lot of lib/ scripts in Typescript. This will allow to have types and interfaces for objects, with the opportunity to document them.

Tests

All tests passes, except for the test-autotune-prep in tests/command-behavior.tests.sh. Honestly I can't understand why there is a check for a null value:

cat stdout_output | jq ".CSFGlucoseData | first" | grep -q null || fail_test "oref0-autotune-prep with carbhistory didn't contain expected CSF Glucose Data"

Changes

Some of changes are:

  • refactor a lot of javascript scripts in typescript [not completed]
  • create types for common interfaces [not completed]
  • remove moment, moment-timezone and lodash from dependencies: smaller bundles for apps like (iAPS). iAPS is 50-75% faster
  • add docker environment (with docker compose): this allows to develop without installing dependencies in your host system
  • add VSCode devcontainer devcontainer setup (see CONTRIBUTING.md): just open the project in VSCode, and you will have your development environment without install dependencies in your system
  • added instructions in CONTRIBUTING.md

Future changes

  • complete typescript migration (and remove any where not completely migrated)
  • refactor splitting functions and add unit tests
  • apply decoding of inputs to sanitize and validate them
  • use domain entities transforming external entries
  • refactor script for performance optimization (there are a lot of loops)
  • create useful and faster scripts for loop apps (currently multiple round-trips are necessary)

If you want to contribute, please add a PR to my repository.

@thomasvargiu thomasvargiu force-pushed the typescript-migration branch from 51cbcc9 to 81af6b1 Compare August 8, 2024 16:34
@thomasvargiu thomasvargiu changed the base branch from master to dev August 8, 2024 17:53
@thomasvargiu
Copy link
Author

About the test error:

All tests passes, except for the test-autotune-prep in tests/command-behavior.tests.sh. Honestly I can't understand why there is a check for a null value:

cat stdout_output | jq ".CSFGlucoseData | first" | grep -q null || fail_test "oref0-autotune-prep with carbhistory didn't contain expected CSF Glucose Data"

I guess the problem is about a bug on original meal dedupe in meal/history.
The original code shows the follow log record:

Warning: too many deviations categorized as meals

that set CSFGlucoseData to an empty array.

Debugging the original code, there are two duplicates meal entries with the same timestamp.

`generate` functions must be the entry-points for unknown inputs.
Inputs must be validated and eventually transformed.
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.

1 participant