Skip to content

refactor: ♻️ turn foer_besoegsdag into a single resource#93

Open
joelostblom wants to merge 21 commits into
mainfrom
refactor/foer_besoegsdag_week_suffix
Open

refactor: ♻️ turn foer_besoegsdag into a single resource#93
joelostblom wants to merge 21 commits into
mainfrom
refactor/foer_besoegsdag_week_suffix

Conversation

@joelostblom

@joelostblom joelostblom commented May 27, 2026

Copy link
Copy Markdown
Contributor

Description

This PR combines got a little bit more messy than the other ones because some fields were not in part of each visit and therefore some of them changed from being required to being optional.

But overall this PR does the following:

  • Combine foer_besoegsdag_2, foer_besoegsdag_3, and foer_besoegsdag_4 into one foer_besoegsdag resource.
  • Add a required visit field with values 2, 3, and 4, and include it in the primary key with event.
  • Normalize before-visit workflow field names by removing _wfv2, _wfv3, and _wfv4 suffixes.
  • Mark fields as optional when they are not present across all joined visits.
  • Remove visit-specific annotation text such as Visit 2, Visit 3, Visit 4, and Wfv2/Wfv3/Wfv4 when it only repeats the new visit field.

Closes #54

This PR needs an in-depth review.

Checklist

  • Ran just run-all

joelostblom and others added 12 commits May 22, 2026 10:57
Join vas_minus10 into the combined VAS resource using minutes_from_meal
so negative and positive meal-relative timepoints share one schema.
Remove the redundant vas_ prefix from variables
after they are moved into the combined VAS resource.
Use descriptive title and description values for the combined VAS resource and make VAS field deduplication easier to read.
Normalize the SEFNC visit-specific REDCap forms into one resource schema with a week field so repeated measurements are represented by rows instead of suffixed columns.
Update the generated data package metadata so SEFNC has one resource with week values 0, 12, and 52 and no visit-suffixed duplicate fields.
Normalize foer_besoegsdag visit-specific forms
into one resource schema with a visit field
so repeated workflow metadata is represented
by rows instead of suffixed resources.
Only remove foer_besoegsdag visit suffixes for the joined visits
so descriptions keep meaningful references to other visits and avoid doubled punctuation.
Update generated metadata
so foer_besoegsdag visits 2, 3, and 4 share one resource
with a visit key and normalized workflow fields.
Build the before-visit field-to-visits map with a reducer so common workflow fields are identified without nested filtering comprehensions.
@joelostblom joelostblom moved this from Todo to In review in Data development May 29, 2026
@joelostblom joelostblom marked this pull request as ready for review May 29, 2026 20:07
@joelostblom joelostblom requested a review from a team as a code owner May 29, 2026 20:07
martonvago
martonvago previously approved these changes Jun 1, 2026

@martonvago martonvago left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This makes sense to me in general!
It's a lot of code, but hopefully it will be possible to generalise some of it 🤞 .

@github-project-automation github-project-automation Bot moved this from In review to In progress in Data development Jun 1, 2026
@lwjohnst86

Copy link
Copy Markdown
Member

This should be re-opened to main, not stacked. Please avoid stacking as much as possible.

@joelostblom joelostblom changed the base branch from refactor/sefnc-week-suffix to main June 2, 2026 13:26
@joelostblom joelostblom dismissed martonvago’s stale review June 2, 2026 13:26

The base branch was changed.

@joelostblom

joelostblom commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

I do avoid stacking when I can, but use it when it helps the review process (ie avoid looking at a giant irrelevant diff). In this case, I used it because I was trying to generalize some functionality that would be shared between these PRs, but after deciding steer away from that direction, it would have been better if I removed some of the functionality from here and then unstacked these PRs.

No need to close and re-open this though, we can just change the base branch; I just did that and resolved conflicts.

@joelostblom joelostblom moved this from In progress to In review in Data development Jun 2, 2026
@lwjohnst86 lwjohnst86 moved this from In review to In progress in Data development Jun 8, 2026
@lwjohnst86 lwjohnst86 marked this pull request as draft June 8, 2026 19:55
@lwjohnst86

Copy link
Copy Markdown
Member

I converted this to draft until #90 has been approved and merged, otherwise it's difficult to know what has been added and what to review.

@joelostblom joelostblom left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think this is ready for another look now that #90 has been merged.

SEFNC_WEEKS = [0, 12, 52]
SEFNC_FORM_WEEKS = {
"sefnc_baseline_v4": 1,
"sefnc_baseline_v4": 0,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I forgot to change this back in the other PR that was just merged. Since this is study week rather than calendar week and the baseline week is included, the range should start at 0

@joelostblom joelostblom marked this pull request as ready for review June 11, 2026 14:06
@joelostblom joelostblom moved this from In progress to In review in Data development Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

Convert foer_besoegsdag_* resources into one

3 participants