I am checking a report uuid on CouchDB, and there is a record of it, but when I check the task for that one, there is no record. Is that even possible?
Or, my thinking is incorrect,
Tasks UUID > (once do a report) > Report UUID
Task data will be saved to couchdb
Report data will be saved to couchdb also.
Are you certain that the report was generated from a task and not from another action?
To verify, check if the report contains the field inputs.source. If it does, does it indicate "task"? This would confirm that the report originated from a task.
If the report was indeed created from a task, the task document should still exist in CouchDB, even though it gets purged from the user’s device 60 days after completion. The deletion from the device shouldn’t affect CouchDB’s records.
You might also want to double-check how you’re retrieving the task UUID and where exactly you’re looking for it. Could you share more details on your approach?
Thank you for providing more details. The report is indeed generated from a task.
It’s still not clear to me how you are producing the expected task UUID (task~org.couchdb.user:dumfl-b3-13~00004faa-2334-4de8-84a5-732c4bf903a0~screening~screening~1678236732214) though.
Looking at the source_id on your report, the task UUID is more likely to be something like task~org.couchdb.user:dumfl-b3-13~f07fa423-97df-4aff-b5eb-d5ffce295b46~screening~screening~*
I guess you are using CouchDB Fauxton to inspect the task documents. In that case, this Mango query can be helpful to find all the tasks generated from your source document.
So, my teams expectation about 1 task = 1 report is incorrect?
We have a calculation called incentives. We have volunteers to help us working out using the app. And once they have done a task and turned to a report, we will count it and based on the number of reports, they will gonna get a gifts in kind amount money. that is twice a month.
If the report is only accessible from tasks, then you can expect that a report is always coming from a task. Technically, it’s still possible to push the report via API, or directly on the database, but I think we can ignore such cases.
In your case, since the report is also available in “New action”, that assumption does not hold true because a report can be generated without having a task. However, for the report we saw above, it must have been generated by a task (assuming that the source field is not hardcoded).
The username palchc-c0br1-4 in these five tasks looks different than what you were looking for: dumfl-b3-13. Are you still not getting the task you were looking for?
You can also look further into the task documents and see their states with history. For example, a completed task would show:
task_id: The unique identifier of the task in context.
source_id: For tasks with appliesTo: 'contacts, this is the id of the contact for the task. For tasks with appliesTo: 'reports', this is the id of the report which triggered the task.
Please note that these fields will only be populated if the corresponding form (XLS/XML) has these fields defined correctly.
On report3, if task_id is not present or empty but source = task, please check your XLS form.
Even if you don’t have task_id, you should still be able to find the corresponding task document in the CouchDB database by using the queries similar to what we tried above.
Here also, if source = task, but source_id is missing, you need to check your form. In that case, it’s still possible to find the task document by querying other contents of the task document, such as:
Username (doc.user)
Patient UUID (doc.requester or doc.owner)
Patient Name (doc.contact.name)
Task ID or doc.emission._id with regex (slower)
Task Title (doc.emission.title)
Due/start/end dates
Please check this document to get familiar with the task schema. You can also have a look at your task documents in CouchDB database to get full understanding. Running the following Mango query on CouchDB Fauxton should give you a plenty of task documents to spectate: