Mechanical Edits/Mateusz Konieczny - bot account/removing source:user in Poland

From OpenStreetMap Wiki
Jump to navigation Jump to search

Page content created as advised on Automated_Edits_code_of_conduct#Document_and_discuss_your_plans.

This edit will remove useless source:user=* tags in Poland

Who

I, Mateusz Konieczny using my bot account

contact

message via OSM I will respond also to PMs to the bot account, though messaging my main account is preferable as I will get notifications in OSM editors.

English and Polish languages are preferable, for other I need to use an automatic translator.

What

remove

Why

Why it is useful? It helps newbies to avoid becoming confused. It protects against such values becoming established. Without drudgery that would be required from the manual cleanup.

Why automatic edit? I a have massive queue (in thousands and tens of thousands) of automatically detectable issues which are not reported by mainstream validators, require fixes and fix requires review or complete manual cleanup.

There is no point in manual drudgery here, with values completely useless.

This values here do NOT require manual overwiev. If this cases will turn out to be an useful signal of invalid editing than I will remain reviewing nearby areas where bot edited.

Yes, bot edit WILL cause objects to be edited. Nevertheless, as result map data quality will improve.

Numbers

Large enough to make it useful to automate it.

How

state after a mechanical edit:

Changeset would be described and tagged with tags that mark it as automatic, provide link to discussion approving edit, include link promoting https://matkoniecz.github.io/OSM-wikipedia-tag-validator-reports/ etc

Discussion

Discussed at https://community.openstreetmap.org/t/source-user-zwlaszcza-source-user-zvid-usuwanie-botem/4075

Repetition

This is a single run.

Source code

GPL 3.0 licensed

import hashlib
from osm_bot_abstraction_layer.generic_bot_retagging import run_simple_retagging_task


def edit_element(tags):
    if tags.get('source:user') != None:
        tags.pop('source:user', None)
        return tags
    return tags

def main():
    query="""
[out:xml][timeout:25000];
area[name="Polska"]->.a;
(
  nwr["source:user"](area.a);
);
out body;
>;
out skel qt;
"""
    hashed = hashlib.sha256(query.encode('utf-8')).hexdigest()
    run_simple_retagging_task(
        max_count_of_elements_in_one_changeset=500,
        objects_to_consider_query=query,
        objects_to_consider_query_storage_file='/media/mateusz/OSM_cache/osm_bot_cache/tags_for_retagging_' + hashed + '.osm',
        is_in_manual_mode=False,
        changeset_comment='usuwanie source:user - autor edycji zapisany jest w zestawie zmian',
        discussion_url="https://community.openstreetmap.org/t/source-user-zwlaszcza-source-user-zvid-usuwanie-botem/4075",
        osm_wiki_documentation_page='https://wiki.openstreetmap.org/wiki/Mechanical_Edits/Mateusz_Konieczny_-_bot_account/removing_source:user_in_Poland',
        edit_element_function=edit_element,
    )
main()

Opt-out

Please write at bot approval thread. Note that in case of opt-out exactly the same edit will be made manually for objects where bot opt-out was used.