Appearance
Semi-Offline Synchronization Protocol (ANBK Standard)
1. Assessment Data Sync Sequence
The sync protocol coordinates periodic data transfer between local lab servers and the central portal: pulling encrypted question packages (Pull Data) and pushing student examination responses (Push Results).
mermaid
sequenceDiagram
autonumber
participant LabServer as School Lab CBT Server
participant Portal as Intelektika Central Hub
participant DB as MongoDB Database
LabServer->>Portal: POST /api/v1/sync/verify-server { serverCode, npsn, token }
Portal->>DB: Validate license status & server authorization
Portal-->>LabServer: HTTP 200 OK (Handshake Successful)
LabServer->>Portal: GET /api/v1/sync/pull-questions?serverCode=SRV-20201234-01
Portal-->>LabServer: Encrypted Exam Package + SHA-256 Checksum
Note over LabServer: Exam Administered Offline in School Lab
LabServer->>Portal: POST /api/v1/sync/push-answers { serverCode, checksum, payload }
Portal->>Portal: Verify Checksum SHA-256 of Response Payload
Portal->>DB: Save Student Answers & Write SyncLog Audit Entry
Portal-->>LabServer: HTTP 200 OK (Sync Receipt Issued)2. Sync Action Domain Matrix (SyncAction)
| Action Code | Enum (SyncAction) | Primary Purpose | Flow Direction |
|---|---|---|---|
| Verify Server | verify_server | Initial handshake validating lab server authenticity | Client $ |
| ightarrow$ Server | |||
| Pull Data | pull_data | Retrieval of student rosters, schedules & exam packages | Server $ |
| ightarrow$ Client | |||
| Push Results | push_results | Transmission of encrypted student examination answers | Client $ |
| ightarrow$ Server | |||
| Heartbeat | heartbeat | Real-time status ping reporting connected student counts | Client $ |
| ightarrow$ Server |
3. Server Monitoring Model (ServerMonitor)
Heartbeat requests update live server status records in the server_monitors MongoDB collection:
go
type ServerMonitor struct {
ID bson.ObjectID `bson:"_id,omitempty" json:"id"`
ServerCode string `bson:"server_code" json:"server_code"`
NPSN string `bson:"npsn" json:"npsn"`
SchoolName string `bson:"school_name" json:"school_name"`
HardwareID string `bson:"hardware_id,omitempty" json:"hardware_id,omitempty"`
Status string `bson:"status" json:"status"` // online, offline, syncing
ActiveExamsCount int `bson:"active_exams_count" json:"active_exams_count"`
ConnectedStudents int `bson:"connected_students" json:"connected_students"`
ClientIP string `bson:"client_ip" json:"client_ip"`
ClientVersion string `bson:"client_version" json:"client_version"`
LastPingAt time.Time `bson:"last_ping_at" json:"last_ping_at"`
UpdatedAt time.Time `bson:"updated_at" json:"updated_at"`
}