Add form load time metadata to Form submissions #2767
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR enhances the implementation of the XForms specification by adding support to xforms-model-construct-done events. The
xforms-model-construct-done
event is to be triggered when the form is fully loaded and ready to be used, which in conjuction withtimeStarNumeric
(computed during xforms-ready) will in turn be used to calculate form load time.Changes in HQ
In order to add the
formLoadTime
metadata to form submissions, there are changes needed to theXForm model
in HQ:Ticket: https://dimagi.atlassian.net/browse/SC-3590
cross-request: dimagi/commcare-core#1412
Note for reviewers
According to the XForms Specification,
xforms-ready
event is dispatched as part ofxforms-model-contract-done
, so the order of execution proposed by this PR is inconsistent with the specification. The main problem is that the current implementation dispatchesxforms-ready
at the beginning of the form initialization process, not when it's ready to be used and changing that would require changes to existing CommCare apps.Safety Assurance
Safety story
This feature makes use of existing functionality to run the calculations and update the form submission with the resulting values.