udata 10.4.3.dev35617__py2.py3-none-any.whl → 10.4.3.dev35659__py2.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.

Potentially problematic release.


This version of udata might be problematic. Click here for more details.

@@ -17,6 +17,7 @@ from udata.core.dataservices.constants import (
17
17
  DATASERVICE_FORMATS,
18
18
  )
19
19
  from udata.core.dataset.models import Dataset
20
+ from udata.core.metrics.helpers import get_stock_metrics
20
21
  from udata.core.metrics.models import WithMetrics
21
22
  from udata.core.owned import Owned, OwnedQuerySet
22
23
  from udata.i18n import lazy_gettext as _
@@ -288,6 +289,7 @@ class Dataservice(Auditable, WithMetrics, Owned, db.Document):
288
289
  __metrics_keys__ = [
289
290
  "discussions",
290
291
  "followers",
292
+ "followers_by_months",
291
293
  "views",
292
294
  ]
293
295
 
@@ -313,6 +315,9 @@ class Dataservice(Auditable, WithMetrics, Owned, db.Document):
313
315
 
314
316
  def count_followers(self):
315
317
  self.metrics["followers"] = Follow.objects(until=None).followers(self).count()
318
+ self.metrics["followers_by_months"] = get_stock_metrics(
319
+ Follow.objects(following=self), date_label="since"
320
+ )
316
321
  self.save(signal_kwargs={"ignores": ["post_save"]})
317
322
 
318
323
 
@@ -20,6 +20,7 @@ from udata.api_fields import field
20
20
  from udata.app import cache
21
21
  from udata.core import storages
22
22
  from udata.core.activity.models import Auditable
23
+ from udata.core.metrics.helpers import get_stock_metrics
23
24
  from udata.core.owned import Owned, OwnedQuerySet
24
25
  from udata.frontend.markdown import mdstrip
25
26
  from udata.i18n import lazy_gettext as _
@@ -599,7 +600,9 @@ class Dataset(Auditable, WithMetrics, DatasetBadgeMixin, Owned, db.Document):
599
600
  __metrics_keys__ = [
600
601
  "discussions",
601
602
  "reuses",
603
+ "reuses_by_months",
602
604
  "followers",
605
+ "followers_by_months",
603
606
  "views",
604
607
  "resources_downloads",
605
608
  ]
@@ -1063,12 +1066,16 @@ class Dataset(Auditable, WithMetrics, DatasetBadgeMixin, Owned, db.Document):
1063
1066
  from udata.models import Reuse
1064
1067
 
1065
1068
  self.metrics["reuses"] = Reuse.objects(datasets=self).visible().count()
1069
+ self.metrics["reuses_by_months"] = get_stock_metrics(Reuse.objects(datasets=self).visible())
1066
1070
  self.save(signal_kwargs={"ignores": ["post_save"]})
1067
1071
 
1068
1072
  def count_followers(self):
1069
1073
  from udata.models import Follow
1070
1074
 
1071
1075
  self.metrics["followers"] = Follow.objects(until=None).followers(self).count()
1076
+ self.metrics["followers_by_months"] = get_stock_metrics(
1077
+ Follow.objects(following=self), date_label="since"
1078
+ )
1072
1079
  self.save(signal_kwargs={"ignores": ["post_save"]})
1073
1080
 
1074
1081
 
@@ -8,6 +8,7 @@ from werkzeug.utils import cached_property
8
8
  from udata.api_fields import field
9
9
  from udata.core.activity.models import Auditable
10
10
  from udata.core.badges.models import Badge, BadgeMixin, BadgesList
11
+ from udata.core.metrics.helpers import get_stock_metrics
11
12
  from udata.core.metrics.models import WithMetrics
12
13
  from udata.core.storages import avatars, default_image_basename
13
14
  from udata.frontend.markdown import mdstrip
