StatisticalReinforcementLearningLab / SARAv2

SARA V2
BSD 3-Clause "New" or "Revised" License
5 stars 2 forks source link

OneSignal Tracking #208

Closed mashfiqui-rabbi closed 3 years ago

mashfiqui-rabbi commented 3 years ago
  1. Unclear where the onesignalID is gettting tracked. Check if the environment file is pointing to the right microservice.
  2. Why there are two copies of the onesignalID. What are the differences?
  3. Document the micro-service that does the tracking.

Acceptance criteria:

  1. Verify mash gives the pointers and explanation to how the code works in response to this issue.
  2. Sarah/Eura accurately integrates the current code, in the new server and getting updated onesignalID when the app is accessed
mashfiqui-rabbi commented 3 years ago

@eurashin @sarahrathnam

The code for storing one signal id is in the following place. The one signal id gets reported to the server every time the aquarium page is opened. This gives us the most update onesignal id.

https://github.com/StatisticalReinforcementLearningLab/SARAv2/blob/2da811d27da22f87ee1befc83b7862d4e12f6599/src/app/incentive/aquarium/demo-aquarium/demo-aquarium.component.ts#L302

Note here: I have updated the onesignal id frequently for a few reasons:

  1. Onesignal ID of a user may change on two occasions (1) at the start when the user first signs up (2) the id is updated after a sufficient amount of time has passed. Ids are rotated every now and then for security reasons.
  2. While we have functions to get notified when the id is updated or assigned, this is an one time call. So, if we fail to update the server about it then we will always have an old id. So, it is safe to to notify the server periodically what the onesignal id is.

The id is received in the user registration microservice I believe. The end point is /store-onesignal-id. You can see how it is used in the following link https://github.com/StatisticalReinforcementLearningLab/SARAv2/blob/2da811d27da22f87ee1befc83b7862d4e12f6599/src/app/incentive/aquarium/demo-aquarium/demo-aquarium.component.ts#L327

mashfiqui-rabbi commented 3 years ago

The following angular service handles the assignment and update of the onesignal id https://github.com/StatisticalReinforcementLearningLab/SARAv2/blob/2da811d27da22f87ee1befc83b7862d4e12f6599/src/app/notification/one-signal.service.ts

Code of where we are storing the onesignal id locally. https://github.com/StatisticalReinforcementLearningLab/SARAv2/blob/2da811d27da22f87ee1befc83b7862d4e12f6599/src/app/notification/one-signal.service.ts#L74

euranofshin commented 3 years ago

Hi Mash, thanks! The onesignal ids are now updating. Let me review the acceptance criteria so we can close this issue.

There is only one minor comment! You mentioned:

The id is received in the user registration microservice I believe.

But within the environment.ts file, and the SARAv2/src/app/incentive/aquarium/demo-aquarium/demo-aquarium.component.ts file, the server that receives the /store-onesignal-id command is actually the flaskServerForIncentives server. I think this needs to be updated for the SARA-dev team.