Skip to content

Add methods to return a normalized representation of wrappers #134

@gaurav

Description

@gaurav

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions