Skip to content

Import data manual review

Derrick Liu requested to merge svdsa/membership_api:import-review into dev

@DSASanFrancisco/portal-members

Summary

This PR contains changes that enable a manual data import review workflow. For more information, see this issue or this spec doc.

Corresponding UI PR svdsa/membership_ui!9 (merged)

  • DB models for representing persistent state
  • API routes for
    • listing all reviewable events
    • getting the details of a particular previous review session
    • getting details for a particular reviewable event (in order to start a review session on the client)
    • creating or updating a review session in progress
  • logic to
    • do any of the above

Notes

Database modeling

Updated around 2020-12-06 to add some action types.

🔍 Please review conceptually (i.e. does this structure make sense) and for SQLAlchemy specifics - I don't know if I set up the relationships or the column types properly (especially the JSON type, since the project uses MariaDB which should alias to LONGTEXT)

ReviewableEvent

A ReviewableEvent is any inbound event that may introduce a roster of new members to the system. Examples include video calls (e.g. a Zoom meeting), newsletter signups (e.g. a Mailjet / Mailchimp signup), a new membership roster spreadsheet from DSA National, and more.

The type of event is represented as an enum ReviewableEventType, and additional information about the event is represented in the event_info column as JSON.

ReviewableEventParticipant

A ReviewableEventParticipant is a collection of contact info representing an attendee, registrant, or participant for a ReviewableEvent.

As part of the manual review-and-match workflow, a reviewer may choose to match this participant to an existing member or create a new member record for them.

The table contains some common info that should be present in most collection forms (email address, phone number), and allows the incoming data to specify additional info via the more_info_json field.

ReviewSession

A ReviewSession represents a user-initiated manual review process. It contains info about the reviewing user, the time of the review, and refers to a list of final actions the reviewer decided upon.

ReviewSessionAction

A ReviewSessionAction represents a single review action in a ReviewSession. The ReviewSessionAction is bound to a particular ReviewEventParticipant and contains some information about the action.

Upon creating the review session, the server should create a ReviewSessionAction for each participant to preserve this action for historical lookup.

ReviewSessionActionType enumerates the possible outcomes for each action:

CREATE_NEW_MEMBER: The reviewer chose to create a new member for this participant. The server should create a new member for this participant and use the match fields to link this participant to the newly created member.

IGNORE_ONCE: The reviewer chose not to do anything with this participant.

MATCH_AUTO: When retrieving info for a reviewable event, the server may suggest automatic matches for particular participants. If the reviewer confirms these matches, the server should represent the automatic match with this action type and link the matched member using the matched fields.

MATCH_MANUAL: The reviewer selected a member to match this participant with. The server should use the match fields to record which member the participant was matched to, and a JSON column for info on how conflicts were resolved.

PROPOSED_MATCH: The session is automatically generated by an incoming event, and some automated heuristic proposes matching this participant with an existing member, noted in match

PROPOSED_CREATE: Same as above, except the automated heuristic proposes creating a new member entry for this participant.

Edited by Derrick Liu

Merge request reports