# Firebase Data Structure for Audio Task ## Document ID Format - Regular trials: `{userId}_{sessionId}_audio_{trialId}` - Attention check: `{userId}_{sessionId}_audio_attention_check` ## Complete Data Structure Submitted to Firebase ### 1. Participant and Trial Information - `participantId`: User's Firebase Auth UID - `promptId`: `{conv_id}_{turn_no}` - Unique identifier for the prompt - `trialNumber`: 0 for attention check, 1-20 for regular trials - `trialId`: "attention_check" or the actual trial ID - `isAttentionCheck`: Boolean flag ### 2. Content Data - `conversationHistory`: Previous conversation context (if any) - `query`: The user's current query/prompt - `audioClip1`: Filename of first audio (in presentation order) - `audioClip2`: Filename of second audio (in presentation order) - `audioLength1`: Duration of first audio in seconds - `audioLength2`: Duration of second audio in seconds ### 3. AI/Model Ratings (Ground Truth) - `prismRating1`: PRISM score for text 1 - `prismRating2`: PRISM score for text 2 - `aiRatingResponse1`: AI rating for response 1 - `aiRatingResponse2`: AI rating for response 2 - `aiAudioRatingResponse1`: AI audio rating for response 1 - `aiAudioRatingResponse2`: AI audio rating for response 2 - `aiQualityRatingResponse1`: AI quality rating for audio 1 - `aiQualityRatingResponse2`: AI quality rating for audio 2 ### 4. Participant Ratings - `participantRatingNum`: Trial number + 1 - `ratingAudio1`: Final response rating for audio 1 (1-100) - `ratingAudio2`: Final response rating for audio 2 (1-100) - `qualityRatingAudio1`: Final quality rating for audio 1 (1-100) - `qualityRatingAudio2`: Final quality rating for audio 2 (1-100) ### 5. Rating Change History (WITH AUDIO TRACKING) - `ratingChangeHistoryAudio1`: Array of objects, each containing: - `value`: Rating value (1-100) - `timestamp`: ISO timestamp when rating was released - `audioPlaying`: Boolean - was audio 1 playing when rated - `audioCurrentTime`: Current playback position in seconds - `audioDuration`: Total duration of the audio file - `ratingChangeHistoryAudio2`: Same structure for audio 2 - `qualityChangeHistoryAudio1`: Same structure for quality rating - `qualityChangeHistoryAudio2`: Same structure for quality rating ### 6. Timing Information - `taskStartTime`: ISO timestamp when trial started - `taskEndTime`: ISO timestamp when trial was submitted - `timestampRatingAudio1`: When final rating for audio 1 was set - `timestampRatingAudio2`: When final rating for audio 2 was set - `timestampQualityRating1`: When final quality rating 1 was set - `timestampQualityRating2`: When final quality rating 2 was set - `totalTaskDurationMs`: Total time spent on trial in milliseconds ### 7. Order Information - `orderPresented`: Array [1,2] or [2,1] indicating presentation order - `audioShownFirst`: Which audio (1 or 2) was shown first ### 8. Listening Behavior Data - `timesRelistenedAudio1`: Number of times audio 1 was replayed - `timesRelistenedAudio2`: Number of times audio 2 was replayed - `listeningTimesAudio1`: Array of ISO timestamps when audio 1 was played - `listeningTimesAudio2`: Array of ISO timestamps when audio 2 was played - `relistenTimesAudio1`: Array of ISO timestamps for replays of audio 1 - `relistenTimesAudio2`: Array of ISO timestamps for replays of audio 2 ### 9. Seek/Skip Event Data - `seekEventsAudio1`: Array of seek events for audio 1, each containing: - `timestamp`: When the seek occurred - `fromTime`: Starting position before seek - `toTime`: End position after seek - `seekDirection`: 'forward' or 'backward' - `seekDistance`: Distance seeked in seconds - `seekEventsAudio2`: Same structure for audio 2 - `skipEventsAudio1`: Array of skip events for audio 1, each containing: - `timestamp`: When the skip occurred - `fromTime`: Position before skip - `toTime`: Position after skip - `skipType`: 'backward' (currently only -10s implemented) - `skipAmount`: Intended skip amount (10 seconds) - `actualSkipped`: Actual amount skipped - `skipEventsAudio2`: Same structure for audio 2 - `totalSeeksAudio1`: Count of seek events for audio 1 - `totalSeeksAudio2`: Count of seek events for audio 2 - `totalSkipsAudio1`: Count of skip events for audio 1 - `totalSkipsAudio2`: Count of skip events for audio 2 ### 10. Metadata - `modality`: Always "audio" for this task type - `submittedAt`: ISO timestamp when data was submitted to Firebase ## Example Rating Change Entry with Audio Tracking ```json { "value": 75, "timestamp": "2025-10-02T20:30:45.123Z", "audioPlaying": true, "audioCurrentTime": 8.532, "audioDuration": 12.775 } ``` This structure captures: - The rating value (75/100) - When the rating was made - Whether audio was playing during rating adjustment (true) - Where in the audio the user was (8.5 seconds into a 12.8 second clip) ## Data Validation Notes ✅ All timestamps are in ISO 8601 format ✅ All durations are in seconds (floating point) ✅ Rating values are integers from 1-100 ✅ Arrays are empty [] if no events occurred ✅ Null values only used for optional timestamp fields when events haven't occurred ✅ Audio tracking data is captured for EVERY rating/quality change event