-
-
Notifications
You must be signed in to change notification settings - Fork 94
Fix: Family tree variable use #590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for fresco-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request refactors the Family Tree Census interface to dynamically retrieve variable names for key node and edge attributes from the stage configuration and codebook, eliminating hardcoded attribute references like "name", "sex", and "relationship". The refactor introduces new selector utilities and consistently applies them throughout the interface, making the system more flexible and adaptable to protocol changes.
Changes:
- Introduced new selector utilities (
getNameVariable,getEgoSexVariable,getNodeSexVariable) to dynamically determine variable names from configuration - Replaced hardcoded attribute key references with dynamic lookups in all Family Tree components
- Added
getNameVariableFromCodebookutility function implementing the node labeling heuristics
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
lib/interviewer/utils/getNodeLabelAttribute.ts |
Extracted codebook-only name variable lookup logic into new getNameVariableFromCodebook function |
lib/interviewer/containers/Interfaces/FamilyTreeCensus/utils/nodeUtils.ts |
Added selectors for ego sex, node sex, and name variables with appropriate documentation |
lib/interviewer/containers/Interfaces/FamilyTreeCensus/components/FamilyTreeShells.tsx |
Updated to use dynamic variable names for node name and edge relationship attributes during hydration |
lib/interviewer/containers/Interfaces/FamilyTreeCensus/components/FamilyTreeNodeForm.tsx |
Refactored form logic to dynamically reference name and sex variables throughout node creation and updates |
lib/interviewer/containers/Interfaces/FamilyTreeCensus/components/CensusForm.tsx |
Updated to use getEgoSexVariable instead of getSexVariable for ego attribute access |
lib/interviewer/containers/Interfaces/FamilyTreeCensus/FamilyTreeProvider.tsx |
Updated initialization logic to use dynamic variable names when reading node and edge attributes |
lib/interviewer/containers/Interfaces/FamilyTreeCensus/FamilyTreeCensus.tsx |
Updated edge identification to use dynamic relationship variable |
Comments suppressed due to low confidence (1)
lib/interviewer/utils/getNodeLabelAttribute.ts:37
- Corrected spelling of 'cas' to 'cast'.
// If not encrypted, check for a valid value that can be cas to a string
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lib/interviewer/containers/Interfaces/FamilyTreeCensus/utils/nodeUtils.ts
Outdated
Show resolved
Hide resolved
lib/interviewer/containers/Interfaces/FamilyTreeCensus/components/FamilyTreeNodeForm.tsx
Show resolved
Hide resolved
lib/interviewer/containers/Interfaces/FamilyTreeCensus/components/FamilyTreeShells.tsx
Outdated
Show resolved
Hide resolved
…odeUtils.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…nts/FamilyTreeNodeForm.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lib/interviewer/containers/Interfaces/FamilyTreeCensus/components/CensusForm.tsx
Outdated
Show resolved
Hide resolved
…nts/CensusForm.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Refactor how variables are accessed in the family tree interface. Remove hardcoded keys, and correctly get the variable names from the stage config and codebook.
Todo:
Copilot summary:
This pull request refactors how variable names for key node and edge attributes (such as name and sex) are determined and accessed throughout the Family Tree Census interface. Instead of hardcoding attribute names like
"name"and"sex", the code now dynamically retrieves the correct variable names from the stage configuration and codebook using new selector utilities. This makes the system more flexible and robust to protocol changes, and ensures consistent handling of node and edge data.Dynamic variable name handling for node and edge attributes:
Replaced hardcoded references to
"name"and"sex"attributes with selectors (getNameVariable,getNodeSexVariable,getEgoSexVariable) that dynamically determine the correct variable names from the stage config and codebook in all major components (FamilyTreeProvider,FamilyTreeNodeForm,FamilyTreeShells,CensusForm). [1] [2] [3] [4] [5]Updated all logic for reading, writing, and displaying node and edge attributes to use these dynamic variable names, including node creation, form processing, shell hydration, and edge identification. [1] [2] [3] [4] [5] [6]
New and improved selector utilities:
nodeUtils.tsfor retrieving name and sex variable names for ego and alters, and for finding the correct name variable using heuristics from the codebook (getNameVariableFromCodebook). [1] [2] [3]Component and form logic updates:
CensusFormandFamilyTreeNodeFormto consistently use the new selectors for variable names, ensuring correct reading and writing of node attributes regardless of protocol configuration. [1] [2] [3] [4] [5]Propagating variable name changes throughout the interface:
This refactor makes the Family Tree Census interface much more adaptable to protocol changes and reduces the risk of bugs caused by mismatched or hardcoded variable names.