goodmap 1.1.1__tar.gz → 1.1.2__tar.gz
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.
- {goodmap-1.1.1 → goodmap-1.1.2}/PKG-INFO +6 -1
- {goodmap-1.1.1 → goodmap-1.1.2}/goodmap/core_api.py +2 -7
- {goodmap-1.1.1 → goodmap-1.1.2}/goodmap/db.py +139 -0
- {goodmap-1.1.1 → goodmap-1.1.2}/pyproject.toml +24 -2
- {goodmap-1.1.1 → goodmap-1.1.2}/LICENSE.md +0 -0
- {goodmap-1.1.1 → goodmap-1.1.2}/README.md +0 -0
- {goodmap-1.1.1 → goodmap-1.1.2}/goodmap/__init__.py +0 -0
- {goodmap-1.1.1 → goodmap-1.1.2}/goodmap/config.py +0 -0
- {goodmap-1.1.1 → goodmap-1.1.2}/goodmap/core.py +0 -0
- {goodmap-1.1.1 → goodmap-1.1.2}/goodmap/data_models/location.py +0 -0
- {goodmap-1.1.1 → goodmap-1.1.2}/goodmap/data_validator.py +0 -0
- {goodmap-1.1.1 → goodmap-1.1.2}/goodmap/formatter.py +0 -0
- {goodmap-1.1.1 → goodmap-1.1.2}/goodmap/goodmap.py +0 -0
- {goodmap-1.1.1 → goodmap-1.1.2}/goodmap/templates/goodmap-admin.html +0 -0
- {goodmap-1.1.1 → goodmap-1.1.2}/goodmap/templates/map.html +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: goodmap
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.2
|
|
4
4
|
Summary: Map engine to serve all the people :)
|
|
5
5
|
License-File: LICENSE.md
|
|
6
6
|
Author: Krzysztof Kolodzinski
|
|
@@ -12,6 +12,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.13
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Provides-Extra: docs
|
|
15
16
|
Requires-Dist: Babel (>=2.10.3,<3.0.0)
|
|
16
17
|
Requires-Dist: Flask (==3.0.3)
|
|
17
18
|
Requires-Dist: Flask-Babel (>=4.0.0,<5.0.0)
|
|
@@ -24,8 +25,12 @@ Requires-Dist: google-cloud-storage (>=2.7.0,<3.0.0)
|
|
|
24
25
|
Requires-Dist: gql (>=3.4.0,<4.0.0)
|
|
25
26
|
Requires-Dist: gunicorn (>=20.1.0,<21.0.0)
|
|
26
27
|
Requires-Dist: humanize (>=4.6.0,<5.0.0)
|
|
28
|
+
Requires-Dist: myst-parser (>=4.0.0,<5.0.0) ; extra == "docs"
|
|
27
29
|
Requires-Dist: platzky (>=1.0.0,<2.0.0)
|
|
28
30
|
Requires-Dist: pydantic (>=2.7.1,<3.0.0)
|
|
31
|
+
Requires-Dist: sphinx (>=8.0.0,<9.0.0) ; extra == "docs"
|
|
32
|
+
Requires-Dist: sphinx-rtd-theme (>=3.0.0,<4.0.0) ; extra == "docs"
|
|
33
|
+
Requires-Dist: tomli (>=2.0.0,<3.0.0) ; extra == "docs"
|
|
29
34
|
Description-Content-Type: text/markdown
|
|
30
35
|
|
|
31
36
|

