Registration Application Database Design

Entity Relationship Diagram for a comprehensive registration system

Applicant

  • applicant_id (PK)
  • first_name
  • last_name
  • date_of_birth
  • gender
  • email
  • phone
  • address
  • created_at
  • updated_at

Application

  • application_id (PK)
  • applicant_id (FK)
  • application_date
  • status
  • program_type
  • term
  • year
  • submission_date
  • review_date
  • decision_date

Document

  • document_id (PK)
  • application_id (FK)
  • document_type
  • file_name
  • file_path
  • upload_date
  • verified
  • verification_date

Payment

  • payment_id (PK)
  • application_id (FK)
  • amount
  • payment_date
  • payment_method
  • transaction_id
  • status
  • receipt_number

Education

  • education_id (PK)
  • applicant_id (FK)
  • institution_name
  • degree
  • field_of_study
  • start_date
  • end_date
  • gpa
  • country

Reference

  • reference_id (PK)
  • application_id (FK)
  • name
  • email
  • phone
  • relationship
  • institution
  • position
  • submission_status

Test Score

  • test_score_id (PK)
  • applicant_id (FK)
  • test_type
  • score
  • test_date
  • reporting_date
  • valid_until
1 to N
1 to N
1 to N
1 to N
1 to N
1 to N

Database Schema Explanation

  • Applicant

    Stores personal information about individuals applying for registration.

  • Application

    Tracks each application submission with status and timeline information.

  • Document

    Manages all supporting documents uploaded with each application.

  • Payment

    Records all payment transactions related to application fees.

Key Relationships

  • Education

    Stores academic history of applicants with institution details.

  • Reference

    Manages reference contacts provided by applicants.

  • Test Score

    Tracks standardized test scores submitted by applicants.

  • Relationships

    All entities relate back to Applicant and Application with 1-to-many relationships.

SQL Schema Generation

