Application Process
Overview
This document outlines the processes for managing applications and programs within the system. It details the functions for retrieving and creating applications, as well as managing program data.
Features
- Retrieve Application by Short ID: Fetches a single application by its short application ID along with associated user details and academic qualifications.
- Create or Update Application: Handles the creation of a new application or updates an existing one, including user details and academic qualifications.
- Retrieve Program Names: Fetches the names of all available programs from the database.
- Seed Programs: Populates the database with predefined program data.
Flow Diagram
+---------------------------------------------------------+
| Start |
+---------------------------------------------------------+
| | |
| | |
| | |
+---------------------------+ +-----------------+ +-----------------+
| Retrieve Application by | | Retrieve Program| | Seed Programs |
| Short ID | | Names | | |
+---------------------------+ +-----------------+ +-----------------+
| | |
| | |
v v |
+---------------------------+ +-----------------+ |
| Fetch Application Details | | Fetch Programs | |
+---------------------------+ | from Database | |
| | |
| | |
+----------------+ +-----------------+ |
| Application | | Return Program | |
| Found | | Names | |
+----------------+ +-----------------+ |
| v
| +---------------------+
v | Define Programs |
+--------------------+ | and Levels |
| Return Application | +---------------------+
| Details | |
+--------------------+ |
| +--------------------+
| | Delete Existing |
v | Program Data |
+--------------------+ +--------------------+
| Application Not | |
| Found | |
+--------------------+ v
| +---------------------+
v | Insert New Program |
+--------------------+ | Data |
| Return Error Msg | +---------------------+
+--------------------+ |
| +---------------------+
v | Return Success or |
+--------------------------+ | Error Message |
| Create or Update Application| +---------------------+
+--------------------------+
|
|
v
+-------------------------+
| Validate Application |
| Data |
+-------------------------+
|
v
+--------------------------+
| Check if User Exists |
+--------------------------+
|
+--------------------+
| User Exists |
| Update User Details|
+--------------------+
|
+------------------------+
| Check if Application |
| Exists |
+------------------------+
|
+--------------------+ +------------------+
| Application Exists | | No Application |
| Update Application | | Create New App |
+--------------------+ +------------------+
|
+--------------------------+
| Update Academic |
| Qualifications |
+--------------------------+
|
v
+--------------------------+
| Return Success or |
| Error Message |
+--------------------------+
Detailed Breakdown
Retrieve Application by Short ID
Process
- Fetch Application Details: The system fetches an application from the database using the provided short application ID.
- Includes associated user details and academic qualifications.
- If the application is found, the details are returned.
- If the application is not found, an error message is returned.
Key Steps
- Query the database for the application by its short ID.
- Include nested relations with the user and academic qualifications.
- Handle potential errors and return appropriate messages.
Create or Update Application
Process
-
Validate Application Data: The system validates the data provided in the application form.
- Checks if the user already exists based on the email address.
- If the user exists, updates the user details.
- Checks if an application already exists for the user.
- If an application exists, updates the application and academic qualifications.
- If no application exists, creates a new application and academic qualifications.
- If the user does not exist, creates a new user and application.
-
Return Success or Error Message: After processing, the system returns a success message with the application ID or an error message if any issues occurred.
Key Steps
- Validate input data using predefined schemas.
- Use database operations to check for existing users and applications.
- Create or update user and application records.
- Handle potential errors and ensure data consistency.
Retrieve Program Names
Process
-
Fetch Programs from Database: The system retrieves all program records from the database.
- Includes program levels and durations.
- Returns the names of the programs in a formatted list.
-
Return Program Names or Error Message: If successful, returns the list of program names. If an error occurs, returns an error message.
Key Steps
- Query the database for program records.
- Map the program names and levels into a list.
- Handle potential errors and return appropriate messages.
Seed Programs
Process
-
Define Programs and Levels: The system defines a set of programs and their respective levels and durations.
- Deletes existing program and level data from the database.
- Inserts the predefined program data into the database.
- Returns a success message upon completion.
-
Return Success or Error Message: After processing, the system returns a success message or an error message if any issues occurred.
Key Steps
- Define a list of programs and their levels.
- Use database operations to clear existing data.
- Insert new program data into the database.
- Handle potential errors and ensure data consistency.
Relational Diagram
+----------------+ +----------------+
| USER | | STUDENT |
|----------------| |----------------|
| id | |----------| | id |
| name |--| |--| userId |
| surname | | | | registrationNo |
| email | | | | currentProgram |
| dateOfBirth | | | | currentLevel |
| nationalID | | | +----------------+
| nationality | | |
| gender | | | +----------------+
| cellNumber | | | | PROGRAM |
| homeAddress | | | |----------------|
| studentemail | | |---------| id |
+----------------+ | programName |
+----------------+
| | |
| "has" | | "has"
| | |
| +----------------+ |
| | PROGRAM_LEVEL | |
| |----------------| |
| | id | |
| | programId |--|
| | level |
| | duration |
| +----------------+
+-------------------+ +-------------------+
| APPLICATION | | ACADEMIC_QUALIF. |
|-------------------| |-------------------|
| id |--| | id |
| userId | |-----| applicationId |
| applicationId | | examBody |
| shortAppId | | level |
| status | | subject |
| nameOfProgram | | grade |
| classPreference | +-------------------+
+-------------------+
|
| "has"
|
|
+-------------------+
| STATUS_HISTORY |
|-------------------|
| id |
| applicationId |
| status |
| date |
+-------------------+