-
Notifications
You must be signed in to change notification settings - Fork 4
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
new changes - Adroit JSON to JST #17
base: master
Are you sure you want to change the base?
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.
cheers for contributing a converter ethan :)
we encourage converters to be as flexible as possible, i.e. rather than being constrained to a single frequency sensor with a single sample, its useful to have one converter that handles all permutations of a payload format.
lib/AdroitVW/adroitvw-converter.ts
Outdated
*/ | ||
export class AdroitVWJsonConverter extends Converter { | ||
convert(input: Buffer): JtsDocument { | ||
const series1 = new TimeSeries({ name: 'frequency' }); |
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.
consider using the 'name' json field to define the timeseries name
lib/AdroitVW/adroitvw-converter.ts
Outdated
//const timestamp = new Date(record.lastUpdate); // using 'lastUpdate' as timestamp | ||
//const timestamp = new Date(record.lastUpdate * 1000).toLocaleString("en-NZ", { timeZone: "Pacific/Auckland" }); | ||
const timestamp_ep = new Date(record.lastUpdate); | ||
const timestamp = new Date(timestamp_ep.getTime() + (12 * 60 * 60 * 1000)); |
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.
take a look at the sample-with-zone
converter (this includes the timezone configured by the user)
lib/AdroitVW/adroitvw-converter.ts
Outdated
*/ | ||
export class AdroitVWJsonConverter extends Converter { | ||
convert(input: Buffer): JtsDocument { | ||
const series1 = new TimeSeries({ name: 'frequency' }); |
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.
consider using the 'unit.symbol' json field to define the timeseries units
Hi Jarrah, thanks for your comments, code has been modified as below: import { JtsDocument, TimeSeries } from '@eagle-io/timeseries'; /**
// Parse the input buffer to JSON object
} |
please update this pull request with your changes for review. note: take a look at line 17 of |
this converts the data file from Adroit VW logger from JSON format to eagle JST format.