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

Location comparing #52

Closed
yaniv995 opened this issue Mar 23, 2020 · 6 comments
Closed

Location comparing #52

yaniv995 opened this issue Mar 23, 2020 · 6 comments

Comments

@yaniv995
Copy link

Hi,
I'm not sure you save the time that the user stay in each location. It's very important to take it into account because there could be a scenario that user has been within the same location but for few seconds.

@dotansimha
Copy link
Contributor

dotansimha commented Mar 23, 2020

@yaniv995 I'm not sure it's needed, because of the way it's implemented and the libraries it uses.

It uses https://github.com/transistorsoft/react-native-background-geolocation . It records data only when movement occurs (using accelerometer, gyroscope and magnetometer according to the docs).

Also, each location has time - see https://github.com/MohGovIL/hamagen-react-native/blob/master/src/services/SampleService.ts#L54-L55

So latest location is the current location, where you are now.

And to calculate a duration, you can use the next location if it's available (means that you already moved).

function duration(allLocations, locationIndex) {
  if (locationIndex === allLocations.length - 1) {
    return 0; // you are here now
  }

  const locationTime = allLocations[locationIndex].startTime;
  const nextLocationTime = allLocations[locationIndex + 1].startTime;

  return nextLocationTime - locationTime; // duration at specific point
}

@yaniv995
Copy link
Author

yaniv995 commented Mar 23, 2020 via email

@dotansimha
Copy link
Contributor

I think it should be considered and taken into account when calculating the exposure, but it doesn't have to be part of the database... it's a calculated field.

@yaniv995
Copy link
Author

yaniv995 commented Mar 23, 2020 via email

@dotansimha
Copy link
Contributor

I don't know, I'm just a contributor :) I guess @MiriShalev can answer that

@yaniv995
Copy link
Author

It seems ok

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

No branches or pull requests

2 participants