-
Notifications
You must be signed in to change notification settings - Fork 11
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
[BACK-43] Dedup hash val #195
Conversation
use toISOString() from time field
* updates to match platform unit conversion precision * cleanup test * updates for bg conversion precision
lib/schema/urineKetone.js
Outdated
@@ -21,6 +21,7 @@ var schema = require('./schema.js'); | |||
|
|||
var idFields = ['type', 'deviceId', 'time']; | |||
schema.registerIdFields('urineKetone', idFields); | |||
schema.registerFieldsForDuplicator('urineKetone'); |
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.
FYI - I don't think platform handles this data type. If Uploader sends this data type, we'll need to update platform. Please note this in the narrative.
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.
Uploader does not use urineKetone
, only bloodKetone
lib/schema/note.js
Outdated
@@ -21,6 +21,7 @@ var schema = require('./schema.js'); | |||
|
|||
var idFields = ['type', 'time', 'creatorId', 'text', 'deviceId']; | |||
schema.registerIdFields('note', idFields); | |||
schema.registerFieldsForDuplicator('note'); |
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.
FYI - I don't think platform handles this data type. If Uploader sends this data type, we'll need to update platform. Please note this in the narrative.
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.
Uploader does not use note
, but I think Tidepool Mobile and Blip does? Then again, they're probably both using Platform, right?
"_active": true | ||
"_active": true, | ||
"_deduplicator": { | ||
"name": "org.tidepool.deduplicator.device.deactivate.hash", |
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.
We'll need to make sure that by using this deduplicator name it isn't going to cause an issue with future uploads via platform. I think just getting this in the narrative for now is good.
@@ -1,8 +1,7624 @@ | |||
{ |
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.
We should back out any changes to the lock files for this PR and use the other PR updating the actual dependencies to update the lock files.
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.
yeah I will merge it in
@@ -3,4203 +3,4205 @@ | |||
|
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.
We should back out any changes to the lock files for this PR and use the other PR updating the actual dependencies to update the lock files.
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.
as above
lib/schema/duplicate.js
Outdated
@@ -0,0 +1,77 @@ | |||
'use strict'; |
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.
[nit] Why is this file called duplicate.js
? Perhaps, platform.js
or similar to indicate it is the platform deduplicator? That way when it has used it would be platform.registerFieldsForDuplicator
which easily shows it is for platform.
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.
Or, perhaps include "platform" in the exported functions so it is clear that it is for platform deduplication.
lib/schema/duplicate.js
Outdated
} | ||
var idHashFields = idHashFieldMap[datum.type]; | ||
if (!idHashFields) { | ||
return ''; |
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.
Does the caller check for empty string and not write the platform deduplicator hash? We don't want any with empty strings in the database I think.
lib/schema/duplicate.js
Outdated
if (idHashFields[i] === 'time') { | ||
const dateTime = new Date(val); | ||
// NOTE: platform `time` is being returned minus millis so we need to do the same here | ||
val = dateTime.toISOString().split('.')[0] + 'Z'; |
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.
Huh, I didn't know this. And it has the Z
timezone at the end?
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.
Do we need to convert timezones here?
lib/schema/duplicate.js
Outdated
datum.type === 'cbg' | ||
) { | ||
// NOTE: platform `value` precision is being used so that the hash will be the same | ||
if (val.toString().length > 7) { |
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.
I think we only want to do this for mg/dL
per our platform
discussion.
lib/schema/schema.js
Outdated
@@ -513,3 +521,7 @@ exports.makeId = function(datum) { | |||
|
|||
return exports.generateId(datum, idFields); | |||
}; | |||
|
|||
exports.generateHash = duplicate.generateHash; |
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.
Perhaps include "platform" name in exports so it is clear it is for the platform deduplication.
/deploy qa3 |
1 similar comment
/deploy qa3 |
jh-bate updated values.yaml file in qa3 |
jh-bate updated flux policies file in qa3 |
jh-bate deployed jellyfish dedup-hash-val branch to qa3 namespace |
/deploy qa3 |
jh-bate updated values.yaml file in qa3 |
jh-bate updated flux policies file in qa3 |
jh-bate deployed jellyfish dedup-hash-val branch to qa3 namespace |
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.
Just a couple more things that may need to be addressed.
if (idHashFields[i] === 'time') { | ||
const dateTime = new Date(val); | ||
// NOTE: platform `time` is being returned minus millis so we need to do the same here | ||
val = dateTime.toISOString().split('.')[0] + 'Z'; |
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.
If, for some reason there isn't a .
, then it will end up with and extra Z
. For example "2011-10-05T14:48:00Z" becomes "2011-10-05T14:48:00ZZ", I think.
) { | ||
// NOTE: platform `value` precision is being used so that the hash will be the same | ||
if (val.toString().length > 7) { | ||
val = convertMgToMmol(val); |
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.
So, we aren't actually truncating the value in the datum, but computing it separately just for the hash. I think the current migrator is actually persisting the truncated value in the datum, right? Is that an issue?
superseded by #203 |
NOTE: