Parses one participant's JSON export file as produced by the Sleep Diaries app and returns a structured list with raw entries, parsed diary data, and questionnaire results.
Arguments
- path
Path to a
.jsonfile exported from the Sleep Diaries app.- participant_id
Optional character string used as the
participant_idcolumn value. IfNULL(default), uses theresearchCodefield from the JSON, falling back to theparticipantname field, then to the filename.- compute_vars
Logical. If
TRUE(default), adds derived sleep variables (TIB, TST, SE, flags) to morning entries viacompute_sleep_vars().
Value
A named list with class "slumbr_export":
participant_idCharacter. The resolved participant identifier.
participant_nameCharacter. Raw name from JSON.
research_codeCharacter or
NA. Research code from JSON.exported_atPOSIXct. Export timestamp.
diaryData frame. One row per diary entry (morning or evening), with all parsed answer columns.
questionnairesData frame. One row per completed questionnaire, with raw answers in a list-column and computed scores.
rawList. The full parsed JSON, for debugging.