29 lines
921 B
Python
29 lines
921 B
Python
from services.data_loader import load_questions
|
|
import sys
|
|
|
|
# Force UTF-8 for output
|
|
import io
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
|
|
|
def get_personality_chunk4():
|
|
questions_map = load_questions()
|
|
personality_qs = questions_map.get('Personality', [])
|
|
# Filter for adolescent group '14-17'
|
|
age_qs = [q for q in personality_qs if '14-17' in q.get('age_group', '')]
|
|
if not age_qs:
|
|
age_qs = personality_qs
|
|
|
|
# Chunking logic from main.py
|
|
chunk4 = age_qs[105:130]
|
|
|
|
print(f"Total Adolescent Personality Qs: {len(age_qs)}")
|
|
print(f"Chunk 4 Qs (105-130): {len(chunk4)}")
|
|
for q in chunk4:
|
|
# Avoid any problematic characters
|
|
q_code = q['q_code']
|
|
question = q['question'].encode('ascii', errors='ignore').decode('ascii')
|
|
print(f"[{q_code}]: {question}")
|
|
|
|
if __name__ == '__main__':
|
|
get_personality_chunk4()
|