I’ve reached a bit of an impasse on the editing capability I proposed for Form Actions. See PR#267
After nearly three weeks of thought I am still unsure on how to move it forward.
I’ve put my thoughts below in the hope that others can suggest ways forward and / or persuade me that editing is not required.
In the options below, I consider a simplified census form with just Name and Age columns.
One action is provided, to create a birth event, with citation, and reference it from the relevant person on the form. To keep it simple, the date of the birth event is set to “date_of_census - Age”
Age is measured in years, but for young children on the form, may be specified in months, weeks or days using non-standardised ways e.g. “9m”, “9 mnths”, “9 months”, “9/12”, “6 weeks”, “6 wks”, “6w” etc. etc.
Let’s assume we cannot reliably, automatically, convert all non-integer text to a time span.
Even if for Age this might be technically possible:
- forms may have other fields where this may not be possible
- the user may have reasons for wanting to edit the object(s) being created or modified. e.g. to add notes
No action editing capability
User picks the actions to run. Run the actions.
Restricts the range of actions which could be provided for a given form. To mitigate, consider
a. only offering to create birth events where the age is an integer value
b. for non-integer values, create a birth event with no date set.
User would need to manually find and edit the event afterwards.
Harder for user to add additional information to modified objects (e.g. notes) because they have to subsequently locate the object(s) to edit.
User picks the actions to run. Run the actions. Present user with a list of modified objects, organised by action. Allow user to edit objects until OK clicked.
May restrict the range of actions which could be provided for a given form. To mitigate
a. do not offer birth event action for non-integer ages
b. for non-integer ages, create a birth event with no date set.
Could indicate which events should be manually edit.
User picks the actions to run and indicates which they wish to edit. Run the actions. Show required edit windows, sequentially, during action run.
Compel the user to edit the event date, for non-integer ages, before event is created and referenced.
Allow optional editing for integer ages.
If multiple actions are run and edited, there may be a long sequence of edit windows displayed.
May need supplementary UI so user knows which action is currently being run
Possible actions are shown to the user. User can, optionally, edit the detail of each action. User picks the actions to run. Run the actions
Don’t want to modify the db before the user chooses which actions to run. Therefore need to store some kind of object the “diff” for each action step. When the action is run, the “diff” is applied to the current db object
Diff may create a new object in the db.
On more complex forms, multiple actions may edit the same object (e.g. Person). Changes made by earlier actions must be preserved.
Option 3 is currently coded in PR#267
Option 4 sounds appealing but presents a number of technical challenges
- how to create the diff?
one idea is to store the delta between the pre and post modified object JSON represenation.
when the action is run, need to merge this partial JSON representation into the object being created / modified.
- do want to use standard Edit windows (for consistency; user is familiar with these windows) but they currently add / commit to the db when OK is clicked
- from a edit window, you can edit linked objects too. These should really be captured in the diff as well.