-
Notifications
You must be signed in to change notification settings - Fork 1
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
chore: add function to generate some of the metrics report #261
Conversation
@@ -0,0 +1,29 @@ | |||
import borders from '@osm_borders/maritime_10000m'; |
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.
This data is accurate within 10 kilometers. There are other choices with higher resolution but (1) this is small and therefore the best for performance1 (2) high accuracy might violate user privacy.
Footnotes
-
I assume ↩
|
||
const {features} = lookup.getContainers({ | ||
type: 'Point', | ||
coordinates: [longitude, latitude], |
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 thought this was backwards, but I believe it's right (and this function is unit tested).
import type {Observation} from '@mapeo/schema'; | ||
import positionToCountries from './positionToCountries'; | ||
|
||
export default function generateMetricsReport({ |
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.
This function takes a bunch of dependencies. It's more verbose, but I think it has some advantages:
- Easier to port to Electron in the future.
- Clearer to the caller what goes in; data isn't pulled from anywhere unexpected.
- Easier to test.
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.
2 small question but otherwise looks good!
I recommend reviewing this one commit at a time.
This introduces a (dormant) function for generating metrics reports. It returns a result like this:
This isn't all the metrics we want to collect but I think it's a useful starting point.
Closes #269 and #270.