Skip to content

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 CodeEnum (SyncAction)Primary PurposeFlow Direction
Verify Serververify_serverInitial handshake validating lab server authenticityClient $
ightarrow$ Server
Pull Datapull_dataRetrieval of student rosters, schedules & exam packagesServer $
ightarrow$ Client
Push Resultspush_resultsTransmission of encrypted student examination answersClient $
ightarrow$ Server
HeartbeatheartbeatReal-time status ping reporting connected student countsClient $
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"`
}