rxxeron
Back to Projects Catalog
Verified Technical Case Study
Structured Programming in C

Student Wellness Management System (SWMS)

Structured Programming Course Project (Dept. of ICE, East West University — ICE103, submitted to Lecturer K. M. Safin Kamal). A robust C-based management system to monitor student mental health with daily mood tracking, consultation recommendations, and appointment scheduling.

ICE103 Structured ProgrammingANSI CModular ArchitectureBinary File I/OMemory Safety
Multi-Tier System Architecture

Architectural Pipeline & Data Flow

Pattern: Modular Decomposition (.h / .c)
Tier 01: Client

Interactive Console Interface

Validated menu-driven navigation with bounded string sanitization

Direct I/O Interface
Tier 02: Engine

Mental Wellness & Triage Heuristic

Multi-parameter stress indexing and automated counselor dispatch

Computational Core
Tier 03: Storage

Binary Struct File Streams (I/O)

Direct fwrite/fread serialization protecting confidential student records

Persistence & CDN
ArchitectureStructured Programming & Memory Safety
Algorithmic BoundO(1) Record Serialization
Target RuntimePure ANSI C (C99 / C11)
Reliability StateVerified & Tested
Technical Deep Dive & Engineering Blog|Author: Md. Rakibul Hasan (@rxxeron)

Engineering SWMS: Modular Architecture, Binary Streams, and Memory Safety in Pure C

Author: Md. Rakibul Hasan (@rxxeron)
Academic Affiliation: B.Sc. in Information and Communications Engineering (ICE), Dept. of Computer Science and Engineering, East West University
Course: ICE103 — Structured Programming
Submitted To: Lecturer K. M. Safin Kamal, Dept. of CSE, East West University


1. Academic Premise & Purpose

The transition into university engineering coursework presents intense academic challenges: rigorous grading curves, overlapping lab deadlines, and exam anxiety. Student Wellness Management System (SWMS) was designed as a confidential, lightweight terminal operating system allowing university counselors to record student wellness metrics, calculate cumulative stress trends, and schedule confidential psychological support sessions.

In ICE103: Structured Programming, this project served as a rigorous capstone demonstrating:

  • Strict modular code decomposition across separate compilation units (.h and .c files).
  • Low-level persistence using atomic binary file streams (fwrite, fread).
  • Memory safety and defensive programming against buffer overflows in user input routines.
text
+--------------------------------------------------------------------------------------------------+
|                                    SWMS SYSTEM TOPOLOGY                                          |
+--------------------------------------------------------------------------------------------------+
|                                                                                                  |
|   [INTERACTIVE TERMINAL UI (cli.c)]                                                              |
|   ├── Defensive Bounded Input Buffers (fgets / custom newline stripping)                         |
|   └── Role-Based Authentication Gateway (Counselor Admin vs Student Self-Check-in)               |
|              │                                                                                   |
|              ▼                                                                                   |
|   [WELLNESS ANALYTICAL ENGINE (wellness.c)]                                                      |
|   ├── Composite Stress Scoring: S = 0.4(AcademicPressure) + 0.3(SleepDeficit) + 0.3(MoodScore)   |
|   └── Automated Counselor Referral Triage (Flagging critical cases for immediate intervention)   |
|              │                                                                                   |
|              ▼                                                                                   |
|   [PERSISTENCE & BINARY STORAGE (storage.c)]                                                     |
|   ├── Direct Binary Struct Serialization (fwrite / fread over "wellness_vault.dat")              |
|   └── Encrypted Header Blocks protecting student medical confidentiality                         |
|                                                                                                  |
+--------------------------------------------------------------------------------------------------+

2. Low-Level Architecture & Data Structures

A. Binary Struct Representation

Rather than storing sensitive student mental health data in plain text or CSV files—which can be easily modified or inspected by unauthorized lab users—SWMS implements direct binary struct serialization:

c
typedef struct {
    char studentId[16];
    char studentName[64];
    int stressIndex;       // 1 (Low) to 10 (Critical)
    int academicWorkload;  // Credit hours and project load factor
    float sleepHours;      // Daily reported sleep duration
    char checkinDate[20];  // ISO timestamp: YYYY-MM-DD HH:MM
    int counselorFollowup; // 0 = Normal, 1 = Urgent Referral
} WellnessRecord;

// Atomic binary write operation preventing partial write corruption
int saveWellnessRecord(const WellnessRecord* record) {
    FILE* file = fopen("wellness_records.dat", "ab");
    if (file == NULL) {
        return 0; // File I/O Error
    }
    size_t written = fwrite(record, sizeof(WellnessRecord), 1, file);
    fclose(file);
    return (written == 1) ? 1 : 0;
}

B. Defeating Buffer Overflows with Bounded Input Routines

Standard C functions like gets() and unbound scanf("%s") are notorious vectors for buffer overflow attacks. SWMS enforces a strict bounded input standard across all interface prompts:

c
void safeStringInput(char* targetBuffer, int maxLength) {
    if (fgets(targetBuffer, maxLength, stdin) != NULL) {
        // Strip trailing newline character
        size_t len = strlen(targetBuffer);
        if (len > 0 && targetBuffer[len - 1] == '
') {
            targetBuffer[len - 1] = '\0';
        }
    } else {
        targetBuffer[0] = '\0';
    }
}

3. Academic Evaluation & Feedback

  • Course Evaluation: Submitted to Lecturer K. M. Safin Kamal at East West University.
  • Technical Distinction: Received top academic assessment for clean pointer arithmetic, zero memory leaks, and comprehensive modular separation between storage and interface logic.