Editor campaigns/Notes

Here are some notes about Editor campaigns. :)

=Initial features and the road beyond=

The project page sets out initial goals and features for Editor Campaigns. What may follow is a bit fuzzier. Still, it could be useful to start thinking about the next steps; we may want to consider (1) what will come next, as part of deciding (2) how to implement what comes first. This document touches on both points.

=Initial use cases=

Here's a use case diagram based on the user stories described by the project.

This diagram describes an unrestricted campaign configuration. Some campaigns wll probably want to set tighter limits on who can do what. Also, there are some actions (like following campaign activity) that will probably be open to everyone, but that will be mainly of interest to participants and organizers.

Question: is it appropriate for organizers to be able to add or remove people at will? Shouldn't some action be required on the receiving end?

=Possible future user stories=

Some ideas for more stories:
 * Campaign organizers, participants and others want to study and compare campaigns using a variety of metrics.
 * Campaign organizers, participants and others want to link data about campaigns to data from other sources, including Wikidata.
 * Campaign organizers and participants want to organize their work in steps (i.e., as workflows) according to the requirements of a specific campaign or type of campaign.
 * Campaign organizers and participants want different UXs and data points for different types of campaign.
 * Users want flexible, productive, fun and easy-to-use tools for working and hanging out on Wikipedia in groups.

=Structured data store=

Quite tentatively: we might consider the possibility of using a structured data store like Wikibase instead of MySQL tables to persist campaign data.

The possible future user stories mentioned above would benefit more from such a design than the ones we're tackling now. (See below for more specific use case ideas.)

We could call it “WikiCommunityData”. The database tables described in the RFC could still be created as a first step while we consider the details and usefulness of a structured data store.

One option would be to create an internal repository using Wikibase, but with no external Wikidata UI, only an internal read-write API and a public read-only API.

Advantages

 * Flexibility. It would be easy for extensions that build on Editor Campaigns to augment the base campaigns data structure according to their requirements.
 * Encapsulation. The base Editor Campaigns component wouldn't need to know anything about the data structure elements used by the components that build on it.
 * Expressiveness. With hierarchies of types, multilingual labels, complex datatypes and “no-value” statements, Wikibase is much more expressive than a relational database (as so are other similar models, like the Semantic Web).
 * Exportability. It's possible to export Wikibase data to RDF and other formats. This would make it easy to link campaigns data to structured data from multiple sources.
 * Clean separation of private data. Database tables contain private information. Putting public campaigns-related data in a separate repository would make it possible to offer query functions without worrying about unauthorized access.
 * It's hot...! This is the type of technology is behind Siri and Google Knowledge Graphs. Seems to have some potential.

Disadvantages

 * Additional Ops work would be required; feasibility is unknown.
 * Everyone's more familiar with SQL, and a lot of this could be done with database tables, too (though probably not as elegantly).

Specific use cases

 * Find campaigns by the Wikidata categories or Geotags of the articles they work on.
 * Place a campaign's activities on a timeline together with events described in Wikidata. For example, visualize edits by a project about the Ukraine alongside major events in the recent protest movement there.
 * Create automatic text analysis of articles and link it to campaigns to compare their results. A text analysis component could add structured data to the repository. Campaign results could be compared in terms of content persistence, for example. Or one could compare the types of discourse on the Talk (or Flow) pages used by different campaigns.
 * Describe campaign participant networks. See, for example, this study of Twitter networks.
 * Create a system for modeling workflows, hook it up to UI features, and let campaigns tweak their own workflows and link to their own data structures as needed.

Why a separate Wikibase instance?
Why use a separate, isolated Wikibase instance?
 * We would probably be able to re-use Wikibase code for dealing with geolocation, time and other basic stuff.
 * We would be able to leverage Wikibase property definitions (such as participant and organizer) and contribute to Wikidata ontologies.
 * Our data would differ from that in Wikidata in that it wouldn't need sources, and would not be expected to contain contradictory statements.
 * There might be different performance and caching requirements.

=Architecture=

The code produced during the first few sprints will probably be pretty straightforward. Still, it would be nice to have an architectural plan to aim for. Here's a rough proposal:

The persistence layer would encapsulate DB or Wikibase access. The business logic layer would handle basic operations in isolation from the UI. The base Campaigns UI and reusable UI logic layer would provide a simple, general UI for working with campaigns of any type (course, edit-a-thon, etc.), and would provide reusable UI components for use by the top layers. Finally, the top layers would access the Campaigns business logic layer and use said UI components to create interfaces and additional features specific to one type of campaign.

To integrate Workflows, two middle layers could be added next to the Campaigns business and UI layers, with similar functions. Other components with general functionality to be used by the upper layers (for example, a component for edit feeds) might insert middle layers in a similar manner.

Question: Do we want to use existing frameworks at all? Composer? Anything from Symfony?

=Initial UI=

Here's a very unoriginal proposal for the UI:
 * A Special page for listing and searching for campaigns. Each campaign name would be a link to the page for that campaign. Authorized users would see an add button and/or delete buttons.
 * Campaigns would have a page in their own namespace. Pages would be implemented using ContentHandler, and would have tabs for viewing, editing, viewing history, moving and deleting (again, depending on user rights). The edit page would let users modify general campaign information and (for admins) remove users. The view page would also list the participants/organizers and provide a means of inviting more users.

Though this general layout is very close to the one used by the Education Program extension, there's a lot of room for UX and design improvement within that framework. Consultation with EP users will be fundamental for ideas on possible improvements.

This basic UI should display all types of campaign, regardles of whether or not they have other, more specialized UIs.

=Initial API=

Two API functions will be provided initially. Their main use will be for Wikimetrics to pull information about campaigns and create corresponding user cohorts. One function will be for listing and searching for campaigns, and will return general information about them. The other will be for retrieving lists of participants and/or organizers. As data points are added (articles worked on, time frame, etc.) additional API functions may be be added. Top-level components for specific campaign types may also provide specialized APIs, as required. If Wikibase is used for data persistence, then it will also be possible to access the data via Wikibase APIs.