@@ -161,9 +162,16 @@ class Organization(Auditable, WithMetrics, OrganizationBadgeMixin, db.Datetimed,
161
162
  return self.name or ""
162
163
 
163
164
  __metrics_keys__ = [
165
+ "dataservices",
166
+ "dataservices_by_months",
164
167
  "datasets",
168
+ "datasets_by_months",
169
+ "datasets_followers_by_months",
170
+ "datasets_reuses_by_months",
165
171
  "members",
166
172
  "reuses",
173
+ "reuses_by_months",
174
+ "reuses_followers_by_months",
167
175
  "dataservices",
168
176
  "followers",
169
177
  "views",
@@ -299,21 +307,40 @@ class Organization(Auditable, WithMetrics, OrganizationBadgeMixin, db.Datetimed,
299
307
  self.save(signal_kwargs={"ignores": ["post_save"]})
300
308
 
301
309
  def count_datasets(self):
302
- from udata.models import Dataset
310
+ from udata.models import Dataset, Follow, Reuse
303
311
 
304
312
  self.metrics["datasets"] = Dataset.objects(organization=self).visible().count()
313
+ self.metrics["datasets_by_months"] = get_stock_metrics(
314
+ Dataset.objects(organization=self).visible(), date_label="created_at_internal"
315
+ )
316
+ self.metrics["datasets_followers_by_months"] = get_stock_metrics(
317
+ Follow.objects(following__in=Dataset.objects(organization=self)), date_label="since"
318
+ )
319
+ self.metrics["datasets_reuses_by_months"] = get_stock_metrics(
320
+ Reuse.objects(datasets__in=Dataset.objects(organization=self)).visible()
321
+ )
322
+
305
323
  self.save(signal_kwargs={"ignores": ["post_save"]})
306
324
 
307
325
  def count_reuses(self):
308
- from udata.models import Reuse
326
+ from udata.models import Follow, Reuse
309
327
 
310
328
  self.metrics["reuses"] = Reuse.objects(organization=self).visible().count()
329
+ self.metrics["reuses_by_months"] = get_stock_metrics(
330
+ Reuse.objects(organization=self).visible()
331
+ )
332
+ self.metrics["reuses_followers_by_months"] = get_stock_metrics(
333
+ Follow.objects(following__in=Reuse.objects(organization=self)), date_label="since"
334
+ )
311
335
  self.save(signal_kwargs={"ignores": ["post_save"]})
312
336
 
313
337
  def count_dataservices(self):
314
338
  from udata.models import Dataservice
315
339
 
316
340
  self.metrics["dataservices"] = Dataservice.objects(organization=self).visible().count()
341
+ self.metrics["dataservices_by_months"] = get_stock_metrics(
342
+ Dataservice.objects(organization=self).visible(), date_label="created_at"
343
+ )
317
344
  self.save(signal_kwargs={"ignores": ["post_save"]})
318
345
 
319
346
  def count_followers(self):
@@ -5,6 +5,7 @@ from werkzeug.utils import cached_property
5
5
  from udata.api_fields import field, function_field, generate_fields
6
6
  from udata.core.activity.models import Auditable
7
7
  from udata.core.dataset.api_fields import dataset_fields
8
+ from udata.core.metrics.helpers import get_stock_metrics
8
9
  from udata.core.owned import Owned, OwnedQuerySet
9
10
  from udata.core.reuse.api_fields import BIGGEST_IMAGE_SIZE, reuse_permissions_fields
10
11
  from udata.core.storages import default_image_basename, images
@@ -151,6 +152,7 @@ class Reuse(db.Datetimed, Auditable, WithMetrics, ReuseBadgeMixin, Owned, db.Doc
151
152
  "discussions",
152
153
  "datasets",
153
154
  "followers",
155
+ "followers_by_months",
154
156
  "views",
155
157
  ]
156
158
 
@@ -299,6 +301,9 @@ class Reuse(db.Datetimed, Auditable, WithMetrics, ReuseBadgeMixin, Owned, db.Doc
299
301
  from udata.models import Follow
300
302
 
301
303
  self.metrics["followers"] = Follow.objects(until=None).followers(self).count()
304
+ self.metrics["followers_by_months"] = get_stock_metrics(
305
+ Follow.objects(following=self), date_label="since"
306
+ )
302
307
  self.save(signal_kwargs={"ignores": ["post_save"]})
303
308
 
304
309
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: udata
3
- Version: 10.4.3.dev35617
3
+ Version: 10.4.3.dev35659
4
4
  Summary: Open data portal
5
5
  Home-page: https://github.com/opendatateam/udata
6
6
  Author: Opendata Team
@@ -145,6 +145,7 @@ It is collectively taken care of by members of the
145
145
  - Add access audience to dataservices [#3334](https://github.com/opendatateam/udata/pull/3334)
146
146
  - Expose permissions to cdata [#3336](https://github.com/opendatateam/udata/pull/3336)
147
147
  - Add endpoint to get datasets followed by user [#3337](https://github.com/opendatateam/udata/pull/3337)
148
+ - Add monthly metrics to datasets, dataservices, reuses and organizations [#3342](https://github.com/opendatateam/udata/pull/3342)
148
149
 
149
150
  ## 10.4.2 (2025-06-05)
150
151
 
@@ -87,7 +87,7 @@ udata/core/dataservices/apiv2.py,sha256=pd4UWF6m7pQ5nmBRFmeiDyedhZSngz211to6qTsc
87
87
  udata/core/dataservices/constants.py,sha256=SxetyqvbWQlb-T9Bqn7mdfzV3vS-is7s56rzmGzTXY0,1029
88
88
  udata/core/dataservices/csv.py,sha256=pcNIeGaCzBMMna3n3YqHjsoXzfLtg_ITtDmdKb9svDc,1053
89
89
  udata/core/dataservices/factories.py,sha256=LDk8vvG0zhW8J-ZX5LoJQDU13pqeIyjQ05muuMro_eA,876
90
- udata/core/dataservices/models.py,sha256=WFx5_Nfu2RM9Sike_NH4LVQ76_hEBsgIea_wXVjj2ek,11329
90
+ udata/core/dataservices/models.py,sha256=O6XnktYDFV55TaysAqhNlPcCjkZWQvBZt9atND-9ZD4,11555
91
91
  udata/core/dataservices/permissions.py,sha256=98zM_R4v2ZtRubflB7ajaVQz-DVc-pZBMgtKUYy34oI,169
92
92
  udata/core/dataservices/rdf.py,sha256=P-lSAKKy0Kbcfw_tGjl25DuqX77Sg4qZZYJtb9pzcOc,7847
93
93
  udata/core/dataservices/search.py,sha256=Wsr51jU14D9NrNP3ELTc8swwtFb-dakgc55cDrtt3No,4639
@@ -105,7 +105,7 @@ udata/core/dataset/events.py,sha256=bSM0nFEX14r4JHc-bAM-7OOuD3JAxUIpw9GgXbOsUyw,
105
105
  udata/core/dataset/exceptions.py,sha256=uKiayLSpSzsnLvClObS6hOO0qXEqvURKN7_w8eimQNU,498
106
106
  udata/core/dataset/factories.py,sha256=fRDWDlybR_ud4pDs1-ntWuYHKtV9LMHeBOBp2SmTT6M,9006
107
107
  udata/core/dataset/forms.py,sha256=7KUxuFcEGT0MUe0cZCiZtsnZhvGgvEd68pe13NgeSMI,6292
108
- udata/core/dataset/models.py,sha256=0tSKkuLwJ2BFyE7D6A8Hmx9BbDDtwstVp7mkCa_0lnI,41698
108
+ udata/core/dataset/models.py,sha256=nl4nm48tFhKV_pT2AjKjvPhnjTtxjSmk_jIO-PtNcjw,42053
109
109
  udata/core/dataset/permissions.py,sha256=zXQ6kU-Ni3Pl5tDtat-ZPupug9InsNeCN7xRLc2Vcrc,1097
110
110
  udata/core/dataset/preview.py,sha256=IwCqiNTjjXbtA_SSKF52pwnzKKEz0GyYM95QNn2Dkog,2561
111
111
  udata/core/dataset/rdf.py,sha256=6aqoZajpmA2nciZsG1pGeJr0HKgdxjtuGWvk8xXjfUI,31810
@@ -154,7 +154,7 @@ udata/core/organization/csv.py,sha256=YzbdD9Y333QY2j9_sxdmRjAlHg1aGV-oW-dvZdvajV
154
154
  udata/core/organization/factories.py,sha256=g8ubBcz79xbjvpunZ02IDOakFg1KE6cXjNkE9vFyFAc,624
155
155
  udata/core/organization/forms.py,sha256=tscDb1_yOpbTx3ahl8ttA7oDkX9jIyzLc4gOf6WbN3s,3552
156
156
  udata/core/organization/metrics.py,sha256=90romzr-FhnPKh-6UHBJ1Af2loDa4-8I1iZEgztA160,1062
157
- udata/core/organization/models.py,sha256=QFRE8_4caiE34g5t2bNJ_GKk4WCVlobnr5_HZVf2pqw,9616
157
+ udata/core/organization/models.py,sha256=Q_yNa4Nm4KFshRwmP13wJgYOP6Sm1-plxItotu4TXww,10908
158
158
  udata/core/organization/notifications.py,sha256=i_36-l2y7fOGmnBmr5NDWmGGmrGRaCWbU-6XS4c2wQs,917
159
159
  udata/core/organization/permissions.py,sha256=GD-9TMtRppVCPaC1ysXYrONvGJV-ArzAOXm2XMKf9yo,1256
160
160
  udata/core/organization/rdf.py,sha256=TF2c85MHAu-TRiHNLxqV_Pw5z6sCgZrNszF9SYspQpk,1936
@@ -183,7 +183,7 @@ udata/core/reuse/constants.py,sha256=JgDBrjOKSt9q0auv9rjzbGsch83H-Oi8YXAKeI5hO4o
183
183
  udata/core/reuse/csv.py,sha256=hCvKYzbL6kiUwzHkd9jrexdeACBj5k7XycKaLZesQeo,892
184
184
  udata/core/reuse/factories.py,sha256=GrQqYTIvwQrwkvJrbTr38-2faFW_PC99gn3yOVpgFec,850
185
185
  udata/core/reuse/metrics.py,sha256=sVh7BlW3OKRvFDHFyD4pPUV91jOOhj8qeWbBkLPn5Gg,176
186
- udata/core/reuse/models.py,sha256=0pLzXfJbh8TdKzpxDI-uNI8ZugD3Ux4_rYs9CHFcTT0,8841
186
+ udata/core/reuse/models.py,sha256=16kKkoGX9Y0AZzmyRbl-sCuWRA7C4R8DrIFj6ByBnH8,9067
187
187
  udata/core/reuse/permissions.py,sha256=j-ancS7gvLl5vJu0TNYqpYD-2So-UzoDE4IHLxRoMGg,621
188
188
  udata/core/reuse/search.py,sha256=y1DwXYkBMBwuhn62CULkU1NNo89IYp0Ae7U01jcnjBY,3137
189
189
  udata/core/reuse/signals.py,sha256=nDrEUpYKN0AdYiEbrR0z3nzXzjaRcD8SAMutwIDsQPM,155
@@ -730,9 +730,9 @@ udata/translations/pt/LC_MESSAGES/udata.mo,sha256=ViV14tUmjSydHS0TWG_mFikKQfyUaT
730
730
  udata/translations/pt/LC_MESSAGES/udata.po,sha256=rzAD_MVoV54TmN3w1ECz3H2Ru5pM7hWMVH03SkY28Q8,47250
731
731
  udata/translations/sr/LC_MESSAGES/udata.mo,sha256=EHX1_D-Uglj38832G7BrA0QC5IuY3p8dKqi9T0DgPmE,29169
732
732
  udata/translations/sr/LC_MESSAGES/udata.po,sha256=3PMnbVhKVJh6Q8ABi1ZTZ8Dcf-sMjngLJZqLbonJoec,54225
733
- udata-10.4.3.dev35617.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
734
- udata-10.4.3.dev35617.dist-info/METADATA,sha256=Ut-zMnL9UyEL0TwkWdfvPF4vvcuqmirNR3ZfF3ZOl14,147972
735
- udata-10.4.3.dev35617.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
736
- udata-10.4.3.dev35617.dist-info/entry_points.txt,sha256=ETvkR4r6G1duBsh_V_fGWENQy17GTFuobi95MYBAl1A,498
737
- udata-10.4.3.dev35617.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
738
- udata-10.4.3.dev35617.dist-info/RECORD,,
733
+ udata-10.4.3.dev35659.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
734
+ udata-10.4.3.dev35659.dist-info/METADATA,sha256=yzXc59Ktdc0kBK46_fJWAE0-A5_D3x0GsuMwk4TEOGc,148103
735
+ udata-10.4.3.dev35659.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
736
+ udata-10.4.3.dev35659.dist-info/entry_points.txt,sha256=ETvkR4r6G1duBsh_V_fGWENQy17GTFuobi95MYBAl1A,498
737
+ udata-10.4.3.dev35659.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
738
+ udata-10.4.3.dev35659.dist-info/RECORD,,