Skip to content

Incomplete definition for lastHour variables in part5 personsummary data dictionary #1472

@j262byuu

Description

@j262byuu

Describe the bug
In g.report.part5_dictionary, the variable lastHour is not captured by any condition in the definition-building logic, causing what to default to "". For personsummary reports, the aggregation suffix (- plain average or - weighted average) is then appended to an empty string, resulting in a definition that starts with -. When the output CSV is opened in Excel, these cells are interpreted as formulas and display #NAME?.
This issue only affects part5_dictionary_personsummary.csv and does not appear in part5_dictionary_daysummary.csv, as the aggregation suffix (_pla, _wei) is only appended in the personsummary report.

To Reproduce
Run GGIR with any configuration that generates a part5 personsummary report. Open the resulting part5_dictionary_personsummary.csv in Excel and look for rows where Variable is lastHour_pla or lastHour_wei.

Expected behavior
lastHour_pla and lastHour_wei should have a meaningful definition (e.g. "Last hour of the recording - plain average").

Screenshots
Image

Image

Desktop:

  • OS: Linux (Docker container)
  • GGIR Version [3.3.4]

Cause
In g.report.part5_dictionary.R

} else {
what = ""
}

if ("pla" %in% elements) agg = "- plain average"

def = paste(def, agg)

lastHour does not match any what-assignment branch, so the final definition is just the aggregation suffix with no leading content.

Suggested fix
Add lastHour to baseDictionary, or just hardcode lastHour

if ("lastHour" %in% elements) what = "Last hour of the recording"

Additional context
This only affects the readability of the data dictionary CSV and does not impact GGIR's core processing output. However, it may confuse users who use the dictionary for data documentation purposes. Interestingly, this bug seems to have gone unnoticed for a while. I guess perhaps not many of users open the data dictionary CSV directly in Excel lol.

Before submitting

  • Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
  • Have you tried this on the latest main branch from GitHub?

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions