Mock Data System
The Mock Data System provides a complete simulated backend for JPortal, enabling development, testing, and demonstration without requiring actual JIIT portal credentials or network connectivity. This system consists of the MockWebPortal class and a comprehensive fakedata.json file containing realistic sample data for all application features.
For information about the real backend integration using the jsjiit library, see Data Layer & API Integration.
Purpose and Scope
The Mock Data System serves three primary functions:
- Development Mode: Allows developers to work on the application without valid JIIT credentials
- Demo Mode: Enables users to explore JPortal's features before logging in with real credentials
- Testing Environment: Provides consistent, reproducible data for testing UI components and application logic
The system implements the same interface as the WebPortal class from the jsjiit library, allowing seamless switching between mock and real modes without component code changes.
Sources: src/components/MockWebPortal.js1-114 src/App.jsx20-29
Architecture Overview
Portal Abstraction Pattern
The application creates both portal instances at the top level and selects one based on the authentication mode:

Sources: src/App.jsx27-29 src/App.jsx250 src/App.jsx360
Interface Compatibility
The MockWebPortal class implements all methods expected by feature components:
| Method Category | Methods | Purpose |
|---|---|---|
| Authentication | student_login() |
Returns immediately with success |
| Attendance | get_attendance_meta(), get_attendance(), get_subject_daily_attendance() |
Provides attendance data and metadata |
| Grades | get_sgpa_cgpa(), get_semesters_for_grade_card(), get_grade_card(), get_semesters_for_marks(), download_marks() |
Returns grade and marks information |
| Exams | get_semesters_for_exam_events(), get_exam_events(), get_exam_schedule() |
Provides exam schedule data |
| Subjects | get_registered_subjects_and_faculties(), get_registered_semesters() |
Returns subject registration info |
| Profile | get_personal_info() |
Returns student profile data |
Sources: src/components/MockWebPortal.js3-114
Data Organization (fakedata.json)
Domain Structure
The fakedata.json file is organized into five top-level domains corresponding to JPortal's feature modules:

Sources: src/assets/fakedata.json1-4077
Attendance Domain
The attendance domain contains data for two semesters with comprehensive attendance records:
Structure:
semestersData: Contains semester metadata and the latest semester referencesemesters: Array of semester objects withregistration_idandregistration_codelatest_header: Header identifier stringlatest_semester: Reference to the current semester
attendanceData: Keyed by semester code (e.g.,"2025EVESEM")studentattendancelist: Array of subject attendance records containing:- Subject identification:
subjectcode,subjectdesc,individualsubjectcode,subjectid - Attendance counts:
Ltotalclass,Ltotalpres,Lpercentage(Lecture) - Tutorial counts:
Ttotalclass,Ttotalpres,Tpercentage - Practical counts:
Ptotalclass,Ptotalpres,Ppercentage - Overall percentage:
LTpercantage
- Subject identification:
subjectAttendanceData: Keyed byindividualsubjectcode(e.g.,"15B11EC611")- Contains detailed daily attendance records with:
datetime: Class date and timeclasstype: "Lecture", "Tutorial", or "Practical"present: "Present" or "Absent"attendanceby: Faculty name
- Contains detailed daily attendance records with:
Example semester codes: "2025EVESEM", "2025ODDSEM"
Sources: src/assets/fakedata.json1-2283
Grades Domain
Contains SGPA/CGPA trends, grade cards, and detailed marks data:
Structure:
gradesData: Array of semester-wise grade records with:semester_id,registration_id,semester_aliassgpa: Semester GPA valuecgpa: Cumulative GPA valuesemester_credits_earned,semester_credits_registeredtotal_credits_earned
gradeCardSemesters: Array of semesters for which grade cards are availablegradeCards: Keyed by semester codegradecard: Array of course grade entries with:- Course info:
subjectcode,subjectdesc,credits - Component grades:
ca,mid,tf,pr,lw,att,jc - Final result:
total,grade
- Course info:
marksSemesters: Array of semesters with marks PDFsmarksData: Keyed by semester codecourses: Array of courses with:- Course details:
subjectCode,subjectName - Assessment components:
sessionalMarks,midTermMarks,endTermMarks,practicalMarks,totalMarks - Grade:
grade
- Course details:
Sources: src/assets/fakedata.json2284-3281
Exams Domain
Provides exam event metadata and detailed schedules:
Structure:
examSemesters: Array of semester objects with exam eventsexamEvents: Keyed by semester code- Array of exam event objects with:
exameventid,examtypecode,examtypedescription- Date range:
fromdate,todate - Status:
schedulepublished
- Array of exam event objects with:
examSchedule: Keyed by exam event ID- Array of subject exam details with:
- Subject:
subjectcode,subjectdesc - Scheduling:
examdate,examtime,examtiming - Location:
room
- Subject:
- Array of subject exam details with:
Sources: src/assets/fakedata.json3282-3719
Subjects Domain
Contains registered subjects, faculty assignments, and credits information:
Structure:
semestersData: Semester metadatasemesters: Array of available semesterslatest_semester: Current semester reference
subjectData: Keyed by semester codesubjects: Array of subject objects with:- Identification:
subjectcode,subjectdesc,individualsubjectcode - Credit info:
l_credit,t_credit,p_credit,total_credits - Faculty:
employeename,employeecode - Scheduling:
ltpclassnumber,subjectcomponentids
- Identification:
Sources: src/assets/fakedata.json3720-4050
Profile Domain
Contains comprehensive student information organized into sections:
Structure:
personal_info: Basic details (name, DOB, gender, nationality, etc.)contact_info: Email, phone, addressesfamily_info: Parent/guardian detailsaddress_info: Permanent and correspondence addressesacademic_info: Enrollment, program, branch, admission details
Sources: src/assets/fakedata.json4051-4077
MockWebPortal Implementation
Class Structure

