Reports normally have a source field. I’ve seen 3 different values in this field: task, contact, and user. Are these the only possible values and are the assumptions below correct?
task - report was submitted from the #/tasks/ tab contact - report was submitted from the #/contacts/tab user - report was submitted from the #/reports/ tab
Yes, that is the way we’ve used them. That said, the field is created and set within forms, so it is more of a convention that we’ve used so far. A community health app using the Core Framework could have other values set, or not use this field at all.
… I see a reference to ./source ='user' in the relevant field for the inputs group. There is also a default value set to user.
This is a form that is most likely accessed from the contacts tab. How/where/when does ./source get set… and if it gets set to contact, wouldn’t the entire inputs group be skipped?
if it gets set to contact , wouldn’t the entire inputs group be skipped?
Correct, that is intended. When accessing a form from the Reports tab the form doesn’t have the context to know who the form is about, so fields in the inputs section are used to ask the user to explicitly select the person (or place). When completing the form from the Contact or the Task tab the form knows who the report will be about so that whole inputs section is not displayed to the user.
Although this is mostly based on convention, there are a couple of things to note. As @diana mentioned, the Core Framework populates the source field when coming from a Contact or Task. Also, the inputs section is always saved with a report, even if the relevant condition is false.
Writing up the response made me think that we should be more explicit than our current documentation [link1, link2] is about the inputs section as something important for forms used by the Core Framework.
Aside from updating documentation, perhaps medic-conf should verify for a decently formed inputs section in all forms, and post a warning otherwise.
Do you think it would be reasonable to have the source changed to task-group (or something like that) if the report was submitted from the Household Tasks screen?
I think we would be creating a little bit of inconsistency.
Right now, there are three ways for a user to get to open a task:
directly from the tasks tab
link from the task list from the contact page
link from household task popup
If the way the user got to a specific task is significant enough to replace the “source”, then we should probably have a second source for the link from contact page as well.
I actually thought that the source would have been set to contact if the user tapped on the Task from the Contacts tab. Based on your list and specification of “directly from” vs. “link from”, now I understand that even if the user tapped on the Task from the Contacts tab and completed the from, the report source would actually be task instead of contact. Is my understanding correct?
If so, it makes sense why you’d suggest a second source for the link from Contact page.
The reason I’m interested in all of this is that I want to know where users are completing Tasksfrom…
directly from the Tasks page
accessing from the Contact page
are they completing any tasks from the household tasks page (haven’t found this in telemetry yet)
I don’t think it’s possible to know any of this today, but setting the source would actually make it really easy.
I believe that when completing a task, no matter where from where the user navigated to the task, the source will always be task, I think source: 'contact' is when a report is submitted directly from the contacts page.