From c5ba2cebd1feef1374a5e226197d3a5a4b6c5343 Mon Sep 17 00:00:00 2001 From: kshitijrajsharma Date: Mon, 30 Oct 2023 19:28:16 +0545 Subject: [PATCH 1/2] feat: intorduces key value stats feature for all the stats type --- osmsg/app.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/osmsg/app.py b/osmsg/app.py index 2ccc8184..4152d155 100644 --- a/osmsg/app.py +++ b/osmsg/app.py @@ -223,9 +223,19 @@ def collect_changefile_stats( if tags: for key, value in tags: if action != "delete": # we don't need deleted tags + if key_value: + users[user][f"tags_{action}"].setdefault(f"{key}={value}", 0) + users[user][f"tags_{action}"][f"{key}={value}"] += 1 users[user][f"tags_{action}"].setdefault(key, 0) users[user][f"tags_{action}"][key] += 1 if summary: + if key_value: + summary_interval[timestamp][f"tags_{action}"].setdefault( + f"{key}={value}", 0 + ) + summary_interval[timestamp][f"tags_{action}"][ + f"{key}={value}" + ] += 1 summary_interval[timestamp][f"tags_{action}"].setdefault(key, 0) summary_interval[timestamp][f"tags_{action}"][key] += 1 @@ -647,6 +657,14 @@ def parse_args(): help="Extract statistics of all of the unique tags and its count", default=False, ) + + parser.add_argument( + "--key_value", + action="store_true", + help="Extracts stats for Unique combination of tags key and value by default it will count for unique key on --all_tags", + default=False, + ) + parser.add_argument( "--temp", action="store_true", @@ -694,6 +712,10 @@ def main(): if not os.path.exists(base_path): os.makedirs(base_path) + if args.key_value: + args.all_tags = True + print("Enabling all_tags option as key_value is passed") + if args.update: if args.read_from_metadata: print("Error : Option not allowed : read_from_metadata along with --update") @@ -784,6 +806,7 @@ def main(): global additional_tags global cookies global all_tags + global key_value global hashtags global length global changeset_meta @@ -795,6 +818,7 @@ def main(): global remove_temp_files all_tags = args.all_tags + key_value = args.key_value additional_tags = args.tags hashtags = args.hashtags cookies = None From e31e8b9376276dd89094c994013bb6cee693ea80 Mon Sep 17 00:00:00 2001 From: kshitijrajsharma Date: Mon, 30 Oct 2023 19:29:33 +0545 Subject: [PATCH 2/2] =?UTF-8?q?bump:=20version=200.1.33=20=E2=86=92=200.2.?= =?UTF-8?q?0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b2f2147..bc0e7139 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## v0.2.0 (2023-10-30) + +### Feat + +- intorduces key value stats feature for all the stats type +- Turkey Data and Frontend Integration + +## v0.1.33 (2023-07-10) + ## v0.1.32 (2023-07-10) ### Perf diff --git a/pyproject.toml b/pyproject.toml index 2bbd531f..bcb9aac6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "osmsg" -version = "0.1.33" +version = "0.2.0" description = "OpenStreetMap Stats Generator : Commandline" readme = "README.md" authors = [{name = "Kshitij Raj Sharma", email = "skshitizraj@gmail.com"}]