Sources: src/components/MockWebPortal.js3-114
Key Implementation Details
Session Simulation
The constructor creates a minimal session object to match the expected interface:
constructor() {
this.session = { get_headers: async () => ({}) };
}
This prevents errors in components that check for w.session existence.
Sources: src/components/MockWebPortal.js4-6
Intelligent Semester Ordering
The get_attendance_meta() method implements date-aware semester ordering to improve demo UX:

This ensures the "current" semester matches the real academic calendar:
- January-July: Even semester (EVESEM) appears as latest
- August-December: Odd semester (ODDSEM) appears as latest
Sources: src/components/MockWebPortal.js12-46
Data Retrieval Pattern
All data methods follow a consistent pattern:
- Extract semester/event key from the parameter object
- Look up data in
fakeDatausing the key - Return data with appropriate structure or empty fallback
Example from get_attendance():
async get_attendance(header, semester) {
const semKey = semester.registration_code || semester;
return fakeData.attendance.attendanceData[semKey] || { studentattendancelist: [] };
}
This pattern handles both object parameters and string keys, providing robust fallback behavior.
Sources: src/components/MockWebPortal.js48-51 src/components/MockWebPortal.js67-70 src/components/MockWebPortal.js81-91
Method-to-Domain Mapping
| Method | Domain | Data Path | Return Structure |
|---|---|---|---|
get_attendance_meta() |
attendance | semestersData |
{ semesters, latest_header(), latest_semester() } |
get_attendance() |
attendance | attendanceData[semKey] |
{ studentattendancelist } |
get_subject_daily_attendance() |
attendance | subjectAttendanceData[code] |
{ studentAttdsummarylist } |
get_sgpa_cgpa() |
grades | gradesData |
Array of semester grades |
get_grade_card() |
grades | gradeCards[semKey] |
{ gradecard } |
download_marks() |
grades | marksData[semKey] |
{ courses } |
get_exam_schedule() |
exams | examSchedule[eventKey] |
{ subjectinfo } |
get_registered_subjects_and_faculties() |
subjects | subjectData[semKey] |
{ subjects, registered_subject_faculty } |
get_personal_info() |
profile | root | Complete profile object |
Sources: src/components/MockWebPortal.js12-114
Integration Points
Demo Mode Activation
The demo mode flow involves user interaction in the Login component and state management in App:

Sources: src/components/Login.jsx41-43 src/App.jsx295-298 src/App.jsx250
Portal Selection Logic
The active portal is determined at render time based on the isDemoMode state:
In App.jsx:
const activePortal = isDemoMode ? mockPortal : realPortal;
This selection happens before rendering AuthenticatedApp, and the chosen portal is passed down as the w prop to all feature components.
Sources: src/App.jsx250 src/App.jsx360
Component Usage Pattern
Feature components receive the portal instance via the w prop and use it identically regardless of whether it's the real or mock portal:

Components never need to check which portal they're using—the interface contract ensures compatibility.
Sources: src/App.jsx110-214
Logout and Mode Switching
The Header component provides logout functionality that clears demo mode:
setIsDemoMode(false);
This triggers a re-render with the realPortal selected, and the user is presented with the Login screen again.
Sources: src/App.jsx105
Mock Data Characteristics
Data Volume
The fakedata.json file contains realistic data volumes:
| Domain | Key Metric | Count |
|---|---|---|
| Attendance | Subjects per semester | 10 (EVESEM), 6 (ODDSEM) |
| Attendance | Daily records for main subject | 36 records |
| Grades | Semester records | 8 semesters |
| Grades | Courses per grade card | ~8-10 courses |
| Exams | Events per semester | 1-2 events |
| Exams | Subjects per exam event | 6-10 subjects |
| Subjects | Subjects per semester | 8-10 subjects |
| Profile | Information sections | 5 sections |
Sources: src/assets/fakedata.json1-4077
Data Realism
The mock data includes:
- Realistic attendance patterns: Mix of Present/Absent with varying percentages (66-92%)
- Multiple class types: Lectures, Tutorials, Practicals with different attendance counts
- Faculty names: Indian names matching JIIT faculty patterns (e.g., "HARLEEN KAUR", "RUBY BENIWAL")
- Academic terminology: Actual JIIT subject codes and descriptions
- Date patterns: Dates distributed throughout semester months
- Grade distributions: Realistic SGPA/CGPA values and grade patterns
- Subject diversity: Mix of core subjects, electives, and lab courses
Sources: src/assets/fakedata.json287-503 src/assets/fakedata.json2284-2400
Extensibility
To add new mock data:
- Identify the domain (attendance, grades, exams, subjects, profile)
- Follow the existing structure within that domain
- Add semester-keyed entries for semester-specific data
- Update MockWebPortal methods if new API endpoints are needed
- Ensure key consistency (use
registration_codeor similar as keys)
The system's pattern-based design makes it straightforward to extend with additional semesters, subjects, or data types.
Sources: src/components/MockWebPortal.js1-114