geo-activity-playground 0.29.1__py3-none-any.whl → 0.29.2__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.
@@ -89,7 +89,10 @@ def build_activity_meta() -> None:
89
89
  new_shard = pd.DataFrame(rows)
90
90
  new_shard.index = new_shard["id"]
91
91
  new_shard.index.name = "index"
92
- meta = pd.concat([meta, new_shard])
92
+ if len(meta):
93
+ meta = pd.concat([meta, new_shard])
94
+ else:
95
+ meta = new_shard
93
96
 
94
97
  if len(meta):
95
98
  assert pd.api.types.is_dtype_equal(meta["start"].dtype, "datetime64[ns]"), (
@@ -137,7 +137,7 @@ def try_import_strava(config: Config) -> bool:
137
137
  **{
138
138
  "id": activity.id,
139
139
  "commute": activity.commute,
140
- "distance_km": activity.distance.magnitude / 1000,
140
+ "distance_km": activity.distance / 1000,
141
141
  "name": activity.name,
142
142
  "kind": str(activity.type),
143
143
  "start": convert_to_datetime_ns(activity.start_date),
@@ -72,6 +72,7 @@ class ActivityController:
72
72
  }
73
73
 
74
74
  new_tiles_geojson = {}
75
+ new_tiles_per_zoom = {}
75
76
  for zoom in sorted(self._config.explorer_zoom_levels):
76
77
  new_tiles = self._tile_visit_accessor.tile_state["tile_history"][zoom].loc[
77
78
  self._tile_visit_accessor.tile_state["tile_history"][zoom][
@@ -88,6 +89,7 @@ class ActivityController:
88
89
  zoom,
89
90
  )
90
91
  new_tiles_geojson[zoom] = make_grid_file_geojson(points)
92
+ new_tiles_per_zoom[zoom] = len(new_tiles)
91
93
 
92
94
  result = {
93
95
  "activity": activity,
@@ -100,7 +102,7 @@ class ActivityController:
100
102
  "speed_color_bar": make_speed_color_bar(time_series),
101
103
  "date": activity["start"].date(),
102
104
  "time": activity["start"].time(),
103
- "new_tiles": new_tiles,
105
+ "new_tiles": new_tiles_per_zoom,
104
106
  "new_tiles_geojson": new_tiles_geojson,
105
107
  }
106
108
  if (
@@ -160,6 +160,7 @@
160
160
  {% for zoom, geojson in new_tiles_geojson.items() %}
161
161
  <div class="col-md-6">
162
162
  <h3>Zoom {{ zoom }}</h3>
163
+ <p>There are {{ new_tiles[zoom] }} new tiles:</p>
163
164
  <div id="map-{{ zoom }}" style="height: 300px; width: 100%;"></div>
164
165
  <script>
165
166
  let map{{ zoom }} = add_map("{{ zoom }}", {{ geojson | safe }})
@@ -4,8 +4,7 @@
4
4
 
5
5
  <h1 class="mb-3">Metadata Extraction</h1>
6
6
 
7
- <p>There are a few metadata fields that can be populated with information from the path of the activity file or by a
8
- default value. These are:</p>
7
+ <p>If the current activity metadata is not to your liking, you can adjust how these fields are populated:</p>
9
8
 
10
9
  <ul>
11
10
  <li><tt>kind</tt>: The kind of the activity, like "Ride" or "Run".</li>
@@ -13,8 +12,9 @@
13
12
  <li><tt>name</tt>: Name for the activity, like "Ride with Friends".</li>
14
13
  </ul>
15
14
 
16
- <p>By default these fields are populated with information from within the activity files. In case one hasn't set these
17
- values correctly, it can be nice to override this data.</p>
15
+ <p>By default these fields are extracted from files that contain this data. Otherwise the filename is set as <tt>name</tt>.
16
+ You can overwrite this by setting up a directory structure with corresponding regular expressions using named capture groups.</p>
17
+
18
18
 
19
19
  <form method="POST">
20
20
  <div class="row">
@@ -32,19 +32,18 @@
32
32
  </div>
33
33
 
34
34
  <div class="col-md-6">
35
- <p>To give an example of what is possible, consider a directory structure where we have
36
- <tt>{kind}/{equipment}/{date} {name}.{ext}</tt>. Such an activity could be <tt>Ride/Red
37
- Roadbike/2024-08-10 11-45-00 Ride with Friends.fit</tt>. In order to extract this, we could use the
38
- following regular expression:
39
- </p>
35
+ <p>Consider a directory structure <tt>Ride/Red Roadbike/2024-08-10 11-45-00 Ride with Friends.fit</tt> under Activities.
36
+ You can extract <tt>kind</tt>: "Ride", <tt>equipment</tt>: "Red Roadbike", <tt>name</tt>: "Ride with Friends"
37
+ with the following regular expression:</p>
40
38
 
41
39
  <div class="code">
42
40
  <pre
43
41
  class="code literal-block">(?P&lt;kind&gt;[^/]+)/(?P&lt;equipment&gt;[^/]+)/[-\d_ .]+(?P&lt;name&gt;[^/\.]+)</pre>
44
42
  </div>
45
43
 
46
- <p>This uses "capture groups". Have a look at the <a href="https://docs.python.org/3/library/re.html">Python
47
- regex documentation</a> if you want to build your own.</p>
44
+ <p>Have a look at the documentation
45
+ <a href="https://martin-ueding.github.io/geo-activity-playground/getting-started/advanced-metadata-extraction">Advanced Metadata Extraction</a>
46
+ for explanations and examples.</p>
48
47
  </div>
49
48
  </div>
50
49
 
@@ -60,7 +60,7 @@ class UploadController:
60
60
  flash("No selected file", "warning")
61
61
  return redirect("/upload")
62
62
  if file:
63
- filename = secure_filename(file.filename)
63
+ filename = file.filename
64
64
  target_path = pathlib.Path(request.form["directory"]) / filename
65
65
  assert target_path.suffix in [
66
66
  ".csv",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: geo-activity-playground
3
- Version: 0.29.1
3
+ Version: 0.29.2
4
4
  Summary: Analysis of geo data activities like rides, runs or hikes.
5
5
  License: MIT
6
6
  Author: Martin Ueding
@@ -1,7 +1,7 @@
1
1
  geo_activity_playground/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  geo_activity_playground/__main__.py,sha256=MBZn9K1m3PofiPNTtpsSTVCyB_Gz95TjVP-nb9v_-JE,3989
3
3
  geo_activity_playground/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- geo_activity_playground/core/activities.py,sha256=HcxgLsM2tE48eqZh1t1QBk9O7vxCV9MaL2QRp0loXu0,6509
4
+ geo_activity_playground/core/activities.py,sha256=6IFfTqWGXRVD-DxKho1Nyc9ZV7kvzBWw3ZninXRM0Nk,6578
5
5
  geo_activity_playground/core/config.py,sha256=DsjZhiq2BZs94rjd7zgt_KTZIjVfxfntiEQZhgq8NeA,4617
6
6
  geo_activity_playground/core/coordinates.py,sha256=tDfr9mlXhK6E_MMIJ0vYWVCoH0Lq8uyuaqUgaa8i0jg,966
7
7
  geo_activity_playground/core/enrichment.py,sha256=CwZhW-svgPAYbdx3n9kvKlTgcsiCaeuJfSRCC4JxX6g,7411
@@ -23,7 +23,7 @@ geo_activity_playground/importers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
23
23
  geo_activity_playground/importers/activity_parsers.py,sha256=XNQs0ziqAcVqIoiLAX5Ndmhb6v__29XdjUPvNvc7oBI,11082
24
24
  geo_activity_playground/importers/csv_parser.py,sha256=O1pP5GLhWhnWcy2Lsrr9g17Zspuibpt-GtZ3ZS5eZF4,2143
25
25
  geo_activity_playground/importers/directory.py,sha256=IPnr1xk3beznmPVjfWL6AQiEKA4WN5EDIfnzrM0Tzlc,5767
26
- geo_activity_playground/importers/strava_api.py,sha256=pgWZp-cWOLkvlDE85lTiEKM8BCZYzOlAAdKoa2F7c6o,7780
26
+ geo_activity_playground/importers/strava_api.py,sha256=CLO1tW_delZwVkSLlYteUeX1jsP73ICTuLxTQeUDWTw,7770
27
27
  geo_activity_playground/importers/strava_checkout.py,sha256=N-uGTkhBJMC7cPYjRRXHOSLwpK3wc6aaSrY2RQfSitA,9419
28
28
  geo_activity_playground/importers/test_csv_parser.py,sha256=LXqva7GuSAfXYE2zZQrg-69lCtfy5MxLSq6BRwL_VyI,1191
29
29
  geo_activity_playground/importers/test_directory.py,sha256=ljXokx7q0OgtHvEdHftcQYEmZJUDVv3OOF5opklxdT4,724
@@ -31,11 +31,11 @@ geo_activity_playground/importers/test_strava_api.py,sha256=4vX7wDr1a9aRh8myxNrI
31
31
  geo_activity_playground/webui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  geo_activity_playground/webui/activity/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  geo_activity_playground/webui/activity/blueprint.py,sha256=upQzZa5sKApj_Fmu6PziFDboi7SBL5Zsi-tNSSNPlEE,1759
34
- geo_activity_playground/webui/activity/controller.py,sha256=PJIZ7pFqpUyWDrintnnlW6Hxj7DbdPswARozws6TE30,18861
34
+ geo_activity_playground/webui/activity/controller.py,sha256=PQ0uwpIFvcfDHG5TL03kF0jtg7vbtByh3Lrm_90yFNk,18956
35
35
  geo_activity_playground/webui/activity/templates/activity/day.html.j2,sha256=r3qKl9uTzOko4R-ZzyYAZt1j61JSevYP4g0Yi06HHPg,2702
36
36
  geo_activity_playground/webui/activity/templates/activity/lines.html.j2,sha256=5gB1aDjRgi_RventenRfC10_FtMT4ch_VuWvA9AMlBY,1121
37
37
  geo_activity_playground/webui/activity/templates/activity/name.html.j2,sha256=RDLEt6ip8_ngmdLgaC5jg92Dk-F2umGwKkd8cWmvVko,2400
38
- geo_activity_playground/webui/activity/templates/activity/show.html.j2,sha256=W77M1S7RQOGY3Vg9LRT5mFnefuMWUKKU1Vd-ZKxUoKg,6552
38
+ geo_activity_playground/webui/activity/templates/activity/show.html.j2,sha256=q0O1zHrfjD9lr6smuqmPYcy21-2hzNQFIPubptiRcSM,6610
39
39
  geo_activity_playground/webui/app.py,sha256=foON49jw8klBJ3GF70DDjgz-_KRDPFvC31_mScaqDXk,4255
40
40
  geo_activity_playground/webui/auth/blueprint.py,sha256=Lx-ZvMnfHLC1CMre1xPQI3k_pCtQoZvgRhtmafULzoE,812
41
41
  geo_activity_playground/webui/auth/templates/auth/index.html.j2,sha256=ILQ5HvTEYc3OrtOAIFt1VrqWorVD70V9DC342znmP70,579
@@ -73,7 +73,7 @@ geo_activity_playground/webui/settings/templates/settings/equipment-offsets.html
73
73
  geo_activity_playground/webui/settings/templates/settings/heart-rate.html.j2,sha256=UPT3MegRgSeff36lhCo0l3ZwhqNSIg5gM6h2s32GkCY,4255
74
74
  geo_activity_playground/webui/settings/templates/settings/index.html.j2,sha256=-ZSlR6htaeMMOf4ISUSzWPu5BUhYODuAmcWPN0ZoBno,4443
75
75
  geo_activity_playground/webui/settings/templates/settings/kinds-without-achievements.html.j2,sha256=IdUfXon1Pu8zX3NirKb28ypshLHOvZRpz2T4bJrzrak,1067
76
- geo_activity_playground/webui/settings/templates/settings/metadata-extraction.html.j2,sha256=Ppa8O-zRJznbeCsF4YQj37_HM9nOW8fyTi66jvWvHmA,2285
76
+ geo_activity_playground/webui/settings/templates/settings/metadata-extraction.html.j2,sha256=EUHZ-MWnSPAkiad0CHSj9UUkRUQwItTbKYJcZz9TVi0,2314
77
77
  geo_activity_playground/webui/settings/templates/settings/privacy-zones.html.j2,sha256=7BxFvCaVJOEqbImyK5vxCmhh-NGSFaRa9ARhqjZeYJ0,3093
78
78
  geo_activity_playground/webui/settings/templates/settings/sharepic.html.j2,sha256=qZkfEpd4CtKKMaSSVadqvNEgMRYLV-0X-pw5-nJvukk,678
79
79
  geo_activity_playground/webui/settings/templates/settings/strava.html.j2,sha256=FrXgT-m1PgvsQWo9kMKpk8QenKeifSDBCZFqKgsHRxQ,1827
@@ -104,11 +104,11 @@ geo_activity_playground/webui/tile/blueprint.py,sha256=cK0o2Z3BrLycgF9zw0F8s9qF-
104
104
  geo_activity_playground/webui/tile/controller.py,sha256=PISh4vKs27b-LxFfTARtr5RAwHFresA1Kw1MDcERSRU,1221
105
105
  geo_activity_playground/webui/upload/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
106
106
  geo_activity_playground/webui/upload/blueprint.py,sha256=xX9scEmleN_dL03jfhWRh5yI1WsFyhxUFiS_Ul2HWy4,1428
107
- geo_activity_playground/webui/upload/controller.py,sha256=disRtrlvPiqsIFt9UaAokgtRtXCvosg7bXkAnN_qaxk,4102
107
+ geo_activity_playground/webui/upload/controller.py,sha256=AUcDotTw-h30XgY5Te0kAqRfL7xXqK74iVO13g20pD0,4085
108
108
  geo_activity_playground/webui/upload/templates/upload/index.html.j2,sha256=I1Ix8tDS3YBdi-HdaNfjkzYXVVCjfUTe5PFTnap1ydc,775
109
109
  geo_activity_playground/webui/upload/templates/upload/reload.html.j2,sha256=YZWX5eDeNyqKJdQAywDBcU8DZBm22rRBbZqFjrFrCvQ,556
110
- geo_activity_playground-0.29.1.dist-info/LICENSE,sha256=4RpAwKO8bPkfXH2lnpeUW0eLkNWglyG4lbrLDU_MOwY,1070
111
- geo_activity_playground-0.29.1.dist-info/METADATA,sha256=O9NvI6x-QQvVw7XklVLmq2pkz2UFTTg9PnLwAK6KhWY,1612
112
- geo_activity_playground-0.29.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
113
- geo_activity_playground-0.29.1.dist-info/entry_points.txt,sha256=pbNlLI6IIZIp7nPYCfAtiSiz2oxJSCl7DODD6SPkLKk,81
114
- geo_activity_playground-0.29.1.dist-info/RECORD,,
110
+ geo_activity_playground-0.29.2.dist-info/LICENSE,sha256=4RpAwKO8bPkfXH2lnpeUW0eLkNWglyG4lbrLDU_MOwY,1070
111
+ geo_activity_playground-0.29.2.dist-info/METADATA,sha256=GNn0dY6lLwtyLfJ9PDljs1QeZi8Xaro-_ElwOZtv0zQ,1612
112
+ geo_activity_playground-0.29.2.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
113
+ geo_activity_playground-0.29.2.dist-info/entry_points.txt,sha256=pbNlLI6IIZIp7nPYCfAtiSiz2oxJSCl7DODD6SPkLKk,81
114
+ geo_activity_playground-0.29.2.dist-info/RECORD,,