geo-activity-playground 1.7.0__py3-none-any.whl → 1.8.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,15 +60,15 @@ logger = logging.getLogger(__name__)
60
60
 
61
61
  class TileInfo(TypedDict):
62
62
  activity_ids: set[int]
63
- first_time: datetime.datetime
63
+ first_time: pd.Timestamp
64
64
  first_id: int
65
- last_time: datetime.datetime
65
+ last_time: pd.Timestamp
66
66
  last_id: int
67
67
 
68
68
 
69
69
  class TileHistoryRow(TypedDict):
70
70
  activity_id: int
71
- time: datetime.datetime
71
+ time: pd.Timestamp
72
72
  tile_x: int
73
73
  tile_y: int
74
74
 
@@ -254,6 +254,10 @@ def _process_activity(
254
254
 
255
255
  first_time = tile_visit.get("first_time", None)
256
256
  last_time = tile_visit.get("last_time", None)
257
+ if first_time.tz is None:
258
+ first_time = first_time.tz_localize("UTC")
259
+ if last_time.tz is None:
260
+ last_time = last_time.tz_localize("UTC")
257
261
  try:
258
262
  if first_time is None or time < first_time:
259
263
  tile_visit["first_id"] = activity_id
@@ -7,6 +7,7 @@ import zoneinfo
7
7
  from typing import Optional
8
8
 
9
9
  import pandas as pd
10
+ import sqlalchemy
10
11
  from stravalib import Client
11
12
  from stravalib.exc import Fault
12
13
  from stravalib.exc import ObjectNotFound
@@ -121,8 +122,21 @@ def try_import_strava(
121
122
  and strava_activity.start_date is not None
122
123
  and str(strava_activity.start_date) > strava_end
123
124
  ):
125
+ logger.info(f"Reached {strava_end}, stopping.")
124
126
  break
125
127
 
128
+ if (
129
+ existing_activity := DB.session.scalar(
130
+ sqlalchemy.select(Activity).where(
131
+ Activity.upstream_id == strava_activity.id
132
+ )
133
+ )
134
+ ) is not None:
135
+ logger.info(
136
+ f"Strava activity {strava_activity.id} already exists in database as {existing_activity.id}, skipping."
137
+ )
138
+ continue
139
+
126
140
  cache_file = (
127
141
  pathlib.Path("Cache")
128
142
  / "Strava Activity Metadata"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: geo-activity-playground
3
- Version: 1.7.0
3
+ Version: 1.8.0
4
4
  Summary: Analysis of geo data activities like rides, runs or hikes.
5
5
  License: MIT
6
6
  Author: Martin Ueding
@@ -48,14 +48,14 @@ geo_activity_playground/core/tiles.py,sha256=LBn2V6WAvMxZeXSIQ8ruZL71iyvOXoFZMz7
48
48
  geo_activity_playground/core/time_conversion.py,sha256=f5CByqyWSthCplrbXZThSFbt3eY-t1g-2H5lkfBlgc0,1556
49
49
  geo_activity_playground/explorer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
50
  geo_activity_playground/explorer/grid_file.py,sha256=YNL_c4O1-kxaajATJwj4ZLywCL5Hpj9qy2h-F7rk8Yg,3260
51
- geo_activity_playground/explorer/tile_visits.py,sha256=QlotWptXgv_uvtBr4qSdGpC4as6PR5Idharv_utwNyU,16943
51
+ geo_activity_playground/explorer/tile_visits.py,sha256=2MgM6laZeg9q749jZfW6tO5Wk5reAAwV2XqL4xgafFw,17135
52
52
  geo_activity_playground/explorer/video.py,sha256=7j6Qv3HG6On7Tn7xh7Olwrx_fbQnfzS7CeRg3TEApHg,4397
53
53
  geo_activity_playground/heatmap_video.py,sha256=I8i1uVvbbPUXVtvLAROaLy58nQoUPnuMCZkERWNkQjg,3318
54
54
  geo_activity_playground/importers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
55
  geo_activity_playground/importers/activity_parsers.py,sha256=NAK_Fv_zy75WuNa1bgYgzjc7Dnsj1oVah6DW0faLCG4,11403
56
56
  geo_activity_playground/importers/csv_parser.py,sha256=O1pP5GLhWhnWcy2Lsrr9g17Zspuibpt-GtZ3ZS5eZF4,2143
57
57
  geo_activity_playground/importers/directory.py,sha256=sHcLIi0DOPEATt4wiE_vp00h89fO940wUQyJZUzzpnw,3978
58
- geo_activity_playground/importers/strava_api.py,sha256=0lUmC6u829vJpaIs7plQq4mOPgc7yQI65vN9qhAEqVs,9015
58
+ geo_activity_playground/importers/strava_api.py,sha256=RBKjeFJlDMqVBamr47y9wfO1w-0reE8turYe7aDxLWI,9556
59
59
  geo_activity_playground/importers/strava_checkout.py,sha256=joJI_uic9fYtu7E5Odh6GUq_LyiLqQ72Ucy_Mbjr-X0,9289
60
60
  geo_activity_playground/importers/test_csv_parser.py,sha256=nOTVTdlzIY0TDcbWp7xNyNaIO6Mkeu55hVziVl22QE4,1092
61
61
  geo_activity_playground/importers/test_directory.py,sha256=_fn_-y98ZyElbG0BRxAmGFdtGobUShPU86SdEOpuv-A,691
@@ -175,8 +175,8 @@ geo_activity_playground/webui/templates/summary/vega-chart.html.j2,sha256=mw8Hti
175
175
  geo_activity_playground/webui/templates/time_zone_fixer/index.html.j2,sha256=s9r6BJMXmd7kLSyjkvH4xLi6e01S5bpGRcMgMMJyCAE,1760
176
176
  geo_activity_playground/webui/templates/upload/index.html.j2,sha256=I1Ix8tDS3YBdi-HdaNfjkzYXVVCjfUTe5PFTnap1ydc,775
177
177
  geo_activity_playground/webui/templates/upload/reload.html.j2,sha256=YZWX5eDeNyqKJdQAywDBcU8DZBm22rRBbZqFjrFrCvQ,556
178
- geo_activity_playground-1.7.0.dist-info/LICENSE,sha256=4RpAwKO8bPkfXH2lnpeUW0eLkNWglyG4lbrLDU_MOwY,1070
179
- geo_activity_playground-1.7.0.dist-info/METADATA,sha256=HCy1RVSW8KTPYzUWo9XW5ozzP9HV87ueYQO3Aq6mXjY,1937
180
- geo_activity_playground-1.7.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
181
- geo_activity_playground-1.7.0.dist-info/entry_points.txt,sha256=pbNlLI6IIZIp7nPYCfAtiSiz2oxJSCl7DODD6SPkLKk,81
182
- geo_activity_playground-1.7.0.dist-info/RECORD,,
178
+ geo_activity_playground-1.8.0.dist-info/LICENSE,sha256=4RpAwKO8bPkfXH2lnpeUW0eLkNWglyG4lbrLDU_MOwY,1070
179
+ geo_activity_playground-1.8.0.dist-info/METADATA,sha256=taxTIecFczAWSZpQtPSiIc3LcyS9jUBEwCPOJQMaR3s,1937
180
+ geo_activity_playground-1.8.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
181
+ geo_activity_playground-1.8.0.dist-info/entry_points.txt,sha256=pbNlLI6IIZIp7nPYCfAtiSiz2oxJSCl7DODD6SPkLKk,81
182
+ geo_activity_playground-1.8.0.dist-info/RECORD,,