The architecture of how SAL describes nodes (i.e., BranchReport, LeafReport, Branch, and DataClass) has two issues:
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.
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.
Problem to solve
The architecture of how SAL describes nodes (i.e.,
BranchReport
,LeafReport
,Branch
, andDataClass
) has two issues: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.
There is a signficant amount of code duplication, which is particularly prevalent with
SummaryObject
subclasses and 'DataObject' classes which containnumpy.ndarray
objects.Proposal
Node
for the four different responses from nodes.to_dict
andfrom_dict
toNode
(from the subclasses).NodeReport
(BranchReport
,LeafReport
)NodeObject
(Branch
,DataObject
), which will unify common serialisation behaviour.What does success look like, and how can we measure that?
list
orget
operation.__init__
,summary
,to_dict
,from_dict
for allDataClass
subclasses.DataObject
subclasses which have array data.