Django Quiz - Testing Data


Below is a detailed Sleep Quality quiz example.

For this tutorial, don’t insert the quiz data manually into the database. Download the JSON fixture below, then load it with:
 

Download: ⬇️sleep_quality_quiz.json
 

python manage.py loaddata sleep_quality_quiz.json

 

 

 


The following data will be uploaded directly
 

 

 

Quiz Name

Sleep Quality

 

Questions/Answers

1. How often do you wake during the night?

  • A) Never or rarely
  • B) Once
  • C) 2–3 times
  • D) 4+ times

2. How long does it usually take you to fall asleep?

  • A) Less than 15 minutes
  • B) 15–30 minutes
  • C) 30–60 minutes
  • D) More than 60 minutes

3. How do you feel when you wake up?

  • A) Refreshed
  • B) Okay
  • C) Tired
  • D) Exhausted

4. How consistent is your sleep schedule?

  • A) Very consistent
  • B) Mostly consistent
  • C) Irregular
  • D) Completely unpredictable

5. How active is your mind when trying to fall asleep?

  • A) Almost never active
  • B) Sometimes active
  • C) Often active
  • D) Always active

 

Dimensions
  • Sleep Quality
  • Night Stress
  • Regularity

 

 

Dimension Weights (Answer Model)
Question      Answer      Quality      Stress      Regularity     
1 A +2 -1 0
1 B +1 0 0
1 C -1 +1 0
1 D -2 +2 0
2 A +2 -1 0
2 B +1 0 0
2 C -1 +1 0
2 D -2 +2 0
3 A +2 -1 0
3 B 0 0 0
3 C -1 +1 0
3 D -2 +2 0
4 A +1 -1 +2
4 B 0 0 +1
4 C -1 +1 -1
4 D -2 +2 -2
5 A +1 -2 0
5 B 0 +1 0
5 C -1 +2 0
5 D -2 +3 0

 

 

Profiles & Rules

 

Excellent Sleeper - Priority 5  

  • Quality ≥ 5 (Min 5)
  • Stress ≤ 1 (Max 1)
  • Regularity ≥ 1

Description: Consistent, restorative sleep with low mental strain.

 

Healthy Sleeper - Priority 4

  • Quality ≥ 3
  • Stress ≤ 3
  • Regularity ≥ 0

Description: Generally good sleep with minor improvement potential.

 

Irregular Sleeper - Priority 3

  • Regularity ≤ -1

Description: Inconsistent sleep timing is the main issue.

 

Stressed Sleeper - Priority 2

  • Stress ≥ 4

Description: Elevated mental or physiological activation affecting sleep.

 

Compromised Sleep - Priority 1

(Fallback profile, always assigned if no others match)

Description: Sleep quality or structure is insufficient.