|
|
@@ -117,13 +117,8 @@ def core_pages(
|
|
|
117
117
|
Shows a single location with all data
|
|
118
118
|
"""
|
|
119
119
|
location = database.get_location(location_id)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
# e.g. db.get_visible_data() and db.get_meta_data()
|
|
123
|
-
# visible_data and meta_data should be models
|
|
124
|
-
all_data = database.get_data()
|
|
125
|
-
visible_data = all_data["visible_data"]
|
|
126
|
-
meta_data = all_data["meta_data"]
|
|
120
|
+
visible_data = database.get_visible_data()
|
|
121
|
+
meta_data = database.get_meta_data()
|
|
127
122
|
|
|
128
123
|
formatted_data = prepare_pin(location.model_dump(), visible_data, meta_data)
|
|
129
124
|
return jsonify(formatted_data)
|
|
@@ -2,6 +2,7 @@ import json
|
|
|
2
2
|
import os
|
|
3
3
|
import tempfile
|
|
4
4
|
from functools import partial
|
|
5
|
+
from typing import Any
|
|
5
6
|
|
|
6
7
|
from goodmap.core import get_queried_data
|
|
7
8
|
from goodmap.data_models.location import LocationBase
|
|
@@ -387,6 +388,142 @@ def get_data(db):
|
|
|
387
388
|
return globals()[f"{db.module_name}_get_data"]
|
|
388
389
|
|
|
389
390
|
|
|
391
|
+
# ------------------------------------------------
|
|
392
|
+
# get_visible_data
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
def google_json_db_get_visible_data(self) -> dict[str, Any]:
|
|
396
|
+
"""
|
|
397
|
+
Retrieve visible data configuration from Google Cloud Storage JSON blob.
|
|
398
|
+
|
|
399
|
+
Returns:
|
|
400
|
+
dict: Dictionary containing field visibility configuration.
|
|
401
|
+
Returns empty dict if not found.
|
|
402
|
+
"""
|
|
403
|
+
return self.data.get("map", {}).get("visible_data", {})
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
def json_file_db_get_visible_data(self) -> dict[str, Any]:
|
|
407
|
+
"""
|
|
408
|
+
Retrieve visible data configuration from JSON file database.
|
|
409
|
+
|
|
410
|
+
Returns:
|
|
411
|
+
dict: Dictionary containing field visibility configuration.
|
|
412
|
+
Returns empty dict if not found.
|
|
413
|
+
"""
|
|
414
|
+
return self.data.get("map", {}).get("visible_data", {})
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
def json_db_get_visible_data(self) -> dict[str, Any]:
|
|
418
|
+
"""
|
|
419
|
+
Retrieve visible data configuration from in-memory JSON database.
|
|
420
|
+
|
|
421
|
+
Returns:
|
|
422
|
+
dict: Dictionary containing field visibility configuration.
|
|
423
|
+
Returns empty dict if not found.
|
|
424
|
+
"""
|
|
425
|
+
return self.data.get("visible_data", {})
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
def mongodb_db_get_visible_data(self) -> dict[str, Any]:
|
|
429
|
+
"""
|
|
430
|
+
Retrieve visible data configuration from MongoDB.
|
|
431
|
+
|
|
432
|
+
Returns:
|
|
433
|
+
dict: Dictionary containing field visibility configuration.
|
|
434
|
+
Returns empty dict if config document not found or field missing.
|
|
435
|
+
|
|
436
|
+
Raises:
|
|
437
|
+
pymongo.errors.ConnectionFailure: If database connection fails.
|
|
438
|
+
pymongo.errors.OperationFailure: If database operation fails.
|
|
439
|
+
"""
|
|
440
|
+
config_doc = self.db.config.find_one({"_id": "map_config"})
|
|
441
|
+
if config_doc:
|
|
442
|
+
return config_doc.get("visible_data", {})
|
|
443
|
+
return {}
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
def get_visible_data(db):
|
|
447
|
+
"""
|
|
448
|
+
Get the appropriate get_visible_data function for the given database backend.
|
|
449
|
+
|
|
450
|
+
Args:
|
|
451
|
+
db: Database instance (must have module_name attribute).
|
|
452
|
+
|
|
453
|
+
Returns:
|
|
454
|
+
callable: Backend-specific get_visible_data function.
|
|
455
|
+
"""
|
|
456
|
+
return globals()[f"{db.module_name}_get_visible_data"]
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
# ------------------------------------------------
|
|
460
|
+
# get_meta_data
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
def google_json_db_get_meta_data(self) -> dict[str, Any]:
|
|
464
|
+
"""
|
|
465
|
+
Retrieve metadata configuration from Google Cloud Storage JSON blob.
|
|
466
|
+
|
|
467
|
+
Returns:
|
|
468
|
+
dict: Dictionary containing metadata configuration.
|
|
469
|
+
Returns empty dict if not found.
|
|
470
|
+
"""
|
|
471
|
+
return self.data.get("map", {}).get("meta_data", {})
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
def json_file_db_get_meta_data(self) -> dict[str, Any]:
|
|
475
|
+
"""
|
|
476
|
+
Retrieve metadata configuration from JSON file database.
|
|
477
|
+
|
|
478
|
+
Returns:
|
|
479
|
+
dict: Dictionary containing metadata configuration.
|
|
480
|
+
Returns empty dict if not found.
|
|
481
|
+
"""
|
|
482
|
+
return self.data.get("map", {}).get("meta_data", {})
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
def json_db_get_meta_data(self) -> dict[str, Any]:
|
|
486
|
+
"""
|
|
487
|
+
Retrieve metadata configuration from in-memory JSON database.
|
|
488
|
+
|
|
489
|
+
Returns:
|
|
490
|
+
dict: Dictionary containing metadata configuration.
|
|
491
|
+
Returns empty dict if not found.
|
|
492
|
+
"""
|
|
493
|
+
return self.data.get("meta_data", {})
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
def mongodb_db_get_meta_data(self) -> dict[str, Any]:
|
|
497
|
+
"""
|
|
498
|
+
Retrieve metadata configuration from MongoDB.
|
|
499
|
+
|
|
500
|
+
Returns:
|
|
501
|
+
dict: Dictionary containing metadata configuration.
|
|
502
|
+
Returns empty dict if config document not found or field missing.
|
|
503
|
+
|
|
504
|
+
Raises:
|
|
505
|
+
pymongo.errors.ConnectionFailure: If database connection fails.
|
|
506
|
+
pymongo.errors.OperationFailure: If database operation fails.
|
|
507
|
+
"""
|
|
508
|
+
config_doc = self.db.config.find_one({"_id": "map_config"})
|
|
509
|
+
if config_doc:
|
|
510
|
+
return config_doc.get("meta_data", {})
|
|
511
|
+
return {}
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
def get_meta_data(db):
|
|
515
|
+
"""
|
|
516
|
+
Get the appropriate get_meta_data function for the given database backend.
|
|
517
|
+
|
|
518
|
+
Args:
|
|
519
|
+
db: Database instance (must have module_name attribute).
|
|
520
|
+
|
|
521
|
+
Returns:
|
|
522
|
+
callable: Backend-specific get_meta_data function.
|
|
523
|
+
"""
|
|
524
|
+
return globals()[f"{db.module_name}_get_meta_data"]
|
|
525
|
+
|
|
526
|
+
|
|
390
527
|
# ------------------------------------------------
|
|
391
528
|
# get_categories
|
|
392
529
|
|
|
@@ -1320,6 +1457,8 @@ def delete_report(db, report_id):
|
|
|
1320
1457
|
|
|
1321
1458
|
def extend_db_with_goodmap_queries(db, location_model):
|
|
1322
1459
|
db.extend("get_data", get_data(db))
|
|
1460
|
+
db.extend("get_visible_data", get_visible_data(db))
|
|
1461
|
+
db.extend("get_meta_data", get_meta_data(db))
|
|
1323
1462
|
db.extend("get_locations", get_locations(db, location_model))
|
|
1324
1463
|
db.extend("get_locations_paginated", get_locations_paginated(db, location_model))
|
|
1325
1464
|
db.extend("get_location", get_location(db, location_model))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "goodmap"
|
|
3
|
-
version = "1.1.
|
|
3
|
+
version = "1.1.2"
|
|
4
4
|
description = "Map engine to serve all the people :)"
|
|
5
5
|
authors = ["Krzysztof Kolodzinski <krzysztof.kolodzinski@problematy.pl>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -22,6 +22,18 @@ aiohttp = "^3.8.4"
|
|
|
22
22
|
pydantic = "^2.7.1"
|
|
23
23
|
platzky = "^1.0.0"
|
|
24
24
|
deprecation = "^2.1.0"
|
|
25
|
+
sphinx = {version = "^8.0.0", optional = true}
|
|
26
|
+
sphinx-rtd-theme = {version = "^3.0.0", optional = true}
|
|
27
|
+
tomli = {version = "^2.0.0", optional = true}
|
|
28
|
+
myst-parser = {version = "^4.0.0", optional = true}
|
|
29
|
+
|
|
30
|
+
[tool.poetry.extras]
|
|
31
|
+
docs = [
|
|
32
|
+
"sphinx",
|
|
33
|
+
"sphinx-rtd-theme",
|
|
34
|
+
"myst-parser",
|
|
35
|
+
"tomli"
|
|
36
|
+
]
|
|
25
37
|
|
|
26
38
|
[tool.poetry.group.dev.dependencies]
|
|
27
39
|
pytest = "^7.1.2"
|
|
@@ -33,6 +45,7 @@ black = "^24.8.0"
|
|
|
33
45
|
ruff = "^0.4.4"
|
|
34
46
|
platzky-redirections = "^0.1.0"
|
|
35
47
|
python-semantic-release = "^10.4.1"
|
|
48
|
+
interrogate = "^1.7.0"
|
|
36
49
|
|
|
37
50
|
[tool.poetry.group.local.dependencies]
|
|
38
51
|
platzky = {path = "vendor/platzky", develop = true}
|
|
@@ -103,4 +116,13 @@ prerelease = false
|
|
|
103
116
|
|
|
104
117
|
[tool.semantic_release.publish]
|
|
105
118
|
dist_glob_patterns = ["dist/*"]
|
|
106
|
-
upload_to_vcs_release = true
|
|
119
|
+
upload_to_vcs_release = true
|
|
120
|
+
|
|
121
|
+
[tool.interrogate]
|
|
122
|
+
fail-under = 24
|
|
123
|
+
ignore-init-method = true
|
|
124
|
+
ignore-init-module = true
|
|
125
|
+
ignore-magic = true
|
|
126
|
+
ignore-private = true
|
|
127
|
+
ignore-semiprivate = false
|
|
128
|
+
exclude = ["tests", "docs"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|