-
Notifications
You must be signed in to change notification settings - Fork 152
Move parent attribute from SurveyElement to relevant subclasses #751
Copy link
Copy link
Open
Labels
Description
As noted here, not all SurveyElement subclasses will have a meaningful or useful parent assigned. This attribute should be moved to the subclasses where a parent is relevant, so that it is clear which objects should have this property. This should also reduce memory usage by removing an unnecessary attribute descriptor from every choice item (Option).
Consideration needs to be given to methods that reference the parent attribute i.e. the logic within these methods, and sensible location for them - such as helper functions or a mixin class. For example in SurveyElement, ._link_children(), .iter_ancestors(), .to_json_dict(), etc.
From a quick look it seems like the following use parent:
- EntityDeclaration: child of
GroupedSection(name="meta") - ExternalInstance: child of
Survey - GroupedSection: child of
Survey/GroupedSection/RepeatingSection - Question: child of
Survey/GroupedSection/RepeatingSection - RepeatingSection: child of
Survey/GroupedSection/RepeatingSection - Tag: child of
OsmUploadQuestion
The following do not:
Section: not instantiated directly.Surveyis a subclass soparentcan't be here.Survey: this is the top-most objectOption: these belong to anItemsetbut are not nestable likeQuestion/GroupedSection/RepeatingSection.
Reactions are currently unavailable