Allow additional sources for my.location
See original GitHub issueDont expect any changes on this problem any time soon, just creating this issue to track the problem I’m having
Currently I have to overlay time.tz.via_location
, since I use a different data source (combined from gpslogger, ips from google, facebook, discord etc)
On this repo, it uses location.google
to grab that info. Slightly unrelated, but I’ve also parsed the takeout using lxml instead, so my structure there is different
I would prefer if there was a common entrypoint (like my.location.all
) that could take multiple entrypoints as input, falling back to empty iterators if they aren’t enabled/fail to be imported, as that would localize my overlayed changes to the my.location
package
You can see the current structure for my.location
here
.
├── all.py
├── gpslogger.py
├── ip.py
└── models.py
I created this following the discussion we had regarding merging pushshift data
I’ve also slightly modified the Location NT, so it can track whether this source was from an accurate (e.g. Google or gpslogger) or estimate (geolocation based on ip)
class Location(NamedTuple):
lng: float
lat: float
dt: datetime
# approximate accuracy
# true means exact, false means its based on ip/auxiliary info
accuracy: bool
Am a bit conflicted on how to handle this many data sources…
Would need some modifications, would probably create individual files for:
google
apple
(locations from gdpr export)ip-based
(need inidividual empty fallbacks forblizzard
,facebook
,discord
)gpslogger
Some of those could stay on my branch if you’re not interested in having them here, I think its more important to have the following here:
- a
common.py
file, including: - a
Location
NT which all other location providers would convert their NT/DTs to - a
merge_locations
function, with the typicalset
/emitted
behavior
Then, to enable additional location
providers, I could either just overlay the all.py
file, including my additional imports – which probably wouldn’t ever have to be changed
Something like what was described in the comment here
If there are no issues you foresee here, I’m willing to implement this at some point in the future.
Will probably not touch the location.google
file here, except to create a standard interface across all the submodules which all.py
would then import from.
Also, unsure if you settled on using all.py
or main.py
, I tend to prefer all.py
for namespace packages which are merging multiple data sources
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (6 by maintainers)
Top GitHub Comments
Also updated the location to include accuracy
Yeah, that makes sense – the bool was a quick fix on my end
reason I named it
my/google_takeout.py
to begin with was because otherwise there might be conflicts with the upstream files if someone was trying to use both for somethingI think to allow for deprecation of the current google takeout files here, I could name it
my/google/takeout/parser.py
(to keep with thegoogle_takeout_parser
name. If needed can create an all.py file to perhaps handle merging sources in the future then