Skip to content

Refactor node object architecture #75

@TOFarmer

Description

@TOFarmer

Problem to solve

The architecture of how SAL describes nodes (i.e., BranchReport, LeafReport, Branch, and DataClass) has two issues:

  1. While all four base classes list above can be returned from a GET request, they do not share a common interface. While they effectively implement a common interface, it would be preferable for this to be defined.

  2. There is a signficant amount of code duplication, which is particularly prevalent with SummaryObject subclasses and 'DataObject' classes which contain numpy.ndarray objects.

Proposal

  • Create abstract base class Node for the four different responses from nodes.
  • Add abstract to_dict and from_dict to Node (from the subclasses).
  • Create abstract base classes NodeReport (BranchReport, LeafReport) NodeObject (Branch, DataObject), which will unify common serialisation behaviour.

What does success look like, and how can we measure that?

  • Establish a common interface for all objects that can form the response from a list or get operation.
  • Remove duplication from __init__, summary, to_dict, from_dict for all DataClass subclasses.
  • Remove duplication from DataObject subclasses which have array data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureIssues or MRs that add, improve or maintain featuresPriority: 2NORMAL: A task which is not critical and should be addressed when there are no higher priority issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions