Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@MichaelLukowski
Copy link
Member

@MichaelLukowski MichaelLukowski commented Jul 6, 2023

Bug Fixes

fixing issue with going from PFB -> TSVs -> PFB. When translating from a PFB to TSV files and then back to a PFB file the parent names of the nodes are in plural format. They should be in singular form according to the dictionary. This only happens with the top level parents that are a part of the minimal data model.

Copy link
Contributor

@Avantol13 Avantol13 left a comment

Choose a reason for hiding this comment

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

See comments. Also, can you expand the PR description bug fix to briefly describe the specific issue you're fixing?

from ..cli import to_command

plural_parents = {
"subjects":"subject",
Copy link
Contributor

Choose a reason for hiding this comment

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

does this repo not run wool checks? It must not, can you run the black style formatter over this?

Copy link
Contributor

Choose a reason for hiding this comment

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

And if you have time, I wouldn't mind if you added the wool check, but I understand that's somewhat out of scope


from ..cli import to_command

plural_parents = {
Copy link
Contributor

Choose a reason for hiding this comment

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

PLURAL_PARENTS all caps underscore naming convention for a const module global

Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be configurable rather than a constant global? is this data dictionary specific / have we handled all the cases we know about?

Copy link
Member Author

Choose a reason for hiding this comment

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

These parents node names are part of the minimal data model. Any nodes that are down stream from these top level nodes do not have any problems. I believe it should be fine to just have this as a global constant.

parent_node = r["dst_name"]
parent_id = r["dst_id"]

if parent_node in plural_parents:
Copy link
Contributor

Choose a reason for hiding this comment

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

this is an unnecessary, nit-picky, fancy, one-liner suggestion. But honestly I think your way is more readable

parent_node = plural_parents.get(parent_node, parent_node)

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we should keep it readable. If people are going to work with PFBs I think what was written is sufficient. Both lines are O(1) anyways.

Avantol13
Avantol13 previously approved these changes Jul 20, 2023
@MichaelLukowski MichaelLukowski merged commit 0c2f46e into master Jul 24, 2023
@MichaelLukowski MichaelLukowski deleted the fix/tsv-parent-relations branch July 24, 2023 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants