← Back to Portfolio


NBAIS Staff Headcount Portal
Lead Systems Architect
The Challenge
A concurrent-safe staff verification system deployed simultaneously across 7+ state offices, built on Google Apps Script and Google Sheets.
The Engineering Win
Used LockService to serialize writes and generate atomic, gapless reference numbers under concurrent submissions, with duplicate-ID and duplicate-IPPIS checks re-validated inside the lock to close the race-condition window, plus a counter that re-seeds itself from actual row count on redeploy to prevent collisions.
Atomic reference number generation under concurrent load
function generateReferenceNumber() {
const lock = LockService.getScriptLock();
lock.waitLock(30000);
try {
const sheet = SpreadsheetApp.getActive().getSheetByName("Staff");
const lastRow = sheet.getLastRow();
// Re-seed counter from actual row count, not a stored value,
// so a redeploy or manual edit can never cause a collision.
let counter = lastRow;
let refNumber;
do {
counter++;
refNumber = "NBAIS-2026-" + String(counter).padStart(4, "0");
} while (isDuplicateReference(sheet, refNumber));
return refNumber;
} finally {
lock.releaseLock();
}
}See It In Use

Staff Headcount 2026 landing page

Reprint verification slip form

Supervision and custodian posting form
Quantifiable Result
94% staff participation (566 of 600+) with zero data loss across simultaneous multi-office deployment.
Full Capabilities
- •Staff identity verification and headcount submission
- •Examination supervision posting letters, generated per staff member
- •Admin dashboard with global search and bulk printing
- •CSV export for government reporting
- •Full audit logging of every record change
- •Passport photo upload and storage
Tech Stack
Google Apps ScriptLockServiceGoogle SheetsAudit Logging