-- Applicant Table
CREATE TABLE applicants (
    applicant_id SERIAL PRIMARY KEY,
    first_name VARCHAR(100) NOT NULL,
    last_name VARCHAR(100) NOT NULL,
    date_of_birth DATE NOT NULL,
    gender VARCHAR(20),
    email VARCHAR(255) NOT NULL UNIQUE,
    phone VARCHAR(50),
    address TEXT,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Application Table
CREATE TABLE applications (
    application_id SERIAL PRIMARY KEY,
    applicant_id INTEGER REFERENCES applicants(applicant_id),
    application_date DATE NOT NULL,
    status VARCHAR(50) NOT NULL,
    program_type VARCHAR(100),
    term VARCHAR(50),
    year INTEGER,
    submission_date TIMESTAMP,
    review_date TIMESTAMP,
    decision_date TIMESTAMP
);

-- Document Table
CREATE TABLE documents (
    document_id SERIAL PRIMARY KEY,
    application_id INTEGER REFERENCES applications(application_id),
    document_type VARCHAR(100) NOT NULL,
    file_name VARCHAR(255) NOT NULL,
    file_path TEXT NOT NULL,
    upload_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    verified BOOLEAN DEFAULT FALSE,
    verification_date TIMESTAMP
);

-- Payment Table
CREATE TABLE payments (
    payment_id SERIAL PRIMARY KEY,
    application_id INTEGER REFERENCES applications(application_id),
    amount DECIMAL(10,2) NOT NULL,
    payment_date TIMESTAMP NOT NULL,
    payment_method VARCHAR(50),
    transaction_id VARCHAR(100),
    status VARCHAR(50) NOT NULL,
    receipt_number VARCHAR(100)
);

-- Education Table
CREATE TABLE education (
    education_id SERIAL PRIMARY KEY,
    applicant_id INTEGER REFERENCES applicants(applicant_id),
    institution_name VARCHAR(255) NOT NULL,
    degree VARCHAR(100),
    field_of_study VARCHAR(255),
    start_date DATE,
    end_date DATE,
    gpa DECIMAL(3,2),
    country VARCHAR(100)
);

-- Reference Table
CREATE TABLE references (
    reference_id SERIAL PRIMARY KEY,
    application_id INTEGER REFERENCES applications(application_id),
    name VARCHAR(255) NOT NULL,
    email VARCHAR(255),
    phone VARCHAR(50),
    relationship VARCHAR(100),
    institution VARCHAR(255),
    position VARCHAR(255),
    submission_status VARCHAR(50) DEFAULT 'Pending'
);

-- Test Score Table
CREATE TABLE test_scores (
    test_score_id SERIAL PRIMARY KEY,
    applicant_id INTEGER REFERENCES applicants(applicant_id),
    test_type VARCHAR(100) NOT NULL,
    score VARCHAR(50),
    test_date DATE,
    reporting_date DATE,
    valid_until DATE
);
                

Database Operations

Add New Applicant

Query Database

======= }); // Backend connection functionality const API_BASE_URL = 'http://localhost:3000/api'; // Update with your backend URL // Handle applicant form submission document.getElementById('applicant-form').addEventListener('submit', async function(e) { e.preventDefault(); const formData = new FormData(this); const data = Object.fromEntries(formData.entries()); try { const response = await fetch(`${API_BASE_URL}/applicants`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }); const result = await response.json(); alert('Applicant added successfully!'); console.log('Success:', result); } catch (error) { console.error('Error:', error); alert('Error submitting applicant data'); } }); // Handle data fetching document.getElementById('fetch-data').addEventListener('click', async function() { const entity = document.getElementById('entity-select').value; const resultsDiv = document.getElementById('query-results'); const pre = resultsDiv.querySelector('pre'); try { const response = await fetch(`${API_BASE_URL}/${entity}`); const data = await response.json(); resultsDiv.classList.remove('hidden'); pre.textContent = JSON.stringify(data, null, 2); } catch (error) { console.error('Error:', error); resultsDiv.classList.remove('hidden'); pre.textContent = 'Error fetching data'; } }); }); document.addEventListener('DOMContentLoaded', function() { // Toggle between compact and detailed view const toggleViewBtn = document.getElementById('toggle-view'); const entities = document.querySelectorAll('.entity'); let isCompact = false; toggleViewBtn.addEventListener('click', function() { isCompact = !isCompact; entities.forEach(entity => { if (isCompact) { entity.classList.add('w-40'); entity.classList.remove('w-64'); entity.querySelector('ul').classList.add('hidden'); } else { entity.classList.remove('w-40'); entity.classList.add('w-64'); entity.querySelector('ul').classList.remove('hidden'); } }); toggleViewBtn.innerHTML = isCompact ? 'Expand View' : 'Compact View'; }); // Download functionality (simulated) const downloadBtn = document.getElementById('download-btn'); downloadBtn.addEventListener('click', function() { alert('Diagram download would be initiated here in a real implementation.'); }); // Add hover effects to entities entities.forEach(entity => { entity.addEventListener('mouseenter', function() { const entityType = this.getAttribute('data-entity'); document.querySelectorAll(`[data-entity="${entityType}"]`).forEach(el => { el.classList.add('ring-2', 'ring-offset-2'); if (entityType === 'applicant') el.classList.add('ring-blue-400'); if (entityType === 'application') el.classList.add('ring-purple-400'); if (entityType === 'document') el.classList.add('ring-green-400'); if (entityType === 'payment') el.classList.add('ring-yellow-400'); if (entityType === 'education') el.classList.add('ring-red-400'); if (entityType === 'reference') el.classList.add('ring-indigo-400'); if (entityType === 'test_score') el.classList.add('ring-pink-400'); }); }); entity.addEventListener('mouseleave', function() { const entityType = this.getAttribute('data-entity'); document.querySelectorAll(`[data-entity="${entityType}"]`).forEach(el => { el.classList.remove('ring-2', 'ring-offset-2', 'ring-blue-400', 'ring-purple-400', 'ring-green-400', 'ring-yellow-400', 'ring-red-400', 'ring-indigo-400', 'ring-pink-400'); }); }); }); });

Made with DeepSite LogoDeepSite - 🧬 Remix