Mechanical Edits/Mateusz Konieczny - bot account/OpenSidewalks graffiti tag removal in USA

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.

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 following tags by doing an automated edit:

Why

See https://osmus.slack.com/archives/C029HV951/p1679824673294549 https://github.com/OpenSidewalks/OpenSidewalks-Schema/issues/9 https://community.openstreetmap.org/t/proposed-bot-edit-remove-project-opensidewalks-and-project-opensidewalks-in-usa/97601

Numbers

Large enough to make it useful to automate it.

How

state before mechanical edit:

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://osmus.slack.com/archives/C029HV951/p1679824673294549 https://github.com/OpenSidewalks/OpenSidewalks-Schema/issues/9 https://community.openstreetmap.org/t/proposed-bot-edit-remove-project-opensidewalks-and-project-opensidewalks-in-usa/97601

Consulted with OpenSidewalks people at https://github.com/OpenSidewalks/OpenSidewalks-Schema/issues/9

Repetition

This is a reoccurring edit and may be made as soon as new tagging like this will appear. At this moment triggering new edit requires human intervention and review so exact schedule is not predictable and bot may stop running at any moment.

Source code

GPL 3.0 licensed

from osm_bot_abstraction_layer.generic_bot_retagging import run_simple_retagging_task

def edit_element(tags):
    if tags.get('project') == ("opensidewalks"):
        tags.pop('project', None)
        return tags
    if tags.get('project') == ("OpenSidewalks"):
        tags.pop('project', None)
        return tags
    return tags

def main():
    query = """
[out:xml][timeout:1800];
area[name="United States"]->.a;
(
  nwr[project=opensidewalks](area.a);
  nwr[project=OpenSidewalks](area.a);
);
out body;
>;
out skel qt;
"""
    run_simple_retagging_task( # (area.a)
        max_count_of_elements_in_one_changeset=5000,
        objects_to_consider_query=query,
        cache_folder_filepath='/media/mateusz/OSM_cache/osm_bot_cache',
        is_in_manual_mode=False,
        changeset_comment='remove unneded project=opensidewalks / project=OpenSidewalks',
        discussion_url="https://osmus.slack.com/archives/C029HV951/p1679824673294549 https://github.com/OpenSidewalks/OpenSidewalks-Schema/issues/9 https://community.openstreetmap.org/t/proposed-bot-edit-remove-project-opensidewalks-and-project-opensidewalks-in-usa/97601",
        osm_wiki_documentation_page="https://wiki.openstreetmap.org/wiki/Mechanical_Edits/Mateusz_Konieczny_-_bot_account/OpenSidewalks_grafitti_tag_removal",
        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.