Skip to content

feat(preflight): check session completeness for MeRID collections - #146

Open
cbueth wants to merge 1 commit into
mainfrom
feat/session-completeness-check
Open

feat(preflight): check session completeness for MeRID collections#146
cbueth wants to merge 1 commit into
mainfrom
feat/session-completeness-check

Conversation

@cbueth

@cbueth cbueth commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

What

Add a preflight warning that reports whether participants in multi-session (MeRID) data collections have all expected ET sessions. If this should rather be an error and stop the pipeline from being executed, let me know.

In case labs upload only one of the two required MeRID sessions or only one had been recorded. The preflight check now detects this and warns, so labs can be contacted before processing.

How

  • _check_session_completeness() in preflight.py: groups sessions by Sid.base_id, auto-detects the expected session count from the data pattern, and warns about incomplete participants. Works regardless of whether config says MultiplEYE or MeRID.
  • _compute_session_completeness() in multipleye_data_collection.py: adds Session_completeness stats to the dataset overview YAML.
  • _print_warnings() updated to render the new warning.

Example output:

Session completeness: 105/106 participants have all 2 expected ET sessions.
053_ZH_CH_1 (has session(s): [1], missing: ET2)

Closes #142

Detect sessions per participant by grouping on Sid.base_id and warn
when a participant is missing one or more expected ET sessions.

- Preflight: new _check_session_completeness() warns about incomplete
  participants. Auto-detects expected session count from data pattern,
  so it works regardless of whether the config is MultiplEYE or MeRID.
- Dataset overview: new _compute_session_completeness() adds
  Session_completeness stats (expected/total/complete/incomplete) to
  the dataset overview YAML.
- Tests: 2 parametrized tests covering all-present, missing-ET1/ET2,
  single-session skip, pilot exclusion, 3-session detection, and
  empty sessions edge case.

Closes #142
@cbueth
cbueth requested a review from theDebbister July 21, 2026 14:34
@cbueth cbueth self-assigned this Jul 21, 2026
@cbueth cbueth added the enhancement New feature or request label Jul 21, 2026
@ntyresen

ntyresen commented Jul 22, 2026

Copy link
Copy Markdown

"Add a preflight warning that reports whether participants in multi-session (MeRID) data collections have all expected ET sessions. If this should rather be an error and stop the pipeline from being executed, let me know." - should NOT be an error, e.g. if I am still collecting data and want to evaluate data quality from first session, to potentially troubleshoot before the participant's second session. Also depending on local consent, data protection, ethics laws, rules and guidelines, some labs may be allowed to keep data from only one session, if the second session was never performed b/c of dropout.

@cbueth

cbueth commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for the comment @ntyresen! Along these lines, I now classified it as a warning aggreeing with your choice. @theDebbister will still review it next week and then we merge.

@theDebbister theDebbister left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally agree with the warning. That is sufficient.

About the general session completeness: What happens if a MultiplEYE session has two sessions? Or in general if a data collection where number of expected sessions is 1 has more than 1 session for a session base id? This is not handled currently if I understand it correctly?

@cbueth

cbueth commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

About the general session completeness: What happens if a MultiplEYE session has two sessions? Or in general if a data collection where number of expected sessions is 1 has more than 1 session for a session base id? This is not handled currently if I understand it correctly?

I will reassure and add this as a check. This allows multiple sessions per user, but it should not have the Merid format. I will also add a hint to the warning that mentions the config parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: check existence of both merid et data session

3 participants