Thoughts about a note-watching bot

I currently have a personal script that notifies me whenever an edit occurs in the vicinity of an open note (150 meter radius). I manually check the note and close it if the edit resolved it.

I’m wondering whether it could be turned into a useful bot. It’s kind of a workaround around the lack of note visibility.

To determine whether it’s useful as a bot, I’m considering manually collecting stats for a while. For each note found to be close to an edit, I’d manually mark whether this was a “hit” (the note is certainly relevant to the edit), a “miss” (the note is certainly irrelevant to the edit), or “unknown” (cannot tell without asking the mapper).

Any other suggestions for further empirical tests that would determine whether this script is useful as a bot? Anything similar done before?

The bot would write a message in the changeset, such as “It looks like you edited very close to the following note. Perhaps you can contribute to it or resolve it?”. Without any further measures, I estimate there would be about 3500 messages globally per day (this is the average of the last 7 days, sequences 4622-4628), but many measures can be taken to reduce this drastically, (lower radius, not notifying new users or users in certain editors, throttling messages per individual contributor, capping to x messages a day by prioritizing the edits nearest to notes, and so on)

Technical explanation: The script downloads the daily planet diffs and the full note file. It creates a rudimentary spatial index on the notes, then goes through the map changes one by one, calculating the distance from each feature to the nearest note. The script depends only on the python3 standard lib, and has no state except the sequence number of the last processed planet diff. It has a cache to avoid re-downloading things unnecessarily. Here is an example output, running it only for Israel.

Deleted /home/user/note-bot/data/notes/sorted_notes.csv. age is 60756 > 7200
Deleted /home/user/note-bot/data/notes/planet-notes-latest.osn.bz2. age is 61815 > 43200
Downloading https://planet.openstreetmap.org/notes/planet-notes-latest.osn.bz2...
Reading notes/planet-notes-latest.osn.bz2... (age: 0)
Filtering for open notes in [34.2654, 29.4534, 35.895, 33.277]
Processed 1 million notes
Processed 2 million notes
Processed 3 million notes
Processed 4 million notes
Started with 4636072 notes
4144108 were closed, leaving 491964
486492 were outside of bbox, leaving 5472 notes
Sorting remaining notes by longitude...
writing sorted notes to notes/sorted_notes.csv...
reading notes/sorted_notes.csv...
Reading diffs/last_processed.txt... (age: 56278)
Downloading https://planet.openstreetmap.org/replication/day/state.txt...
Reading diffs/cache/state.txt... (age: 0)

### Last processed state: (4627, '2025-05-14T00\\:00\\:00Z\n')
### Latest state: (4628, '2025-05-15T00\\:00\\:00Z\n')

######### Processing 4628
Downloading https://planet.openstreetmap.org/replication/day/000/004/628.osc.gz...
Reading diffs/cache/000/004/628.state.osc.gz... (age: 0)
Nodes processed: 3125625
Nodes outside bbox: 3123471
Nodes inside bbox: 2154
Nodes near notes: 223
Changesets near notes: 7

List:

https://www.openstreetmap.org/changeset/166272231
https://overpass-api.de/achavi/?changeset=166272231&relations=true
 - https://www.openstreetmap.org/note/3052355
 - https://www.openstreetmap.org/note/36634
 - https://www.openstreetmap.org/note/2274822

https://www.openstreetmap.org/changeset/166237479
https://overpass-api.de/achavi/?changeset=166237479&relations=true
 - https://www.openstreetmap.org/note/3731628
 - https://www.openstreetmap.org/note/3731638
 - https://www.openstreetmap.org/note/1298463

https://www.openstreetmap.org/changeset/166247042
https://overpass-api.de/achavi/?changeset=166247042&relations=true
 - https://www.openstreetmap.org/note/588622
 - https://www.openstreetmap.org/note/1274331

https://www.openstreetmap.org/changeset/166247045
https://overpass-api.de/achavi/?changeset=166247045&relations=true
 - https://www.openstreetmap.org/note/588622
 - https://www.openstreetmap.org/note/1274331

https://www.openstreetmap.org/changeset/166239434
https://overpass-api.de/achavi/?changeset=166239434&relations=true
 - https://www.openstreetmap.org/note/4167031

https://www.openstreetmap.org/changeset/166253976
https://overpass-api.de/achavi/?changeset=166253976&relations=true
 - https://www.openstreetmap.org/note/1573093

https://www.openstreetmap.org/changeset/166254411
https://overpass-api.de/achavi/?changeset=166254411&relations=true
 - https://www.openstreetmap.org/note/3320498
 - https://www.openstreetmap.org/note/3372835

Edit: there was an error in the daily estimation. Will update.

7 Likes

Cool idea - The little issue i have is that i typically open notes myself when i need to be on the ground and search for stuff which cant be solved by Aerials.
Although most of my mapping is at home - mostly from Aerials and Mapillary Imagery i am producing myself.

So you’ll see tons of edits around nodes i opened myself which i cant solve right now without again going to that place.

I am running a Note based bot myself. Its called “noteisdue” where you can issue reopen or notify after time from a note.
Simply

  • notify: $timespec
  • reopen: $timespec

as the first line in a comment.

If you issue a “notify: 3 months” you’ll get a comment in that note after 3 months saying that you said you wanted to be notified of this note.
If you comment a “reopen: 12 month” the note will be closed, and reopened after 12 month. It will tell you it found the message by commenting in the note.

Timespec is the perl Date::Manip::Date module so it should understand stuff like “next month” “next year” “2nd of next month” stuff like that.

I use it for tracking road construction work - So you tag a street with “highway=construction” and the Estimate is 6 month - i open a note putting in links to newspapers and a “notify: 6 month” so i dont forget to go back and validate the road construction.

We could probably fill a whole Hackton adding cool new features to notes.

  • Subscribe to note (Without sending out messages to others)
  • Unsubscribe from note
  • The whole Due/Renotification after time
  • Opening notes in very close vicinity to existing notes opens a warning
  • Rate limiting notes from Anonymous per area

Flo

2 Likes