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

Inconsistent join behaviour in spatial units #5360

Closed
jc-harrison opened this issue Aug 23, 2022 · 1 comment · Fixed by #5361
Closed

Inconsistent join behaviour in spatial units #5360

jc-harrison opened this issue Aug 23, 2022 · 1 comment · Fixed by #5361
Labels
bug Something isn't working FlowMachine Issues related to FlowMachine

Comments

@jc-harrison
Copy link
Member

GeomSpatialUnit uses a left join from the cells table to the mapping/geom table, so includes rows for all cells in the cells table regardless of whether they map to a location in the geom table. PolygonSpatialUnit uses an inner join if no mapping table is specified, or a left join if a mapping table is specified.

This means that a SubscriberLocations query (or any other query that uses a JoinToLocation) may or may not include CDR events at known-but-unmapped cells, depending on the type of spatial unit. We should make this behaviour consistent.

I think it would make most sense to always use an inner join - cell IDs in the cells table that don't map to any locations for the specified spatial unit should be treated the same as unknown cell IDs.

E.g. if we have defined a fixed mapping from cell IDs to admin3 regions (e.g. via a cell clustering), we might want to run location queries on all CDR events that map to admin3 regions using this pre-defined mapping. If new cell locations are added to the cells table after defining the mapping, and the mapping is not updated, I don't think we would usually want to start including events at the new cells (mapped to null location), because these are effectively no different from events at unknown cell IDs (which are always excluded in JoinToLocation).

@jc-harrison jc-harrison added bug Something isn't working FlowMachine Issues related to FlowMachine labels Aug 23, 2022
@jc-harrison
Copy link
Member Author

See also #4246 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working FlowMachine Issues related to FlowMachine
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant