Page MenuHomePhabricator

Investigation: UI - What is engineering recommendation for associating edit with event for MVP? [3 days]
Closed, ResolvedPublic

Description

User stories:

As an organizer of an event, I want to know the work that was done by the participants, and I want this data to be publicly shared on the wikis, so that I can report on the overall impact of the event, reward the efforts of participants, and identify which participants may be struggling so that I can offer them help.

As a participant of an event, I want to know the work that was done by me and other participants, and I want this data to be publicly shared on the wikis, so that I can see my impact, receive recognition for my work, and perhaps recognize the work of other participants.

Background:

One of the most important tasks related to organizing events on the wikis is tracking and reporting on impact. For events that focus on contributions, this means tracking contribution data, such as: the number of articles created, the number of articles edited, the total number of edits, the number of photos uploaded, etc.

Contribution data is important to many people. It is important to the event organizers and event stakeholders (such as grant officers, partner institutions, host venues), since it gives them an understanding of the impact of their events, their successes, and their gaps/challenges to address in the future. For the prospective participants, they can see impact reporting of past events, which can help motivate them to join future events. For event participants, it can help them feel like their work and time was valued, since they understand the impact of their individual contributions and the impact of the event overall.

However, there is no easy way to track contributions that are in the scope of an activity on the wikis. There are many external tools to track contributions, and different wikis & campaigns use different tools. However, many of these solutions pose challenges, including: they are off the wikis, they do not work well for tracking the contributions of experienced editors, and/or they can be hard to use.

This has made us wonder: Is there a simple, first stab that we can take at tracking contributions in organized activities? This first stab would focus on making it easy for organizers to know which contributions are within the scope of an organized activity.

Relevant resources:
Acceptance Criteria:
  • Investigate the feasibility of associating an edit with an event in the following way:
    • Given that an organizer has enabled registration for an event,
      • And if the event qualifies for enabling contribution tracking (i.e., it is a contribution event under event types and it is online or in person/hybrid in a country that is not "high risk" or "no publish")
        • And if the organizer chooses to enable contribution tracking,
          • Then if any registered participants is on a wiki(s) of the event,
          • And it is during the start date/time and end/date time of the event,
          • And the participant makes an edit,
            • The participant can associate an edit with the event with one of two modes
  • Investigate the pro/cons and risks/benefits of 2 potential modes to associate an edit with an event, and provide a general recommendation, if any. The two modes are:
    • Association before publishing edit (see image 1 in design examples)
    • Association after publishing edit (see image 2 in design examples)
  • We will need to consider editing for:
    • Desktop & mobile
    • VE & source editor
  • Consider if a certain option is better for minimizing or correcting user error:
    • Minimizing: We may want to encourage the user to deliberately state yes/no if the edit is a part of an event before they can proceed, as a way to help minimize user error
    • Correcting: After the simple first version of the feature, we will probably want to implement a way for organizers and the participants who made the edit the selection (i.e., de-associate an edit that is tied to an event, or associate an edit that was mistakenly not tied to an event). Will a certain approach make this easier?
  • We should share our learnings and proposal with the Editing team
Notes from Grants:
  • revision_tag in wmf.mediawiki_history would be ideal, as long as that tag is also stored at the event level. I'm guessing any storage in the current event registration tables would involve some sort of count or aggregation, which would be less useful for us
Design concepts:

Link to Figma file

Design concept 1 - before publishing edit:

Screenshot 2025-05-19 at 9.35.53 AM.png (476×524 px, 51 KB)

Screenshot 2025-05-19 at 2.22.44 PM.png (462×490 px, 50 KB)

Screenshot 2025-05-19 at 2.22.39 PM.png (452×494 px, 47 KB)

Design concept 2 - after publishing edit:

Screenshot 2025-05-19 at 2.21.27 PM.png (738×1 px, 365 KB)

Screenshot 2025-05-19 at 2.21.14 PM.png (752×1 px, 378 KB)

Details

Related Changes in Gerrit:
SubjectRepoBranchLines +/-
mediawiki/extensions/CampaignEventsmaster+854 -116
mediawiki/extensions/CampaignEventsmaster+52 -21
mediawiki/extensions/CampaignEventsmaster+48 -4
mediawiki/extensions/CampaignEventsmaster+64 -5
mediawiki/extensions/CampaignEventsmaster+491 -1
mediawiki/extensions/CampaignEventsmaster+29 -4
mediawiki/extensions/CampaignEventsmaster+110 -1
mediawiki/extensions/CampaignEventsmaster+546 -0
mediawiki/extensions/CampaignEventsmaster+218 -3
mediawiki/extensions/CampaignEventsmaster+122 -0
mediawiki/extensions/CampaignEventsmaster+33 -0
mediawiki/extensions/CampaignEventsmaster+0 -1
mediawiki/extensions/CampaignEventsmaster+218 -36
mediawiki/extensions/CampaignEventsmaster+218 -36
mediawiki/extensions/CampaignEventsmaster+190 -0
mediawiki/extensions/CampaignEventsmaster+33 -0
mediawiki/extensions/CampaignEventsmaster+29 -4
mediawiki/extensions/CampaignEventsmaster+73 -13
mediawiki/extensions/CampaignEventsmaster+29 -4
mediawiki/extensions/CampaignEventsmaster+73 -13
mediawiki/extensions/CampaignEventsmaster+190 -0
mediawiki/extensions/CampaignEventsmaster+0 -1
mediawiki/extensions/CampaignEventsmaster+2 -0
mediawiki/extensions/CampaignEventsmaster+546 -0
mediawiki/extensions/CampaignEventsmaster+33 -0
mediawiki/extensions/CampaignEventsmaster+218 -36
mediawiki/extensions/CampaignEventsmaster+218 -36
mediawiki/extensions/CampaignEventsmaster+33 -0
mediawiki/extensions/CampaignEventsmaster+33 -0
mediawiki/extensions/CampaignEventsmaster+218 -36
mediawiki/extensions/CampaignEventsmaster+33 -0
mediawiki/extensions/CampaignEventsmaster+190 -0
mediawiki/extensions/CampaignEventsmaster+0 -1
mediawiki/extensions/CampaignEventsmaster+190 -0
mediawiki/extensions/CampaignEventsmaster+0 -1
mediawiki/extensions/CampaignEventsmaster+2 -0
mediawiki/extensions/CampaignEventsmaster+29 -4
mediawiki/extensions/CampaignEventsmaster+2 -0
mediawiki/extensions/CampaignEventsmaster+2 -0
Show related patches Customize query in gerrit

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
ifried renamed this task from Investigation: What is engineering recommendation for associating edit with event for MVP? to Investigation: What is engineering recommendation for associating edit with event for MVP? [3 days].May 29 2025, 4:50 PM
ifried renamed this task from Investigation: What is engineering recommendation for associating edit with event for MVP? [3 days] to Investigation: UI - What is engineering recommendation for associating edit with event for MVP? [3 days].Jun 2 2025, 4:29 PM
cmelo changed the task status from Open to In Progress.Jul 7 2025, 3:48 PM
cmelo claimed this task.

Outcomes from the Investigation

Layout for Adding New Input Fields

We should use the appropriate hook to add the following:

  • A checkbox field for the user to indicate whether the edit is related to a Campaign Event.
  • A dropdown list of events for the user to specify which event the article is related to.

Users may be participating in more than one event during the same period.
For example, some events span several weeks.
I checked the production database and confirmed there are participants involved in multiple events at the same time.

  1. When to display the fields
  2. The 2 new fields are just shown to users that are participating in one or more events during the period of the edit. (Included in the POC)

Customization and Validation

Disable Dropdown Based on Checkbox

  • Disabling the dropdown when the checkbox is unchecked seems doable.
  • Requires further investigation to determine the best approach.
  • For now, I implemented it using JavaScript.
  • I wasn’t able to make it work with OOUI infusion, although it may be possible (I'll contact the Editing team for input).

Display Both Fields on a New Line

Source Editor
  • Possible, but may not be ideal.
  • Fields added via the hook have limited customization by default.
  • Styling with CSS must be done carefully to avoid breaking layout.
  • Responsiveness is important: the current layout adapts based on screen size.
Visual Editor (VE)
  • Works naturally due to limited width of the dialog.
  • Fields appear on new lines automatically.
  • Still depends on screen size and the number of added fields.

Validation Example

  • If the user checks the checkbox but does not select an event, we should prevent submission.
  • This is doable with JavaScript.
  • Suggestion: Start with the first event pre-selected by default.
    • If the checkbox is checked, we treat the edit as related to the selected event.
    • The backend saves the selected event ID.

Capturing and Storing Edit Data

We can use the appropriate hook to intercept and store edit data. It provides access to event-related metadata and allows for further analysis, such as:

  • Whether this is a new article creation.
  • Whether it is an edit of an existing article.
  • But not for deletion, deletion is done in a different place, so if we want this we would need to ask it there too.
  • Number of bytes added or removed.
  • Number of words added or removed:
    • For Latin characters: possible but not always accurate due to limitations of str_word_count in PHP.
    • For non-Latin characters: requires an external library or API.
  • Number of references added or removed.
  • Number of Commons uploads added or removed.

More details will be included in the database investigation.

Conclusion

It is feasible to implement this (I have a working proof of concept, that I will share soon).
As discussed in other meetings/channels, we should start with replicating the current behavior, based on its limitations, and then improve or adapt it based on our needs later.

Screenshots

Below are some screenshots of the proof of concept.
The designs shown are just my own experimental drafts to represent the data collected — please ignore the design for now.

Screenshot 2025-07-09 at 03.03.37.png (786×1 px, 145 KB)

Screenshot 2025-07-09 at 00.43.42.png (863×1 px, 178 KB)

Screenshot 2025-07-14 at 10.40.45.png (953×1 px, 110 KB)

Disable Dropdown Based on Checkbox

[...]

  • For now, I implemented it using JavaScript.
  • I wasn’t able to make it work with OOUI infusion, although it may be possible (I'll contact the Editing team for input).

Indeed, I think it's important to get input here, to guarantee that the approach chosen works for all the target editors, does not produce errors on unwanted editors, and does not introduce performance regressions (e.g., if we need to implement JS code on our side, is there a way to bundle it in an existing ResourceLoader bundle used for edits?)

Validation Example

  • If the user checks the checkbox but does not select an event, we should prevent submission.
  • This is doable with JavaScript.

Preventing submission SGTM, but we still need to make sure that we're validating the submitted data (server-side). (You may already have this in your POC, but I don't see it mentioned above and I think it's pretty important)

Capturing and Storing Edit Data

We can use the appropriate hook to intercept and store edit data.

What hook did you use for this?

It provides access to event-related metadata and allows for further analysis, such as:
[...]

  • Whether it is a deletion (needs further investigation).

Does it? Deletions are entirely separated from edits AFAIK.

  • Number of references added or removed.

Are you getting these from a ParserOutput? I'm curious about this one.

  • Number of Commons uploads added or removed.

Are you sure? Aren't uploads handled separately from edits, and on a potentially different site?

We can use the appropriate hook to intercept and store edit data.

What hook did you use for this?

In passing, might consider using the new domain events instead, see e.g. T393005. Unsure if it would provide all the capabilities we need. We'd probably still need to handle an abortable hook, like EditFilterMergedContent, if we want to surface validation errors to the user (instead of silently discarding them). But we probably need to handle a post-edit hook/event anyway, because otherwise I don't think it's guaranteed that the edit will go through, for example in case of null edits (even subtle cases where new wikitext is different before PST, but identical after PST), AbuseFilter, SpamBlacklist, etc. AbuseFilter itself may serve as an example here because of its EditFilterMergedContent + PageRevisionUpdatedListener handling where the former saves data about the ongoing edit and the latter retroactively associates an AbuseLog entry with that edit.

Thanks, @Daimona, I will take a loop at the domain events, maybe it can replace the PageSaveComplete hook I used for the POC, I will also put the POC in gerrit today, so you can see what have been done.

BTW I found a way to count words properly by using segmentByWord, I will still ask a few question to edit team later today, the final questions I have about the investigarion, and will also share this finding with them to check it is ok to use it, but I have tested and it worked pretty good.

Change #1171573 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

https://gerrit.wikimedia.org/r/1171573

Change #1171614 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

https://gerrit.wikimedia.org/r/1171614

Change #1171615 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] POC associate edit to event

https://gerrit.wikimedia.org/r/1171615

Change #1171618 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

https://gerrit.wikimedia.org/r/1171618

Change #1171619 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] POC - Add new DB schema for associate edit with an event

https://gerrit.wikimedia.org/r/1171619

Change #1171653 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

https://gerrit.wikimedia.org/r/1171653

Change #1171654 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] POC associate edit to event

https://gerrit.wikimedia.org/r/1171654

Change #1171656 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] POC associate edit to event

https://gerrit.wikimedia.org/r/1171656

Change #1171657 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

https://gerrit.wikimedia.org/r/1171657

Change #1171658 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce AssocieteEditToEvent.js to handle the new fields

https://gerrit.wikimedia.org/r/1171658

Change #1171661 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

https://gerrit.wikimedia.org/r/1171661

Change #1171662 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] POC associate edit to event

https://gerrit.wikimedia.org/r/1171662

Change #1171664 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] POC associate edit to event

https://gerrit.wikimedia.org/r/1171664

Change #1171665 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

https://gerrit.wikimedia.org/r/1171665

Change #1171666 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce AssocieteEditToEvent.js to handle the new fields

https://gerrit.wikimedia.org/r/1171666

Change #1171670 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce getBytesAdded and getBytesRemoved

https://gerrit.wikimedia.org/r/1171670

@cmelo Please watch out, something seems to be going out of control.

Change #1171672 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

https://gerrit.wikimedia.org/r/1171672

Change #1171673 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] POC associate edit to event

https://gerrit.wikimedia.org/r/1171673

Change #1171675 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] POC associate edit to event

https://gerrit.wikimedia.org/r/1171675

Change #1171676 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

https://gerrit.wikimedia.org/r/1171676

Change #1171677 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce AssocieteEditToEvent.js to handle the new fields

https://gerrit.wikimedia.org/r/1171677

Change #1171681 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce getBytesAdded and getBytesRemoved

https://gerrit.wikimedia.org/r/1171681

Change #1171682 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce getBytesAdded and getBytesRemoved

https://gerrit.wikimedia.org/r/1171682

Change #1171683 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

https://gerrit.wikimedia.org/r/1171683

Change #1171684 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] POC associate edit to event

https://gerrit.wikimedia.org/r/1171684

Change #1171686 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] POC associate edit to event

https://gerrit.wikimedia.org/r/1171686

Change #1171687 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

https://gerrit.wikimedia.org/r/1171687

Change #1171688 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce AssocieteEditToEvent.js to handle the new fields

https://gerrit.wikimedia.org/r/1171688

Change #1171692 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce getBytesAdded and getBytesRemoved

https://gerrit.wikimedia.org/r/1171692

Change #1171693 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce getBytesAdded and getBytesRemoved

https://gerrit.wikimedia.org/r/1171693

Change #1171727 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Introduce getParticipantOngoingEvents in event store

https://gerrit.wikimedia.org/r/1171727

Change #1171675 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] POC associate edit to event

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171675

Change #1171664 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] POC associate edit to event

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171664

Change #1171670 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce getBytesAdded and getBytesRemoved

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171670

Change #1171656 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] POC associate edit to event

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171656

Change #1171657 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171657

Change #1171658 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce AssocieteEditToEvent.js to handle the new fields

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171658

Change #1171665 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171665

Change #1171666 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce AssocieteEditToEvent.js to handle the new fields

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171666

Change #1171614 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171614

Change #1171615 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] POC associate edit to event

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171615

Change #1171618 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171618

Change #1171653 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171653

Change #1171654 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] POC associate edit to event

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171654

Change #1171662 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] POC associate edit to event

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171662

Change #1171661 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171661

Change #1171619 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] POC - Add new DB schema for associate edit with an event

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171619

Change #1171727 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce getParticipantOngoingEvents in event store

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171727

Change #1171686 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] POC associate edit to event

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171686

Change #1171687 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171687

Change #1171688 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce AssocieteEditToEvent.js to handle the new fields

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171688

Change #1171693 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce getBytesAdded and getBytesRemoved

Reason:

Did a gerrit flow mistake, and many patches got duplicated.

https://gerrit.wikimedia.org/r/1171693

Change #1171727 restored by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce getParticipantOngoingEvents in event store

https://gerrit.wikimedia.org/r/1171727

Change #1171692 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce getBytesAdded and getBytesRemoved

Reason:

Wrong gerrit flow commands caused many patches to duplicate

https://gerrit.wikimedia.org/r/1171692

Change #1171682 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce getBytesAdded and getBytesRemoved

Reason:

Wrong gerrit flow commands caused many patches to duplicate

https://gerrit.wikimedia.org/r/1171682

Change #1171681 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce getBytesAdded and getBytesRemoved

Reason:

Wrong gerrit flow commands caused many patches to duplicate

https://gerrit.wikimedia.org/r/1171681

Change #1171683 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

Reason:

Wrong gerrit flow commands caused many patches to duplicate

https://gerrit.wikimedia.org/r/1171683

Change #1171677 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce AssocieteEditToEvent.js to handle the new fields

Reason:

Wrong gerrit flow commands caused many patches to duplicate

https://gerrit.wikimedia.org/r/1171677

Change #1171673 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] POC associate edit to event

Reason:

Wrong gerrit flow commands caused many patches to duplicate

https://gerrit.wikimedia.org/r/1171673

Change #1171684 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] POC associate edit to event

Reason:

Wrong gerrit flow commands caused many patches to duplicate

https://gerrit.wikimedia.org/r/1171684

Change #1171676 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

Reason:

Wrong gerrit flow commands caused many patches to duplicate

https://gerrit.wikimedia.org/r/1171676

Change #1171672 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] Introduce getActiveEventsByParticipanton on EventStore

Reason:

Wrong gerrit flow commands caused many patches to duplicate

https://gerrit.wikimedia.org/r/1171672

Change #1171573 abandoned by Cmelo:

[mediawiki/extensions/CampaignEvents@master] POC - Introduce getActiveEventsByParticipanton on EventStore

Reason:

Wrong gerrit flow commands caused many patches to duplicate

https://gerrit.wikimedia.org/r/1171573

Change #1171737 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] POC TC: Add fields to associate edit to event

https://gerrit.wikimedia.org/r/1171737

Change #1171739 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] POC TC: Add new DB schema to store edit event assosiation

https://gerrit.wikimedia.org/r/1171739

Change #1171740 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] POC TC: Add DB layer to store edit event association

https://gerrit.wikimedia.org/r/1171740

Change #1171745 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] POC TC: Implement getBytesDelta

https://gerrit.wikimedia.org/r/1171745

Change #1171746 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] POC TC: Introduce getWordsDelta and countWords

https://gerrit.wikimedia.org/r/1171746

Change #1171748 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] POC TC: introduce getReferencesDelta and countReferences

https://gerrit.wikimedia.org/r/1171748

Change #1171750 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] POC TC: Introduce getCommonsUploadsDelta and countCommonsLinks

https://gerrit.wikimedia.org/r/1171750

Change #1172061 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] POC TC: Introduce contributions tab on event details

https://gerrit.wikimedia.org/r/1172061

Disable Dropdown Based on Checkbox

[...]

  • For now, I implemented it using JavaScript.
  • I wasn’t able to make it work with OOUI infusion, although it may be possible (I'll contact the Editing team for input).

Indeed, I think it's important to get input here, to guarantee that the approach chosen works for all the target editors, does not produce errors on unwanted editors, and does not introduce performance regressions (e.g., if we need to implement JS code on our side, is there a way to bundle it in an existing ResourceLoader bundle used for edits?)

Validation Example

  • If the user checks the checkbox but does not select an event, we should prevent submission.
  • This is doable with JavaScript.

Preventing submission SGTM, but we still need to make sure that we're validating the submitted data (server-side). (You may already have this in your POC, but I don't see it mentioned above and I think it's pretty important)

Yes, for sure, it must have server side validation too, but I did not add it in the POC

Capturing and Storing Edit Data

We can use the appropriate hook to intercept and store edit data.

What hook did you use for this?

SavePageComplete

It provides access to event-related metadata and allows for further analysis, such as:
[...]

  • Whether it is a deletion (needs further investigation).

Does it? Deletions are entirely separated from edits AFAIK.

Yes, that why I added "needs further investigation" I was checking some stuff and it is really not possible to get this in the edit action, so it may need to be done when doing the delete action

  • Number of references added or removed.

Are you getting these from a ParserOutput? I'm curious about this one.

I get it using regex, here is the patch related to it

  • Number of Commons uploads added or removed.

Are you sure? Aren't uploads handled separately from edits, and on a potentially different site?

I get it using regex, here is the patch related to it

Answering the items in the AC:

  • Investigate the feasibility of associating an edit with an event in the following way:
    • Given that an organizer has enabled registration for an event,
      • And if the event qualifies for enabling contribution tracking (i.e., it is a contribution event under event types and it is online or in person/hybrid in a country that is not "high risk" or "no publish") - [It is possible to implement it this way]
        • And if the organizer chooses to enable contribution tracking, - >>[It is possible, we can add a new field for organizer to enable tracking and only show it if e.g: is under an event type that allows tracking]
        • Then if any registered participants is on a wiki(s) of the event, - [OK included in the POC]
        • And it is during the start date/time and end/date time of the event, - [OK included in the POC]
        • And the participant makes an edit, - [OK included in the POC]
          • The participant can associate an edit with the event with one of two modes - [OK included in the POC]
  • Investigate the pro/cons and risks/benefits of 2 potential modes to associate an edit with an event, and provide a general recommendation, if any. The two modes are:
    • Association before publishing edit (see image 1 in design examples) - [Possible included in the POC]
    • Association after publishing edit (see image 2 in design examples) - [Also possible for what I have seen so far, but it was not included in the POC]
  • We will need to consider editing for:
    • Desktop & mobile - [It is possible]
    • VE & source editor - [It is possible]
  • Consider if a certain option is better for minimizing or correcting user error:
    • Minimizing: We may want to encourage the user to deliberately state yes/no if the edit is a part of an event before they can proceed, as a way to help minimize user error - [It is ok to do it]
    • Correcting: After the simple first version of the feature, we will probably want to implement a way for organizers and the participants who made the edit the selection (i.e., de-associate an edit that is tied to an event, or associate an edit that was mistakenly not tied to an event). Will a certain approach make this easier? - [This is fine to do too, since we plan to store the data on X1 the same place where all CampaignEvents data are, we can easily give the user and the organizer the option to de-associate]
  • We should share our learnings and proposal with the Editing team
    • I have shared the learning and asked a few questions, but things may change given the POC was done under the faact of asking the user before the publish and we may do it after.
  • Notes from Grants:
    • revision_tag in wmf.mediawiki_history would be ideal, as long as that tag is also stored at the event level. I'm guessing any storage in the current event registration tables would involve some sort of count or aggregation, which would be less useful for us. - [For this what I tried and make sense to me, is use the event name as a tag and add it to the list of tags using a hook, this means we don't need to create tags on the DB we just check if an edit has an event associated to if and if so, the event name came as a tag for this edit]
  • Number of references added or removed.

Are you getting these from a ParserOutput? I'm curious about this one.

I get it using regex, here is the patch related to it

I think regex-parsing wikitext is not going to end well (some reasons that come to mind are nowikis, custom templates like {{ref}} and {{refn}}, and generally other syntax like {{#tag:ref}}). My first thought was that this information would need to be obtained from the ParserOutput, but I'm not sure if it's possible. (Also worth noting that this count the number of refs, so 1 addition and 1 removal within the same edit would count as no additions or removals. I'm not sure if it can be done differently.)

  • Number of Commons uploads added or removed.

Are you sure? Aren't uploads handled separately from edits, and on a potentially different site?

I get it using regex, here is the patch related to it

This is not counting commons uploads, but rather the number of images added/removed in the current edit, which is a separate concept. I assumed we wanted to count the actual uploads. If we want to count file additions/removals, then this approach also has the same issues with regexps described above (here, alternative methods include <gallery> tags and templates, especially those taking a raw file name); also, the namespace names are translatable and Commons is not a file namespace. There's also the entire "Commons uploads" vs "local uploads" that further complicates this.

We are now beginning the work and have made decisions about technical implementation and the scope for the MVP, so I am marking this work as done. Great job, everyone!