developmentseed / scoreboard

Encouraging OpenStreetMap mappers with badges, graphs & stats! ✨🕹
https://developmentseed.org/scoreboard
27 stars 9 forks source link

MapRoulette + Scoreboard Integration #457

Open guidorice opened 4 years ago

guidorice commented 4 years ago

Integrate MapRoulette (MR) into Scoreboard and display a user’s active MapRoulette tasks on their dashboard.

Subtasks

MapRoulette api docs https://maproulette.org/docs/swagger-ui/index.html?url=/assets/swagger.json

guidorice commented 4 years ago

Decide on Semantics of what is a "campaign" on the frontend in MR terms; is it a challenge? a single task to complete?

Decision

After discussion and whiteboarding with @LanesGood , we decided that MapRoulette's Challenge entity is the appropriate level to source data from, into Scoreboard's Campaign entity.

Background

Scoreboard has, at a high level, the entities Tasker, Campaign and Assignments. Tasker is an abstraction for sourcing data from a concrete Tasking Manager instance.

Currently, Scoreboard can utilize Campaigns that originate from Projects in OpenStreetMap US Tasking Manager (tasks.openstreetmap.us). Some of the project data is cherry-picked and copied into the Scoreboard database, and also tm_id is used as a foreign key to the Task Manager's Project.

example project tm_id Campaign <- tm_id (117) <- https://tasks.openstreetmap.us/project/117

Tasker can be extended to support additional Tasking Manager instances, for example:

MapRoulette has different terminology and different data model entities, so here are some concepts:

Therefore the MapRoulette Challenge appears to be the most appropriate entity to link the Scoreboard schema with the MapRoulette schema.

guidorice commented 4 years ago

Perform Gap Analysis between Scoreboard database schema and the MR api. Are any columns or tables missing or mismatched?

Recommendation: Skip this

There are 86 tables (relations) in the Scoreboard database, and perhaps many more in the MR database and api. Reconciling them would be a big task and it also may not even make sense.

In practice I think any new Tasking Manager implementations in Scoreboard are going to cherry-pick only the desired properties from a Challenge/Project, and then store a link to the original so it's probably fine if fields or tables are missing or named differently in Scoreboard.

guidorice commented 4 years ago

Add any database migrations to scoreboard, if any new columns or tables needed.

None identified so far.

Recommendation: If there are any database changes required, do this as needed as part of the next task (Implement MapRoulette Task Manager classes).

guidorice commented 4 years ago

Here are some next steps for my PR #458

  1. Continue refactor of the TaskingManagerFactory class and implement the MapRouletteAPI class. The intent of the new Factory class is to make it possible to cleanly add not just MapRoulette API class but also other Tasking Managers in future.
  2. Fix broken tests inapi/tests/api/services and support new TaskingManagerFactory.
  3. Add new tests for MapRouletteAPI.
  4. Update Admin UI and elsewhere in the app to use dynamically generated list of Tasking Manager types instead of hardcoded 'tm2', 'tm3', etc.
  5. Get a MapRoulette connection going and actually talk to the API! Continue development.
LanesGood commented 4 years ago

Updated integration plan:

guidorice commented 4 years ago

MR Challenges do not need to display AOI (but perhaps they still should for visual consistency?)

I believe MR itself displays the AOI with a clustering symbology, rather than a BBox. Ideally we could do the same.

LanesGood commented 4 years ago

@guidorice as we start on this work again, are there items that require opening a new ticket?

guidorice commented 4 years ago

I responded to @LanesGood on Slack re: resource scheduling.

LanesGood commented 3 years ago

@jvntf @necoline can you determine what edit statistics are available per user for each MR challenge? Does the API expose the number of tasks completed/skipped/marked too hard by a user for that challenge?

jvntf commented 3 years ago

@LanesGood This endpoint returns the tasks existing for each challenge and exposes a status : 0 - Created, 1 - Fixed, 2 - False Positive, 3 - Skipped, 4 - Deleted, 5 - Already Fixed, 6 - Too Hard priority: 0 - High, 1 - Medium, 2 - Low review" 0 - Requested, 1 - Approved, 2 - Rejected, 3 - Assisted, 4 - Disputed I don't see how to identify the user

LanesGood commented 3 years ago

@jvntf as mentioned, we still need to bring in the user data for each challenge. Is it possible to integrate the challenge leaderboards from this endpoint into the challenge page? I see that challengeId is an optional query.

LanesGood commented 3 years ago

@jvntf for user data extraction from OSMesa using MapRoulette hashtags, it looks like a changeset hashtag is available but optional. On a task for this challenge I see #maproulette #Kaart-MR-8968 in the changeset field in iD which would definitely be queryable in OSMesa However I see only Unmapped places in DRC #maproulette autopopulated in the changeset when editing in iD from this task - which is likely not queryable from OSMesa.

In the setup for a challenge on MapRoulette, users are presented with the following options: image

And in the MR github, I see that this exists as an issue: https://github.com/osmlab/maproulette3/issues/178 and an open PR: https://github.com/osmlab/maproulette3/pull/849

cc/@guidorice

LanesGood commented 3 years ago

@jvntf below is one approach to a potential MapRoulette challenge page if this data is available. If we are able to connect the MapRoulette challenge changeset hashtag to an OSMesa query, we can also display the feature stats currently visible on all Tasking Manager campaign pages.

If the data from the user/leaderboard endpoint is the only data available, we can have the table headings display a user's score, tasksCompleted and avgTimeSpent - if we think this information is useful . MR_ChallengePage

LanesGood commented 3 years ago

@jvntf reviewing your comment above, I realize that the overall challenge task breakdown is still available

To recap available data, I see that we have:

This could allow the following tables for each challenge page:

Does the above look correct and feasible to you?

jvntf commented 3 years ago

@LanesGood correct and feasible

jvntf commented 3 years ago

Dev notes on how to do the above:

Revise #593 as:

Implement MapRouletteAPI.getProjectStats(id), MapRouletteAPI.getProjectUserStats(id) On load of any /campaign -> if task manager has getProjectStats -> do that (challenge task status breakdown, undefined for Task Manager tasks) if task manager has getProjectStats-> do that (challenge user leaderboard table, undefined for Task Manager tasks) if has hashtag and hashtag is in OSMesa -> return feature table (will exist for TM tasks, may exist for MR tasks)

Frontend Refactor -> Parse returned data for available tables -> construct accordingly. As of now this section of the front end is more hardcoded than perhaps is necessary cc @necoline

LanesGood commented 3 years ago

@jvntf the updated mockup for the Scoreboard MapRoulette Challenge page: MapRoulette-challengepage

jvntf commented 3 years ago

@LanesGood thanks for update, one question -> in the case that osmesa stats exist for a MR challenge, the participants and total edits section will be relevant, should we include those in the Panel or drop them? image