Design and Practice of a Multi-Role Tour Project Scheduling and Collaboration System
This article details the design and implementation of a scheduling and collaboration system tailored for multi-role tour projects. It covers translating business requirements into technical architecture, data modeling, conflict detection algorithms, and release approval mechanisms. Key topics include data consistency under high concurrency, offline collaboration, and system observability, offering a comprehensive guide to building a robust scheduling system.
1. From Business Information to Technical Problems
The core facts of the original scenario can be abstracted as follows: multiple types of roles participate in the same tour project; centralized meet-and-greets coexist with consecutive performances; role assignments and interactive teaching sessions require unified scheduling; and cross-city tours bring continuous changes to resources and time windows. Translating this into technical terms, it is a typical multi-role, multi-resource, multi-time-window scheduling collaboration problem.
The system must simultaneously manage six types of entities: “people, roles, sessions, tasks, venues, and changes,” maintaining data consistency under high-concurrency editing, frequent changes, and cross-team collaboration. Common pain points include: information scattered across spreadsreads and instant messaging, leading to late discovery of conflicts; non-traceable scheduling versions, making post-release rollbacks difficult; duplicate or missed notifications; ambiguous permission boundaries; difficulty in merging mobile edits under weak network conditions; and lack of audit records leading to unclear accountability. Therefore, system design should not merely act as a “spreadsheet replacement” but should build a complete closed loop around conflict detection, versioned releases, event notifications, and audit traceability.
2. Requirements and Non-Functional Goals
Functional requirements include: resource directory management, schedule orchestration, conflict detection, approval and release, notification and calendar subscription, audit traceability, batch import/export, and statistical reports. Non-functional goals include: data consistency, service availability, observability, security and compliance, scalability, and offline collaboration capabilities.
Specifically, consistency requires that schedule releases have transaction boundaries and idempotency; availability requires separation of editing and querying, with cacheable hot views; observability requires monitoring metrics like conflict detection latency, release success rate, and notification delay; security requires least privilege, field desensitization, and append-only audit logs; scalability requires that adding new role types or activity types does not necessitate restructuring the core model; offline collaboration requires that mobile drafts can be saved locally and undergo server-side secondary conflict detection upon reconnection.
3. Overall Architecture and Key Processes
The system can be divided into an access layer, scheduling service, conflict detection engine, resource directory service, version and approval service, notification center, audit log, and monitoring and alerting. The storage layer uses a relational database for master data and schedules, a cache service for hot schedule views, a message queue to decouple change events, object storage for imported files and reports, and log and monitoring services for runtime observation.
The key process is: Edit Draft -> Save Change Set -> Trigger Conflict Detection -> Submit Approval -> Release Snapshot -> Send Event Notification -> Write Audit Log. All write operations carry an idempotency key and a base version number. During release, the version is validated first, then the snapshot is written, and an event is published. The notification center consumes events by type, retries on failure, and handles dead letters. This process changes “directly modifying the live schedule” to “change set approval and release,” significantly reducing the risk of misoperation.
4. Data Model and Examples
It is recommended to use tables such as project, role, member, venue, session, task, assignment, change_request, and audit_log. Personal information like member names should be desensitized, and permissions should be scoped by project and role. Example SQL is as follows:
CREATE TABLE project (id VARCHAR(64) PRIMARY KEY,name VARCHAR(128) NOT NULL,timezone VARCHAR(64) NOT NULL,status VARCHAR(32) NOT NULL,version BIGINT NOT NULL DEFAULT 0);CREATE TABLE role (id VARCHAR(64) PRIMARY KEY,project_id VARCHAR(64) NOT NULL,name VARCHAR(64) NOT NULL,max_consecutive_sessions INT NOT NULL DEFAULT 2);CREATE TABLE session (id VARCHAR(64) PRIMARY KEY,project_id VARCHAR(64) NOT NULL,venue_id VARCHAR(64) NOT NULL,start_at TIMESTAMP NOT NULL,end_at TIMESTAMP NOT NULL,status VARCHAR(32) NOT NULL,version BIGINT NOT NULL DEFAULT 0);CREATE TABLE assignment (id VARCHAR(64) PRIMARY KEY,session_id VARCHAR(64) NOT NULL,member_id VARCHAR(64) NOT NULL,role_id VARCHAR(64) NOT NULL,status VARCHAR(32) NOT NULL);CREATE TABLE change_request (id VARCHAR(64) PRIMARY KEY,project_id VARCHAR(64) NOT NULL,base_version BIGINT NOT NULL,status VARCHAR(32) NOT NULL,payload_json TEXT NOT NULL,created_by VARCHAR(64) NOT NULL);
Change sets can use JSON to describe additions, deletions, and modifications, with the server validating each item by entity type. All time intervals use half-open intervals [start_at, end_at) to prevent adjacent sessions from being falsely identified as overlapping.
5. Conflict Detection Algorithm
Hard conflicts include: time overlap for the same member, time overlap at the same venue, role qualification mismatch, consecutive sessions exceeding the limit, and insufficient rest intervals. Soft conflicts include unmet preferences, long commute times, and unbalanced workloads. Hard conflicts must block the release, while soft conflicts provide suggestions and allow approval with explanations.
A sweep line algorithm can be used: sort by start time, maintain a set of active intervals, remove ended intervals, and only compare with active intervals. Pseudocode is as follows:
function detectConflicts(assignments):sort assignments by start_at ascactive = []conflicts = []for a in assignments:active = [b in active where b.end_at > a.start_at]for b in active:if a.member_id == b.member_id:conflicts.add(HARD_MEMBER_OVERLAP, a, b)if a.venue_id == b.venue_id:conflicts.add(HARD_VENUE_OVERLAP, a, b)active.add(a)checkConsecutiveSessions(assignments)return conflicts
The complexity of this algorithm is approximately O(n log n + k), where k is the number of conflicts. The output should include severity level, involved entities, time intervals, and explainable suggestions to help schedulers resolve issues quickly. Consecutive sessions can be validated using a sliding window after grouping by member.
6. Release Approval, Consistency, and Auditing
The schedule state machine is recommended to be: Draft, Pending Approval, Approved, Released, and Archived. The release operation performs optimistic locking validation based on the base version number; if the version is inconsistent, a mergeable prompt is returned. The release process writes the snapshot, sends change events, and appends the audit log. If it fails, the transaction is rolled back. Notification consumption uses an idempotency key composed of the event ID and recipient to prevent duplicate alerts.
Audit logs are append-only, recording the operator, change set, before and after snapshot summaries, time, and result; sensitive fields are desensitized. Permissions are controlled at three levels: project, role, and field. Approvers and editors are separated, and critical operations require dual-person review.
7. Notification, Calendar, and Weak Network Collaboration
The notification center consumes schedule release, change, and cancellation events, generates messages based on templates, retries on failure, and records dead letters. Calendar subscriptions output read-only snapshots to prevent direct modifications by subscribers. The mobile client supports offline drafts, locally flagging potential conflicts. Upon reconnection, it submits the change set, and the server executes secondary conflict detection and version merging. The merge strategy should explicitly prompt the user to choose which version to retain and must not silently overwrite data.
8. Observability and O&M
Core metrics include conflict detection latency, release success rate, notification delay, synchronization failure rate, data quality anomaly count, and audit write failure count. Logs are structured and desensitized, with alerts classified by severity. Before launch, conduct sweep line stress testing, release rollback drills, and notification peak testing. After launch, use a grayscale release strategy, observing error rates and latency before expanding the rollout.
9. Implementation Roadmap and Best Practices
Implementation can be divided into five steps: first, standardize the resource directory and time intervals; second, establish the scheduling model and batch import; third, introduce hard conflict detection; fourth, complete approval, release, and auditing; finally, build notifications, monitoring, and offline collaboration. Best practices are “hard conflicts first, soft conflicts later,” “change set release,” “idempotent write operations,” “explainable conflicts,” “least privilege,” “append-only audit,” and “grayscale rollback.” Through this design, multi-role tour projects can maintain clear schedules, orderly collaboration, and traceable results under high change frequencies.
