Repository navigation
Issue1126 embedding ext function type - #1555
Conversation
…pe external function outcomes in part 2 reports
…er getmeta finishes processing
Merge branch 'master' into issue1126_embeddingExtFunctionType # Conflicts: # R/g.analyse.perday.R # R/g.part2.R
Merge branch 'main' into issue1126_embeddingExtFunctionType # Conflicts: # R/g.analyse.perday.R # R/g.part2.R
Merge branch 'main' into issue1126_embeddingExtFunctionType # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
…ll the type aggregation logic case insensitive
…it in through (...) was being problematic
…ate code for extfuntype in new functions for part 5
…_agg2_60seconds = TRUE
…(both daysummary and personsummary in part 5)
Refactorize each categorical output column independently using its own factor levels, and add a regression test covering multiple type outputs.
LevelsExternalFunction was overwritten for every processed block, causing the complete recording to be factorized using only levels observed in the final block. Consequently, categories present in earlier blocks but absent from the final block were converted to NA. Accumulate levels across all blocks and add regression coverage for multiple categorical outputs.
Returned timestamps were separated before external-function outputs were aggregated or repeated, then added back unchanged. When outputres differed from the GGIR epoch size, timestamps and output values therefore had different lengths, allowing R to silently recycle values and produce misaligned results. Retain the starting timestamp when aggregating into GGIR epochs, and generate timestamps at GGIR epoch intervals when repeating lower-resolution outputs. Add regression tests for both resolution-conversion directions.
check_myfun accepts a single outputtype or reporttype for external functions with multiple output columns, but downstream code indexed these values as if one had been provided per column. Columns after the first therefore received NA or were skipped, potentially causing errors in part 2 and incomplete type processing and reporting in part 5. Recycle scalar outputtype and reporttype values to match the number of external output columns before column-specific processing. Add regression coverage confirming that a scalar reporttype applies to multiple categorical columns.
Remove Tnames from the documented return values because identify_levels does not return it, and document the threshold element that is returned.
Add regression coverage confirming that vector-valued reporttype settings retain their per-column mapping while scalar values continue to be recycled across all external function output columns.
…pe_edits_Vincent Edits to PR 1555: Fix multi-column external function handling and timestamp alignment
…racter vectors or mixed numeric/character matrices, relax aggfunction check, and update tests
…Type to avoid innecessary calculations as total steps during acceleration levels in a type external function metric
…fun, only plot first one of each
Preserve all-NA groups when aggregating external function output to avoid shifting subsequent epochs. Default missing reporttype values to scalar in per-day analysis for compatibility with legacy myfun configurations. Add regression coverage for both cases.
Exclude invalid epochs from Part 5 type durations and prevent unknown padded epochs from affecting invalid or unclassified totals. Preserve scalar recording summaries in mixed type/scalar configurations, restore factor levels after day padding, and match external metadata by column name after imputation reorders mixed outputs. Add regression coverage for invalid epochs, partial-day padding, and mixed external outputs.
Reset ndayswindow when switching to data masking strategy 1 so the reused configuration does not trigger duplicate parameter warnings.
Correct Part 5 type-column ordering, add regression coverage, and align external-function documentation with aggregation behavior, return structures, compatibility defaults, and generated reports.
- In identify_levels_ExtFunType(), make competing type-bout assignments mutually exclusive by treating previously assigned epochs as hard bout boundaries. - In identify_levels_ExtFunType(), preserve the original spelling and case of categorical levels while matching tbout.order case-insensitively. - In identify_levels_ExtFunType(), g.report.part5(), and visualReport(), replace dynamically constructed regular expressions with literal column-name matching so names containing regex characters are handled correctly. - In g.part5_analyseSegment_ExtFunType(), use the level names stored by identify_levels_ExtFunType() when generating type-bout variables. - In aggregateEvent(), detectEventBouts(), and g.analyse.perday(), disambiguate summary and bout variable names when myfun returns multiple event outputs by including the corresponding event metric name. Preserve the existing names for single-event configurations. - In check_myfun(), reject duplicate myfun$colnames because duplicate outputs cannot be mapped reliably to per-column report settings. - In ExternalFunctionType.Rmd, clarify that CSV reports include all categorical outputs, while visualReport() currently plots only the first output configured with reporttype = "type". - In ExternalFunction.Rmd and identify_levels_ExtFunType.Rd, document multiple-event naming and case-preserving categorical-level behavior. - Add regression tests for competing type bouts, case-distinct levels, special characters in names, duplicate output names, and multiple event outputs.
Fix external function aggregation, type summaries, and mixed-output reporting
There was a problem hiding this comment.
My main concern is overlap between ExternalFunction.Rmd and ExternalFunctionType.Rmd, where both now discuss the same topics. See comments below.
I think it would be good to have all basic functionality for external functon embedding discussed in ExternalFunction.Rmd, including aggregation and missing data handling. In that way other vignettes can focus more on the practical use-cases without having to discuss those details again.
For example StepCadenceAnalysis.Rmd shows a specific example of event classifiers and how to interpret their output, but does not list all the parameters again that were discussed in ExternalFunction.Rmd.
Similarly, ExternalFunctionType.Rmd could showcase examples of activity type classifiers and the output this generates.
…tion about integration of output in part 5 and in the visual report
|
Thanks @vincentvanhees, I've implemented your feedback, and additionally expanded the section |
Explain that all-missing epochs are retained but their aggregated values depend on aggfunction. Format report filename templates as inline code and describe the day window as time outside the sustained sleep period.
Fixes #1126 => Implements support for external functions with
reporttype = "type"Fixes #1550 => Extends external function output handling to support multiple output columns, numeric/character output types, per-column aggregation functions, and independent type metrics in Part 5.
Checklist before merging:
inst/NEWS.Rdwith a user-readable summary. Please, include references to relevant issues or PR discussions.DESCRIPTION,zenodo.json, andinst/CITATIONfiles.If NEW GGIR parameter(s) were added then these NEW parameter(s) are:
man/GGIR.RdR/load_params.RR/check_params.Rvignettes/GGIRParameters.Rmdwith references to the GGIR parts the parameter is used in.If GGIR parameter(s) were deprecated these parameter(s) are:
man/GGIR.RdR/load_params.RR/check_params.Rvignettes/GGIRParameters.RmdR/extract_params.Rwith deprecated parameters such that these do not produce warnings when found in old config.csv files.