geo-activity-playground 0.43.0__py3-none-any.whl → 0.43.1__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.
@@ -8,8 +8,6 @@ import pandas as pd
8
8
  def some(value: Any) -> Optional[Any]:
9
9
  if value is None:
10
10
  return None
11
- elif np.isnan(value):
12
- return None
13
11
  elif pd.isna(value):
14
12
  return None
15
13
  else:
@@ -1,4 +1,5 @@
1
1
  import numpy as np
2
+ import pandas as pd
2
3
 
3
4
  from .missing_values import some
4
5
 
@@ -17,3 +18,7 @@ def test_float() -> None:
17
18
 
18
19
  def test_integer() -> None:
19
20
  assert some(1) == 1
21
+
22
+
23
+ def test_nat() -> None:
24
+ assert some(pd.NaT) == None
@@ -8,6 +8,7 @@ import secrets
8
8
  import shutil
9
9
  import urllib.parse
10
10
 
11
+ import pandas as pd
11
12
  import sqlalchemy
12
13
  from flask import Flask
13
14
  from flask import request
@@ -105,15 +106,25 @@ def web_ui_main(
105
106
 
106
107
  @app.template_filter()
107
108
  def dt(value: datetime.datetime):
108
- return value.strftime("%Y-%m-%d %H:%M")
109
+ if pd.isna(value):
110
+ return "—"
111
+ else:
112
+ return value.strftime("%Y-%m-%d %H:%M")
109
113
 
110
114
  @app.template_filter()
111
115
  def td(v: datetime.timedelta):
112
- seconds = v.total_seconds()
113
- h = int(seconds // 3600)
114
- m = int(seconds // 60 % 60)
115
- s = int(seconds // 1 % 60)
116
- return f"{h}:{m:02d}:{s:02d}"
116
+ if pd.isna(v):
117
+ return "—"
118
+ else:
119
+ seconds = v.total_seconds()
120
+ h = int(seconds // 3600)
121
+ m = int(seconds // 60 % 60)
122
+ s = int(seconds // 1 % 60)
123
+ return f"{h}:{m:02d}:{s:02d}"
124
+
125
+ @app.template_filter()
126
+ def isna(value):
127
+ return pd.isna(value)
117
128
 
118
129
  authenticator = Authenticator(config_accessor())
119
130
  search_query_history = SearchQueryHistory(config_accessor, authenticator)
@@ -111,11 +111,14 @@ def make_activity_blueprint(
111
111
  == activity.id
112
112
  )
113
113
  for zoom in sorted(config.explorer_zoom_levels)
114
+ if not tile_visit_accessor.tile_state["tile_history"][zoom].empty
114
115
  }
115
116
 
116
117
  new_tiles_geojson = {}
117
118
  new_tiles_per_zoom = {}
118
119
  for zoom in sorted(config.explorer_zoom_levels):
120
+ if tile_visit_accessor.tile_state["tile_history"][zoom].empty:
121
+ continue
119
122
  new_tiles = tile_visit_accessor.tile_state["tile_history"][zoom].loc[
120
123
  tile_visit_accessor.tile_state["tile_history"][zoom]["activity_id"]
121
124
  == activity.id
@@ -141,25 +144,32 @@ def make_activity_blueprint(
141
144
 
142
145
  context = {
143
146
  "activity": activity,
144
- "line_json": line_json,
145
- "distance_time_plot": distance_time_plot(time_series),
146
- "color_line_geojson": make_geojson_color_line(
147
- time_series, line_color_column
148
- ),
149
- "speed_time_plot": speed_time_plot(time_series),
150
- "speed_distribution_plot": speed_distribution_plot(time_series),
147
+ "color_line_geojson": line_json,
151
148
  "similar_activites": similar_activities,
152
- "line_color_bar": make_color_bar(
153
- time_series[line_color_column],
154
- line_color_columns_avail[line_color_column].format,
155
- ),
156
- "date": activity.start.date(),
157
- "time": activity.start.time(),
158
149
  "new_tiles": new_tiles_per_zoom,
159
150
  "new_tiles_geojson": new_tiles_geojson,
160
- "line_color_column": line_color_column,
161
- "line_color_columns_avail": line_color_columns_avail,
162
151
  }
152
+
153
+ if not pd.isna(time_series["time"]).all():
154
+ context.update(
155
+ {
156
+ "distance_time_plot": distance_time_plot(time_series),
157
+ "color_line_geojson": make_geojson_color_line(
158
+ time_series, line_color_column
159
+ ),
160
+ "speed_time_plot": speed_time_plot(time_series),
161
+ "speed_distribution_plot": speed_distribution_plot(time_series),
162
+ "line_color_bar": make_color_bar(
163
+ time_series[line_color_column],
164
+ line_color_columns_avail[line_color_column].format,
165
+ ),
166
+ "date": activity.start.date(),
167
+ "time": activity.start.time(),
168
+ "line_color_column": line_color_column,
169
+ "line_color_columns_avail": line_color_columns_avail,
170
+ }
171
+ )
172
+
163
173
  if (
164
174
  heart_zones := _extract_heart_rate_zones(
165
175
  time_series, heart_rate_zone_computer
@@ -37,7 +37,10 @@ def register_entry_views(
37
37
 
38
38
  context["latest_activities"] = collections.defaultdict(list)
39
39
  for activity in DB.session.scalars(
40
- sqlalchemy.select(Activity).order_by(Activity.start.desc()).limit(100)
40
+ sqlalchemy.select(Activity)
41
+ .where(Activity.start.is_not(None))
42
+ .order_by(Activity.start.desc())
43
+ .limit(100)
41
44
  ):
42
45
  context["latest_activities"][activity.start.date()].append(
43
46
  {
@@ -1,6 +1,7 @@
1
1
  import os
2
2
  import pathlib
3
3
 
4
+ import sqlalchemy
4
5
  from flask import Blueprint
5
6
  from flask import flash
6
7
  from flask import redirect
@@ -10,7 +11,10 @@ from flask import url_for
10
11
 
11
12
  from ...core.activities import ActivityRepository
12
13
  from ...core.config import Config
14
+ from ...core.datamodel import DB
15
+ from ...core.datamodel import Kind
13
16
  from ...core.enrichment import populate_database_from_extracted
17
+ from ...core.tasks import work_tracker_path
14
18
  from ...explorer.tile_visits import compute_tile_evolution
15
19
  from ...explorer.tile_visits import compute_tile_visits_new
16
20
  from ...explorer.tile_visits import TileVisitAccessor
@@ -114,6 +118,13 @@ def scan_for_activities(
114
118
  populate_database_from_extracted(config)
115
119
 
116
120
  if len(repository) > 0:
121
+ kinds = DB.session.scalars(sqlalchemy.select(Kind)).all()
122
+ if all(kind.consider_for_achievements == False for kind in kinds):
123
+ for kind in kinds:
124
+ kind.consider_for_achievements = True
125
+ DB.session.commit()
126
+ tile_visit_accessor.reset()
127
+ work_tracker_path("tile-state").unlink()
117
128
  compute_tile_visits_new(repository, tile_visit_accessor)
118
129
  compute_tile_evolution(tile_visit_accessor.tile_state, config)
119
130
  tile_visit_accessor.save()
@@ -94,7 +94,7 @@
94
94
  }).addTo(map);
95
95
 
96
96
  let geojson = L.geoJSON({{ color_line_geojson| safe }}, {
97
- style: function (feature) { return { color: feature.properties.color } }
97
+ style: function (feature) { return { color: feature.properties.color ? feature.properties.color : 'red' } }
98
98
  }).addTo(map)
99
99
  map.fitBounds(geojson.getBounds());
100
100
 
@@ -134,6 +134,7 @@
134
134
  }
135
135
  </style>
136
136
 
137
+ {% if line_color_bar %}
137
138
  <div>
138
139
  {% for value, color in line_color_bar.colors %}
139
140
  <span class="colorbar" style="width: 15px; background-color: {{ color }}">{{ value }}</span>
@@ -153,6 +154,7 @@
153
154
  </select>
154
155
  </form>
155
156
  </div>
157
+ {% endif %}
156
158
  </div>
157
159
  </div>
158
160
 
@@ -31,7 +31,11 @@
31
31
  </td>
32
32
  <td>{{ '%.1f' % activity["distance_km"] }} km</td>
33
33
  <td>{{ activity.elapsed_time|td }}</td>
34
- <td>{{ activity.average_speed_moving_kmh|round(1) }}</td>
34
+ <td>
35
+ {% if not activity.average_speed_moving_kmh|isna %}
36
+ {{ activity.average_speed_moving_kmh|round(1) }}
37
+ {% endif %}
38
+ </td>
35
39
  <td>{{ activity["equipment"] }}</td>
36
40
  <td>{{ activity['kind'] }}</td>
37
41
  </tr>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: geo-activity-playground
3
- Version: 0.43.0
3
+ Version: 0.43.1
4
4
  Summary: Analysis of geo data activities like rides, runs or hikes.
5
5
  License: MIT
6
6
  Author: Martin Ueding
@@ -20,7 +20,7 @@ geo_activity_playground/core/datamodel.py,sha256=fBq2D9N8wjWVSSt0bLqxIOBLouRySO7
20
20
  geo_activity_playground/core/enrichment.py,sha256=Hs1lB__s5TwPLOWPaaheOJeJIBQFUa68NTbCI5M5wWI,7640
21
21
  geo_activity_playground/core/heart_rate.py,sha256=-S3WAhS7AOywrw_Lk5jfuo_fu6zvZQ1VtjwEKSycWpU,1542
22
22
  geo_activity_playground/core/meta_search.py,sha256=Ygh2uySZ9_q-oddU_2vXfzGfXV9rfTyeQFBT7sIiXCI,6657
23
- geo_activity_playground/core/missing_values.py,sha256=STTNF3L_Zcl3v4QhWaqfPDtsxDu_YBvFjZyugb72XeA,296
23
+ geo_activity_playground/core/missing_values.py,sha256=HjonaLV0PFMICnuMrbdUNnK9uy_8PBh_RxI5GuEMQK0,250
24
24
  geo_activity_playground/core/parametric_plot.py,sha256=IefPc6lwthxowvjUDA5wu23oBSw9jq399l04gSaNrOQ,3880
25
25
  geo_activity_playground/core/paths.py,sha256=CLQYA_6ouxHJYgrt_uGp-9sO7MG60prdD6cvVwhA_2g,2670
26
26
  geo_activity_playground/core/privacy_zones.py,sha256=4TumHsVUN1uW6RG3ArqTXDykPVipF98DCxVBe7YNdO8,512
@@ -30,7 +30,7 @@ geo_activity_playground/core/summary_stats.py,sha256=v5FtWnE1imDF5axI6asVN55wCrl
30
30
  geo_activity_playground/core/tasks.py,sha256=-_9cxekoHSWzCW4XblNeqrwi2tTqr5AE7_-p8fdqhwc,2886
31
31
  geo_activity_playground/core/test_datamodel.py,sha256=-VrGHgx5Z3MSQPqHGmmm7atRJYbg5y_ukvRHKxk22PI,569
32
32
  geo_activity_playground/core/test_meta_search.py,sha256=zhuD343Xce-4Fkznw81DHQ7pK5eyX5UbcyCHuYRKsr8,3091
33
- geo_activity_playground/core/test_missing_values.py,sha256=zlyrKHLCzUSBdktiy87oKz7_bySpfohVPxG1HRGRHqw,278
33
+ geo_activity_playground/core/test_missing_values.py,sha256=7yvg6dUu7p8PR_rxUxgFaJCrGzfYUcF8Zf6y7bCEYKw,356
34
34
  geo_activity_playground/core/test_summary_stats.py,sha256=qH_45mPRFD2H-Rr0Ku-RYc67vhC7qKxbPr7J2F36uV8,3081
35
35
  geo_activity_playground/core/test_tiles.py,sha256=zce1FxNfsSpOQt66jMehdQRVoNdl-oiFydx6iVBHZXM,764
36
36
  geo_activity_playground/core/test_time_conversion.py,sha256=Sh6nZA3uCTOdZTZa3yOijtR0m74QtZu2mcWXsDNnyQI,984
@@ -51,15 +51,15 @@ geo_activity_playground/importers/test_csv_parser.py,sha256=nOTVTdlzIY0TDcbWp7xN
51
51
  geo_activity_playground/importers/test_directory.py,sha256=_fn_-y98ZyElbG0BRxAmGFdtGobUShPU86SdEOpuv-A,691
52
52
  geo_activity_playground/importers/test_strava_api.py,sha256=7b8bl5Rh2BctCmvTPEhCadxtUOq3mfzuadD6F5XxRio,398
53
53
  geo_activity_playground/webui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
- geo_activity_playground/webui/app.py,sha256=LEKALJE-856bQE-79MVfsqGHr5G68IIyHL3cmA6eZyU,7888
54
+ geo_activity_playground/webui/app.py,sha256=SyRztm6P0pQuq3Vn4g7gFwg1pwyZsElVNZOeljN5jEY,8139
55
55
  geo_activity_playground/webui/authenticator.py,sha256=jtQqvpVHa_eLTAulmvvJgDRoCWOEege49G9zn3MfYk8,1394
56
56
  geo_activity_playground/webui/blueprints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
- geo_activity_playground/webui/blueprints/activity_blueprint.py,sha256=NDFw5v765uGpaX2kMIH09EALsZmYYLSJRkrn7bq_Wvo,25258
57
+ geo_activity_playground/webui/blueprints/activity_blueprint.py,sha256=QRkSPDJfBNRJn9UHchQm_Rg_b_Or0AqxUzNNzOxTx30,25688
58
58
  geo_activity_playground/webui/blueprints/auth_blueprint.py,sha256=_VZeP3VN626BoOOZUkNVnuw9v-cEOrkHz5lhFPmxqMY,784
59
59
  geo_activity_playground/webui/blueprints/bubble_chart_blueprint.py,sha256=xESHzYxlbhz4oNDuxV0A70eVKpFwz84pYC3q_YVZZg8,2812
60
60
  geo_activity_playground/webui/blueprints/calendar_blueprint.py,sha256=4EIBZ8rdXEu3tbl1faVlRwHb8Qp0JuMc3eyxwMkq6g8,2848
61
61
  geo_activity_playground/webui/blueprints/eddington_blueprints.py,sha256=Umb2wtKmAXuQZEXt0d985qMILtvqc3vxj_yXymnzmUs,8702
62
- geo_activity_playground/webui/blueprints/entry_views.py,sha256=RK2ypZO75DhweGjoKK7pG699urDB7twFkWaS2CyWmtw,2824
62
+ geo_activity_playground/webui/blueprints/entry_views.py,sha256=9OuaxbA-J5D2Qn2OSSIjIb-eRTxXY8i1LhlfUk1W60Q,2910
63
63
  geo_activity_playground/webui/blueprints/equipment_blueprint.py,sha256=juQ5L2BlrECb00LBbiY2yc0b8W_B9Y3fPwtbiaRfgpo,5634
64
64
  geo_activity_playground/webui/blueprints/explorer_blueprint.py,sha256=6w6seOCVf7Z5y4BBtgVwoZ4t8qastnm7ViX8Bs_zj2w,15566
65
65
  geo_activity_playground/webui/blueprints/heatmap_blueprint.py,sha256=iHI5YJYhX7ZOlzTgzl2efIRDzt3UMYCx7X4-LVd0MWk,8702
@@ -70,7 +70,7 @@ geo_activity_playground/webui/blueprints/settings_blueprint.py,sha256=p_17BC2ZQy
70
70
  geo_activity_playground/webui/blueprints/square_planner_blueprint.py,sha256=xVaxJxmt8Dysl3UL9f2y__LVLtTH2Np1Ust4OSXKRAk,4746
71
71
  geo_activity_playground/webui/blueprints/summary_blueprint.py,sha256=rK4LGR2Rpioy4wSqNYuyRn4WxaWeBLensJ3PmAd-ouY,11469
72
72
  geo_activity_playground/webui/blueprints/tile_blueprint.py,sha256=YzZf9OrNdjhc1_j4MtO1DMcw1uCv29ueNsYd-mWqgbg,837
73
- geo_activity_playground/webui/blueprints/upload_blueprint.py,sha256=_VeGu08vlRZlRn5J4t7VdBk2TTW5GXB4JUcge9mbX9Y,4111
73
+ geo_activity_playground/webui/blueprints/upload_blueprint.py,sha256=4ZCPZiaO3zAMPeFHal-4mmMyDSW2a5amOXtYtKVpOxw,4592
74
74
  geo_activity_playground/webui/columns.py,sha256=hSW8bFVKRUMBlWZYAN-tZ_tfED3VDQK75e4Zzw7_jZ0,642
75
75
  geo_activity_playground/webui/flasher.py,sha256=Covc1D9cO_jjokRWnvyiXCc2tfp3aZ8XkNqFdA1AXtk,500
76
76
  geo_activity_playground/webui/plot_util.py,sha256=5Uesjj-xcMskQX2z9viDZYHSxLGrH2a5dHA1ogsJW9U,261
@@ -113,7 +113,7 @@ geo_activity_playground/webui/templates/activity/day.html.j2,sha256=CHEvxlZralCm
113
113
  geo_activity_playground/webui/templates/activity/edit.html.j2,sha256=r979JPqaZi_2ymTykxpkjdpw0D2tsB9VJaf7OaGPaME,1961
114
114
  geo_activity_playground/webui/templates/activity/lines.html.j2,sha256=_ZDg1ruW-9UMJfOudy1-uY_-IcSSaagq7tPCih5Bb8g,1079
115
115
  geo_activity_playground/webui/templates/activity/name.html.j2,sha256=7Wbh3IrVL5lMRve467H0P10Shn5FzGpaXLhV0H-X4Hk,2725
116
- geo_activity_playground/webui/templates/activity/show.html.j2,sha256=FcZajTHRGpWLtV6nes2KjyhvBS5wsc_-WH8m-SCWEAA,10578
116
+ geo_activity_playground/webui/templates/activity/show.html.j2,sha256=uSTjr0hm8tjBOWb71xKReKuUsVv_5PaoKaqdYUe1noI,10665
117
117
  geo_activity_playground/webui/templates/activity/trim.html.j2,sha256=3oAXQab6QqWjGBC9KCvWNOVn8uRmxoDLj3hx_O63TXc,1836
118
118
  geo_activity_playground/webui/templates/auth/index.html.j2,sha256=ILQ5HvTEYc3OrtOAIFt1VrqWorVD70V9DC342znmP70,579
119
119
  geo_activity_playground/webui/templates/bubble_chart/index.html.j2,sha256=yd7lWjtxxVmJZqCiXb0Y1gMEOQ7LQYJXEdpE7JB1OZY,1616
@@ -132,7 +132,7 @@ geo_activity_playground/webui/templates/photo/map.html.j2,sha256=MWhqt5Q8ExiRhgx
132
132
  geo_activity_playground/webui/templates/photo/new.html.j2,sha256=GGLejO4ap6ZMe54jZP39ktSLkdw5j67bf5PTlHEK7qc,383
133
133
  geo_activity_playground/webui/templates/plot_builder/edit.html.j2,sha256=x5Ki425me3HY6CcBQ37le9g8rCpbOxFVkdr0N_L84-g,2230
134
134
  geo_activity_playground/webui/templates/plot_builder/index.html.j2,sha256=fBuGLT2HIwlgz5eGeKXOdIDqzDSQoY99w-hyt_0JP-w,832
135
- geo_activity_playground/webui/templates/search/index.html.j2,sha256=7W74ecprIWGYZ2-6xFIK_k6_mf-GRyRHNzE3ZjhWDqU,1192
135
+ geo_activity_playground/webui/templates/search/index.html.j2,sha256=tZ2RwiaC1cLCLfcxbDvpnLSjPeqnTkByAT6ncVitnLw,1318
136
136
  geo_activity_playground/webui/templates/search_form.html.j2,sha256=QL0inDTaEHPxoQGs3EB19bD0jAMnUkOrb_r5OoQn7JU,8251
137
137
  geo_activity_playground/webui/templates/settings/admin-password.html.j2,sha256=VYwddpObD1RpeTH5Dm4y7VtmT7kwURDCIjxyzJeq08c,495
138
138
  geo_activity_playground/webui/templates/settings/color-schemes.html.j2,sha256=iR91Wxd2_TMuIo9dBDZBrWSUGHNwTwzC6O8oNH-XBt4,1653
@@ -152,8 +152,8 @@ geo_activity_playground/webui/templates/square_planner/index.html.j2,sha256=-OnY
152
152
  geo_activity_playground/webui/templates/summary/index.html.j2,sha256=soGpTK-pD81YBlMWNWLnkWeEmVIbI5JwmGZQUN2c3DI,9151
153
153
  geo_activity_playground/webui/templates/upload/index.html.j2,sha256=I1Ix8tDS3YBdi-HdaNfjkzYXVVCjfUTe5PFTnap1ydc,775
154
154
  geo_activity_playground/webui/templates/upload/reload.html.j2,sha256=YZWX5eDeNyqKJdQAywDBcU8DZBm22rRBbZqFjrFrCvQ,556
155
- geo_activity_playground-0.43.0.dist-info/LICENSE,sha256=4RpAwKO8bPkfXH2lnpeUW0eLkNWglyG4lbrLDU_MOwY,1070
156
- geo_activity_playground-0.43.0.dist-info/METADATA,sha256=KhD9a5T2Tr9eRYK2UjvQK2wd5o-zbtBjpswTzN63RKo,1850
157
- geo_activity_playground-0.43.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
158
- geo_activity_playground-0.43.0.dist-info/entry_points.txt,sha256=pbNlLI6IIZIp7nPYCfAtiSiz2oxJSCl7DODD6SPkLKk,81
159
- geo_activity_playground-0.43.0.dist-info/RECORD,,
155
+ geo_activity_playground-0.43.1.dist-info/LICENSE,sha256=4RpAwKO8bPkfXH2lnpeUW0eLkNWglyG4lbrLDU_MOwY,1070
156
+ geo_activity_playground-0.43.1.dist-info/METADATA,sha256=cD_X2yhW8FOAo1wI7PzNahmKhm2nCHE4LXDKH4eltVo,1850
157
+ geo_activity_playground-0.43.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
158
+ geo_activity_playground-0.43.1.dist-info/entry_points.txt,sha256=pbNlLI6IIZIp7nPYCfAtiSiz2oxJSCl7DODD6SPkLKk,81
159
+ geo_activity_playground-0.43.1.dist-info/RECORD,,