-
Notifications
You must be signed in to change notification settings - Fork 1
Bundle predictor #21
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
base: main
Are you sure you want to change the base?
Bundle predictor #21
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances timestamp handling and usability of the Predictor, updates build tooling, and exports the Predictor at the package root.
- Introduces a
useDeviceTimeflag, renames and reordersaddDataPointparameters, and adds timestamp validation and rounding inPredictor - Exports
Predictorfrom the rootsrc/index.js - Reactivates the Rollup
copyplugin, bumps Rollup version, and updates example code to use the new API
Reviewed Changes
Copilot reviewed 7 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/predictor/index.js | Added useDeviceTime, renamed addDataPoint, timestamp checks |
| src/index.js | Exported Predictor, updated addDataPoint JSDoc and usage |
| rollup.config.mjs | Un-commented and configured copy plugin for WASM assets |
| package.json | Bumped Rollup dependency to ^2.79.2 |
| examples/example-shake/timeModeExample.js | Updated parameter order in example (method name typo remains) |
| examples/example-prediction-web/index.html | Renamed addDatapoint to addDataPoint, updated signatures |
| examples/example-prediction-node/predictionExample.js | Renamed addDatapoint to addDataPoint, updated signatures |
Comments suppressed due to low confidence (3)
src/predictor/index.js:35
- [nitpick] The JSDoc description for
useDeviceTimecontradicts the flag name. It should clarify thattrueuses device-generated timestamps (e.g.,Date.now()) rather than server-provided ones.
* @param {boolean} useDeviceTime - True if you want to use timestamps generated by the server
src/predictor/index.js:66
- [nitpick] The JSDoc for
addDataPointonly documentstime; please add@param {string} sensorNameand@param {number} valueto fully describe the method signature.
* @param {number} time - The timestamp assigned to the datapoint
src/index.js:85
- [nitpick] The JSDoc for
addDataPointis missing an@returnstag. Please add@returns {Promise}or the appropriate return type to document the function's output.
* Uploads a value for a specific timestamp to a dataset's timeSeries with name sensorName
| const time = parseInt(ti); | ||
| for (const [key, valStr] of Object.entries(valObjs)) { | ||
| p.addDatapoint(key, parseInt(valStr), time) | ||
| p.addDatapoint(time,key, parseInt(valStr)) |
Copilot
AI
Jul 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example still calls addDatapoint instead of the updated addDataPoint. Update the method name to p.addDataPoint(time, key, parseInt(valStr)).
| p.addDatapoint(time,key, parseInt(valStr)) | |
| p.addDataPoint(time, key, parseInt(valStr)) |
(and fix some other occurences)
Pull Request Overview
This PR enhances the Predictor by adding a device-time option, refactors data point handling, and updates build and export configurations.
addDataPointparameters with timestamp validation and rounding and introducesuseDeviceTimeflag inPredictoras inDataCollectorto control timestamp sourcing ( closes addDataPoint in Collector vs addDatapoint in predictor have different signatures #19 )Predictorfrom root ( closes Predictor not bundled #20 )Renaming
addDatapointtoaddDataPointand changing parameter order is a breaking change but asPredictorhasn't been much in use, I only changed the examples.useDeviceTime, renamedaddDataPoint, implemented timestamp checks and errorsaddDataPointsignature, corrected JSDoc, and includedPredictorexportcopyplugin for WASM asset^2.79.2