Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ijmeisner/einerlei/llms.txt

Use this file to discover all available pages before exploring further.

The MPADQ uses a single MySQL database named Quiz that holds license keys, administrator credentials, demographic survey data, Likert questionnaire content, and computed results. All tables use the InnoDB storage engine to enforce foreign-key relationships. You must create the database and run the SQL setup scripts in the exact order described below before the application will function correctly.

Create the Database

Log in to MySQL as a user with CREATE privileges and run:
CREATE DATABASE Quiz CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Then create a dedicated application user and grant it the permissions the application needs:
CREATE USER 'quiz_app'@'localhost' IDENTIFIED BY 'your-strong-password';
GRANT SELECT, INSERT, UPDATE, DELETE ON Quiz.* TO 'quiz_app'@'localhost';
FLUSH PRIVILEGES;
Record the hostname, username, and password — you will need them when creating src/login.php.

Configure src/login.php

Before running any SQL scripts, create the credentials file that the application requires. This file must exist on the server at src/login.php and must not be committed to version control.
<?php
$host = "your-db-host";
$user = "quiz_app";
$pass = "your-strong-password";
$dtbs = "Quiz";
?>
The default admin account inserted by adminUser.mysql uses the username user1 and the password test (stored as the MD5 hash 098f6bcd4621d373cade4e832627b4f6). Change this password immediately after running the setup scripts. MD5 is not a secure password hashing algorithm for modern systems — update the admin password through the admin dashboard as soon as the application is running.

Run the SQL Setup Scripts

Execute the scripts below in the order listed. Each script targets the Quiz database via a USE Quiz; statement at the top, so you can run them from any working directory.
1

Create the License Table

Run mysql/keyTable.mysql to create the License table, which stores all issued license keys.
mysql -u quiz_app -p Quiz < mysql/keyTable.mysql
This creates:
CREATE TABLE License(
  id         INT UNSIGNED NOT NULL AUTO_INCREMENT,
  licenseKey VARCHAR(255) NOT NULL UNIQUE,
  active     BOOL NOT NULL,
  PRIMARY KEY(id)
) ENGINE = INNODB;
Each row holds one MD5-hashed license key. The active flag is set to true when a key is issued and flipped to false after the quiz is completed.
2

Create the admins Table and Insert Default Admin

Run mysql/adminUser.mysql to create the admins table and insert the default administrator account.
mysql -u quiz_app -p Quiz < mysql/adminUser.mysql
This creates:
CREATE TABLE admins(
  id       INT PRIMARY KEY AUTO_INCREMENT,
  username VARCHAR(255),
  password VARCHAR(255)
);

INSERT INTO admins VALUES (0, 'user1', '098f6bcd4621d373cade4e832627b4f6');
The inserted password is the MD5 hash of test. Change it immediately after setup.
3

Create Demographic Tables and Seed Questions

Run mysql/demographic/demographicTables.mysql to create the demographic survey tables and insert the 14 questions shown to respondents before the Likert section.
mysql -u quiz_app -p Quiz < mysql/demographic/demographicTables.mysql
This creates DemographicQuestion and DemographicAnswer, then inserts the 14 survey questions, including items for gender, age, years of study, instrument/voice type, performance history, health conditions, substance use, and professional goals.
4

Create Likert Tables and Seed Categories

Run mysql/likert/likertTables.mysql to create the five Likert-related tables and seed the broad and sub-category names.
mysql -u quiz_app -p Quiz < mysql/likert/likertTables.mysql
This creates LikertAnswerBroadCategory, LikertAnswerSubCategory, LikertQuestion, LikertValue, and LikertAnswer. It then inserts the two broad categories — Symptomatology and Contributing Factors — along with all 24 sub-categories (3 under Symptomatology and 21 under Contributing Factors).
5

Create Results Tables

Run mysql/likert/likertResults.mysql to create the two tables that store computed quiz results.
mysql -u quiz_app -p Quiz < mysql/likert/likertResults.mysql
This creates:
CREATE TABLE BroadCategoryResult(
  license_id        INT UNSIGNED NOT NULL, FOREIGN KEY(license_id) REFERENCES License(id),
  broad_category_id INT UNSIGNED NOT NULL, FOREIGN KEY(broad_category_id) REFERENCES LikertAnswerBroadCategory(id) ON UPDATE CASCADE,
  result            INT
) ENGINE = INNODB;

CREATE TABLE SubCategoryResult(
  license_id      INT UNSIGNED NOT NULL, FOREIGN KEY(license_id) REFERENCES License(id),
  sub_category_id INT UNSIGNED NOT NULL, FOREIGN KEY(sub_category_id) REFERENCES LikertAnswerSubCategory(id) ON UPDATE CASCADE,
  result          INT
) ENGINE = INNODB;
Results are written to these tables by finish/index.php once a respondent completes the full questionnaire.
6

Seed Likert Questions

Run mysql/likert/likertfill.mysql to insert the Likert scale values and populate the LikertQuestion table with all questionnaire items.
mysql -u quiz_app -p Quiz < mysql/likert/likertfill.mysql
This first deletes any existing rows in LikertValue and LikertQuestion, then inserts the valid answer values (0, 25, 50, 75, 100 for scored responses; 6 represents N/A) and all questionnaire items. Each question row records its broad category, one or two sub-categories, and whether it is scored inversely.
The mysql/tablefill.mysql script populates placeholder result-report text (text_area1 and text_area2) for each sub-category in LikertAnswerSubCategory. Run it after the steps above if your deployment requires pre-filled report text, then replace the placeholder content with the actual interpretive copy before going live.

Table Schema Reference

The tables below are the core of the data model. All foreign keys are enforced by InnoDB.

License

Stores one row per issued license key. Created by mysql/keyTable.mysql.
ColumnTypeNotes
idINT UNSIGNED AUTO_INCREMENTPrimary key
licenseKeyVARCHAR(255) UNIQUEMD5 hash of the 10-character alphanumeric key sent to the buyer
activeBOOLtrue while quiz is in progress; set to false on completion

admins

Stores administrator login credentials. Created by mysql/adminUser.mysql.
ColumnTypeNotes
idINT AUTO_INCREMENTPrimary key
usernameVARCHAR(255)Admin username
passwordVARCHAR(255)MD5 hash of the password

DemographicQuestion / DemographicAnswer

Created by mysql/demographic/demographicTables.mysql.
ColumnTypeNotes
idINT UNSIGNED AUTO_INCREMENTPrimary key (DemographicQuestion)
questionVARCHAR(255) UNIQUEQuestion text
license_idINT UNSIGNED FK → License(id)Ties the answer to a specific respondent (DemographicAnswer)
demographic_question_idINT UNSIGNED FK → DemographicQuestion(id)Which question was answered
answerVARCHAR(255)Respondent’s free-text or selected answer

LikertQuestion

Created by mysql/likert/likertTables.mysql. Seeded by mysql/likert/likertfill.mysql.
ColumnTypeNotes
idINT UNSIGNED AUTO_INCREMENTPrimary key
questionVARCHAR(255) UNIQUEQuestion text shown to respondent
broad_category_idINT UNSIGNED FK → LikertAnswerBroadCategory(id)Symptomatology or Contributing Factors
sub_category_id1INT UNSIGNED FK → LikertAnswerSubCategory(id)Primary sub-category
sub_category_id2INT UNSIGNED NULL FK → LikertAnswerSubCategory(id)Optional second sub-category
score_inverselyBOOLWhen true, a response of 1 maps to 100 and 5 maps to 0

LikertAnswer

Created by mysql/likert/likertTables.mysql.
ColumnTypeNotes
license_idINT UNSIGNED FK → License(id)Respondent identifier
question_idINT UNSIGNED FK → LikertQuestion(id)Which question was answered
answerTINYINT UNSIGNED FK → LikertValue(input)One of: 0, 25, 50, 75, 100, or 6 (N/A)

SubCategoryResult / BroadCategoryResult

Created by mysql/likert/likertResults.mysql. Written by finish/index.php.
ColumnTypeNotes
license_idINT UNSIGNED FK → License(id)Respondent identifier
sub_category_id / broad_category_idINT UNSIGNED FKCategory the result belongs to
resultINTComputed average score for that category (0–100 scale)

Verify the Setup

After running all scripts, confirm the database is correctly populated:
USE Quiz;
SHOW TABLES;
SELECT COUNT(*) FROM DemographicQuestion;   -- should return 14
SELECT COUNT(*) FROM LikertAnswerBroadCategory; -- should return 2
SELECT COUNT(*) FROM LikertAnswerSubCategory;   -- should return 24
SELECT username FROM admins;                -- should return 'user1'

Build docs developers (and LLMs) love