Skip to content
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

Add methods to return a normalized representation of wrappers #134

Open
gaurav opened this issue Jun 21, 2023 · 0 comments
Open

Add methods to return a normalized representation of wrappers #134

gaurav opened this issue Jun 21, 2023 · 0 comments

Comments

@gaurav
Copy link
Member

gaurav commented Jun 21, 2023

One of the reasons why we run into issues like phyloref/klados#263 is that there is no way to compare phyx.js components that represent identical concepts, e.g. two phylorefs that have the same two internal specifiers, but one of which is missing an .externalSpecifiers field while the other one sets it to an empty list. This means that you can load a file into Klados containing the former, add an external specifier, then delete that external specifier, and Klados will tell you that your file has been modified even though it is still essentially the same file.

We currently determine if the file has changed by doing an exact deep comparison using lodash.isEqual. A more comprehensive approach would be to add some sort of getNormalized() method to PhyxWrapper, PhylorefWrapper, PhylogenyWrapper and other wrapper classes that return a normalized version of the underlying object. This would include standardization, such as:

  • Determining whether we would prefer a particular field (such as .externalSpecifiers) to be missing or an empty list if it is not filled in.
  • Removing fields that are redundant (e.g. genus and specificEpithet, when those can be calculated from binomialName)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant